Skip to content
Snippets Groups Projects
Unverified Commit a22441d5 authored by Phoomparin Mano's avatar Phoomparin Mano Committed by GitHub
Browse files

test(sdk): assert abort calls on static question unmount (#49197)

parent ec6c0880
No related branches found
No related tags found
No related merge requests found
...@@ -180,14 +180,14 @@ describe("StaticQuestion", () => { ...@@ -180,14 +180,14 @@ describe("StaticQuestion", () => {
const abortSpy = jest.spyOn(AbortController.prototype, "abort"); const abortSpy = jest.spyOn(AbortController.prototype, "abort");
const { unmount } = setup(); const { unmount } = setup();
await act(async () => unmount()); await act(async () => unmount());
expect(abortSpy).toHaveBeenCalled(); // two requests should've been made initially
abortSpy.mockRestore();
// sanity check that the two requests were made initially
expect(fetchMock.calls(`path:/api/card/1`).length).toBe(1); expect(fetchMock.calls(`path:/api/card/1`).length).toBe(1);
expect(fetchMock.calls(`path:/api/card/1/query`).length).toBe(1); expect(fetchMock.calls(`path:/api/card/1/query`).length).toBe(1);
// consequently, two abort calls should've been made for the two requests
expect(abortSpy).toHaveBeenCalledTimes(2);
abortSpy.mockRestore();
}); });
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment