client/src/actions/__tests__/notesActions.test.js
author Alexandre Segura <mex.zktk@gmail.com>
Tue, 23 May 2017 16:18:34 +0200
changeset 5 5c91bfa8fcde
parent 3 3b5d37d84cfe
child 13 d6eef0e9f7e1
permissions -rw-r--r--
Introduce SlateJS.

// 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);

  })
})