diff --git a/apps/skolplattformen-app-new/libs/api-skolplattformen/lib/__tests__/queueFetcher.test.ts b/apps/skolplattformen-app-new/libs/api-skolplattformen/lib/__tests__/queueFetcher.test.ts index 622526fa..e4f870de 100644 --- a/apps/skolplattformen-app-new/libs/api-skolplattformen/lib/__tests__/queueFetcher.test.ts +++ b/apps/skolplattformen-app-new/libs/api-skolplattformen/lib/__tests__/queueFetcher.test.ts @@ -48,8 +48,17 @@ test('can run many tasks', async () => { expect(result).toEqual(['one', 'two', 'three']); }); -test.skip('sets up timer on fetch', () => { - sut.fetch(async () => 'one', 'one'); +// test('sets up timer on fetch', () => { +// sut.fetch(async () => 'one', 'one'); - expect(setTimeout).toHaveBeenCalledTimes(1); +// expect(setTimeout).toHaveBeenCalledTimes(1); +// }); + +test('sets up timer on fetch', () => { + const setTimeoutSpy = jest.spyOn(global, 'setTimeout'); + sut.fetch(async () => 'one', 'one'); + expect(setTimeoutSpy).toHaveBeenCalledTimes(1); + + // Restore the original setTimeout function + setTimeoutSpy.mockRestore(); });