Bläddra i källkod

Test FlashAlerts rendering

Andrew Swistak 7 år sedan
förälder
incheckning
684ee654ee
1 ändrade filer med 18 tillägg och 1 borttagningar
  1. 18 1
      test/javascript/misc/flash_alerts.test.js

+ 18 - 1
test/javascript/misc/flash_alerts.test.js

@@ -1,7 +1,7 @@
 import React from 'react';
 
 import {Message} from 'semantic-ui-react';
-import {Alert} from 'packs/react-app/components/misc/flash_alerts';
+import FlashAlerts, {Alert} from 'packs/react-app/components/misc/flash_alerts';
 
 describe('<Alert />', () => {
   describe('constructor()', () => {
@@ -38,3 +38,20 @@ describe('<Alert />', () => {
     });
   });
 });
+
+describe('<FlashAlerts />', () => {
+  describe('render()', () => {
+    it('renders child alerts', () => {
+      const wrapper = mount(
+        <FlashAlerts
+          alerts={[
+            {klass: 'foo-alert-1', message: 'foo message 1'},
+            {klass: 'foo-alert-2', message: 'foo message 2'},
+          ]}
+        />,
+      );
+
+      expect(wrapper.find(Alert).length).toEqual(2);
+    });
+  });
+});