equal
deleted
inserted
replaced
|
1 // cf. http://redux.js.org/docs/recipes/WritingTests.html |
|
2 |
|
3 import * as actions from '../notesActions' |
|
4 import * as types from '../../constants/actionTypes' |
|
5 |
|
6 describe('actions', () => { |
|
7 |
|
8 it('should create an action to add a note', () => { |
|
9 const text = 'test note' |
|
10 const expectedAction = { |
|
11 type: types.ADD_NOTE, |
|
12 note: { |
|
13 id: expect.stringMatching(/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/), |
|
14 text: text |
|
15 } |
|
16 } |
|
17 |
|
18 const receivedAction = actions.addNote(text); |
|
19 expect(receivedAction).toMatchObject(expectedAction); |
|
20 |
|
21 }) |
|
22 }) |