--- a/client/src/actions/__tests__/notesActions.test.js Tue Oct 09 19:07:47 2018 +0200
+++ b/client/src/actions/__tests__/notesActions.test.js Mon Oct 08 18:35:47 2018 +0200
@@ -6,18 +6,46 @@
describe('actions', () => {
it('should create an action to add a note', () => {
- const text = 'test note'
- const session = { id: 'abcd123' }
+ const text = 'hello world';
+ const dateNote = Date.now();
+ const data = {
+ raw: {
+ document: {
+ nodes: [
+ {
+ object: 'block',
+ type: 'paragraph',
+ nodes: [
+ {
+ object: 'text',
+ leaves: [
+ {
+ text: text,
+ },
+ ],
+ },
+ ],
+ },
+ ],
+ },
+ },
+ plain: text,
+ html: text,
+ startedAt: dateNote,
+ finishedAt: dateNote + 10000,
+ categories: [],
+ marginComment: 'empty',
+ }
+ const session = { _id: 'abcd123' }
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}/),
- session: session.id,
- text: text
+ _id: expect.stringMatching(/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/),
+ session: session._id
}
}
- const receivedAction = actions.addNote(session, text);
+ const receivedAction = actions.addNote(session, data);
expect(receivedAction).toMatchObject(expectedAction);
})