diff --git a/test/imageController.test.ts b/test/imageController.test.ts index ea35df1..0ac227b 100644 --- a/test/imageController.test.ts +++ b/test/imageController.test.ts @@ -3,7 +3,7 @@ import app from "src/app"; import request from "supertest"; import * as imageService from "src/services/imageService"; -afterAll(() => { +afterEach(() => { jest.restoreAllMocks(); }) diff --git a/test/imageService.test.ts b/test/imageService.test.ts index 5f909c0..dbcbc0f 100644 --- a/test/imageService.test.ts +++ b/test/imageService.test.ts @@ -1,4 +1,4 @@ -import { afterAll, describe, expect, it, jest, mock, spyOn } from "bun:test"; +import { afterAll, afterEach, describe, expect, it, jest, mock, spyOn } from "bun:test"; import Image from "src/types/Image"; import request from "supertest"; import * as gelbooruApiService from "src/services/gelbooruApiService"; @@ -7,12 +7,12 @@ import * as imageService from "src/services/imageService"; import app from "src/app"; import { response } from "express"; -afterAll(() => { +afterEach(() => { jest.restoreAllMocks(); }) describe("the service is thread-safe", () => { - it("should not crash when multiple processes call the get() method with 1 remaining image in the queue", async () => { + it("should not crash when multiple processes call the get() method simultaneously", async () => { const NUM_OF_REQUESTS = 110; const getFn = spyOn(imageService, "get");