client/src/actions/__tests__/notesActions.test.js
changeset 13 d6eef0e9f7e1
parent 3 3b5d37d84cfe
child 168 ea92f4fe783d
equal deleted inserted replaced
12:48ddaa42b810 13:d6eef0e9f7e1
     5 
     5 
     6 describe('actions', () => {
     6 describe('actions', () => {
     7 
     7 
     8   it('should create an action to add a note', () => {
     8   it('should create an action to add a note', () => {
     9     const text = 'test note'
     9     const text = 'test note'
       
    10     const session = { id: 'abcd123' }
    10     const expectedAction = {
    11     const expectedAction = {
    11       type: types.ADD_NOTE,
    12       type: types.ADD_NOTE,
    12       note: {
    13       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         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         session: session.id,
       
    16         text: text
    15       }
    17       }
    16     }
    18     }
    17 
    19 
    18     const receivedAction = actions.addNote(text);
    20     const receivedAction = actions.addNote(session, text);
    19     expect(receivedAction).toMatchObject(expectedAction);
    21     expect(receivedAction).toMatchObject(expectedAction);
    20 
    22 
    21   })
    23   })
    22 })
    24 })