Small fixes
Unit Tests with docker compose / unit-test (push) Successful in 21s Details
Build image / build (push) Successful in 41s Details

This commit is contained in:
Sugui 2024-04-21 12:49:38 +02:00
parent 2f140996d5
commit 076f330185
2 changed files with 4 additions and 4 deletions

View File

@ -3,7 +3,7 @@ import app from "src/app";
import request from "supertest"; import request from "supertest";
import * as imageService from "src/services/imageService"; import * as imageService from "src/services/imageService";
afterAll(() => { afterEach(() => {
jest.restoreAllMocks(); jest.restoreAllMocks();
}) })

View File

@ -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 Image from "src/types/Image";
import request from "supertest"; import request from "supertest";
import * as gelbooruApiService from "src/services/gelbooruApiService"; import * as gelbooruApiService from "src/services/gelbooruApiService";
@ -7,12 +7,12 @@ import * as imageService from "src/services/imageService";
import app from "src/app"; import app from "src/app";
import { response } from "express"; import { response } from "express";
afterAll(() => { afterEach(() => {
jest.restoreAllMocks(); jest.restoreAllMocks();
}) })
describe("the service is thread-safe", () => { 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 NUM_OF_REQUESTS = 110;
const getFn = spyOn(imageService, "get"); const getFn = spyOn(imageService, "get");