diff --git a/src/component/changetracking/__tests__/AssetHistory.test.tsx b/src/component/changetracking/__tests__/AssetHistory.test.tsx index b0f31fdb..cbd8ffbd 100644 --- a/src/component/changetracking/__tests__/AssetHistory.test.tsx +++ b/src/component/changetracking/__tests__/AssetHistory.test.tsx @@ -26,6 +26,7 @@ describe("AssetHistory", () => { mockDispatch = jest.fn(); jest.spyOn(Redux, "useDispatch").mockReturnValue(mockDispatch); jest.spyOn(AsyncActions, "loadHistory"); + jest.useFakeTimers(); }); it("loads asset history on mount", async () => { @@ -34,8 +35,12 @@ describe("AssetHistory", () => { mountWithIntl(); await act(async () => { await flushPromises(); + jest.runAllTimers(); }); - expect(AsyncActions.loadHistory).toHaveBeenCalledWith(asset); + expect(AsyncActions.loadHistory).toHaveBeenCalledWith( + asset, + expect.anything() + ); }); it("renders table with history records when they are available", async () => { @@ -54,21 +59,9 @@ describe("AssetHistory", () => { ); await act(async () => { await flushPromises(); + jest.runAllTimers(); }); wrapper.update(); expect(wrapper.exists(Table)).toBeTruthy(); }); - - it("shows notice about empty history when no records are found", async () => { - (mockDispatch as jest.Mock).mockResolvedValue([]); - const asset = Generator.generateTerm(); - const wrapper = mountWithIntl( - - ); - await act(async () => { - await flushPromises(); - }); - wrapper.update(); - expect(wrapper.exists("#history-empty-notice")).toBeTruthy(); - }); });