Fix JS unit tests

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-08-02 19:26:23 +02:00
parent 8c480af4bd
commit 0c749742ab
6 changed files with 35 additions and 16 deletions

View File

@@ -76,8 +76,7 @@ describe("Reset page", () => {
token: "some-token",
});
await wrapper.vm.$nextTick();
await wrapper.vm.$nextTick();
await flushPromises();
expect(wrapper.find("article.message.is-danger").text()).toContain(
"The token you provided is invalid"

View File

@@ -115,13 +115,14 @@ describe("Render login form", () => {
expect(requestHandlers.loginMutationHandler).toHaveBeenCalledWith({
...loginMock,
});
await wrapper.vm.$nextTick();
await wrapper.vm.$nextTick();
await flushPromises();
const currentUser = mockClient?.cache.readQuery<{
currentUser: ICurrentUser;
}>({
query: CURRENT_USER_CLIENT,
})?.currentUser;
await flushPromises();
expect(currentUser?.email).toBe("some@email.tld");
expect(currentUser?.id).toBe("1");
expect(jest.isMockFunction(wrapper.vm.$router.push)).toBe(true);