client/src/actions/__tests__/notesActions.test.js
changeset 3 3b5d37d84cfe
child 13 d6eef0e9f7e1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/actions/__tests__/notesActions.test.js	Tue May 23 13:15:34 2017 +0200
@@ -0,0 +1,22 @@
+// cf. http://redux.js.org/docs/recipes/WritingTests.html
+
+import * as actions from '../notesActions'
+import * as types from '../../constants/actionTypes'
+
+describe('actions', () => {
+
+  it('should create an action to add a note', () => {
+    const text = 'test note'
+    const expectedAction = {
+      type: types.ADD_NOTE,
+      note: {
+          id: expect.stringMatching(/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/),
+          text: text
+      }
+    }
+
+    const receivedAction = actions.addNote(text);
+    expect(receivedAction).toMatchObject(expectedAction);
+
+  })
+})
\ No newline at end of file