client/src/actions/__tests__/notesActions.test.js
changeset 3 3b5d37d84cfe
child 13 d6eef0e9f7e1
equal deleted inserted replaced
2:b52921a63e77 3:3b5d37d84cfe
       
     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 })