Example #1
0
    it('calls FakeNote.post with projectId, storyId and note', async () => {
      const FakeNote = {
        post: sinon.stub().resolves(note)
      };

      const fakeDispatch = sinon.stub().resolves({});

      await Note.createNote(projectId, storyId, note)
        (fakeDispatch, null, { Note: FakeNote });

      expect(FakeNote.post).toHaveBeenCalledWith(projectId, storyId, note);
    });
Example #2
0
    it('dispatch createNoteSuccess with storyId and note', async () => {
      const FakeNote = {
        post: sinon.stub().resolves(note)
      };

      const fakeDispatch = sinon.stub().resolves({});

      await Note.createNote(projectId, storyId, note)
        (fakeDispatch, null, { Note: FakeNote });

      expect(fakeDispatch).toHaveBeenCalledWith(Note.createNoteSuccess(storyId, note));
    });
Example #3
0
    it('dispatches storyFailure when promise fails', async () => {
      const error = { error: "boom" };

      const FakeNote = {
        post: sinon.stub().rejects(error)
      };

      const fakeDispatch = sinon.stub().resolves({});

      await Note.createNote(projectId, storyId, note)
        (fakeDispatch, null, { Note: FakeNote });

      expect(fakeDispatch).toHaveBeenCalledWith(Story.storyFailure(storyId, error));
    });