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