-
-
Save dvallin/da421772ddc720b5783c9d764a41e1d8 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
it("maps fetched tasks into response", async () => { | |
const rawTask = {id: "some id", moreData: "garble garble", title: "title"}; | |
const tasks = [rawTask]; | |
axios.get.mockReturnValueOnce(Promise.resolve({data: tasks})); | |
const tasks = await TasksApi.fetchTasks(); | |
expect(tasks).toHaveLength(1); | |
expect(tasks[0]).toBeInstanceOf(Task); | |
expect(tasks[0]).toEqual(new Task(rawTask.id, rawTask.title)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment