-
-
Save dvallin/5761d5efe2d6fb15b90ca2dc6e97a0f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beforeEach(() => { | |
TasksApi.addTask = jest.fn(); | |
}); | |
it("adds tasks if they cannot be found", async () => { | |
const context = mockContext(undefined); | |
const taskTitle = "title"; | |
const task = new Task(taskTitle); | |
TasksApi.addTask.mockReturnValueOnce( | |
Promise.resolve(task) | |
); | |
await actions.addTask(context, { | |
type: Actions.AddTask, | |
title: taskTitle | |
}); | |
expect(context.commit).toHaveBeenCalledWith({ | |
type: Mutations.AddTaskSucceeded, | |
task | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment