test(s3): fix formatting of mock implementation in unit tests
All checks were successful
Backend Tests / test (push) Successful in 1m10s
Lint / lint (backend) (push) Successful in 1m7s
Lint / lint (documentation) (push) Successful in 1m8s
Lint / lint (frontend) (push) Successful in 1m6s
Backend Tests / test (pull_request) Successful in 1m10s
Lint / lint (backend) (pull_request) Successful in 1m7s
Lint / lint (documentation) (pull_request) Successful in 1m6s
Lint / lint (frontend) (pull_request) Successful in 1m7s
All checks were successful
Backend Tests / test (push) Successful in 1m10s
Lint / lint (backend) (push) Successful in 1m7s
Lint / lint (documentation) (push) Successful in 1m8s
Lint / lint (frontend) (push) Successful in 1m6s
Backend Tests / test (pull_request) Successful in 1m10s
Lint / lint (backend) (pull_request) Successful in 1m7s
Lint / lint (documentation) (pull_request) Successful in 1m6s
Lint / lint (frontend) (pull_request) Successful in 1m7s
This commit is contained in:
@@ -196,22 +196,26 @@ describe("S3Service", () => {
|
||||
});
|
||||
|
||||
it("should use DOMAIN_NAME and PORT for localhost", () => {
|
||||
(configService.get as jest.Mock).mockImplementation((key: string, def: any) => {
|
||||
if (key === "API_URL") return null;
|
||||
if (key === "DOMAIN_NAME") return "localhost";
|
||||
if (key === "PORT") return 3000;
|
||||
return def;
|
||||
});
|
||||
(configService.get as jest.Mock).mockImplementation(
|
||||
(key: string, def: any) => {
|
||||
if (key === "API_URL") return null;
|
||||
if (key === "DOMAIN_NAME") return "localhost";
|
||||
if (key === "PORT") return 3000;
|
||||
return def;
|
||||
},
|
||||
);
|
||||
const url = service.getPublicUrl("test.webp");
|
||||
expect(url).toBe("http://localhost:3000/media/test.webp");
|
||||
});
|
||||
|
||||
it("should use api.DOMAIN_NAME for production", () => {
|
||||
(configService.get as jest.Mock).mockImplementation((key: string, def: any) => {
|
||||
if (key === "API_URL") return null;
|
||||
if (key === "DOMAIN_NAME") return "memegoat.fr";
|
||||
return def;
|
||||
});
|
||||
(configService.get as jest.Mock).mockImplementation(
|
||||
(key: string, def: any) => {
|
||||
if (key === "API_URL") return null;
|
||||
if (key === "DOMAIN_NAME") return "memegoat.fr";
|
||||
return def;
|
||||
},
|
||||
);
|
||||
const url = service.getPublicUrl("test.webp");
|
||||
expect(url).toBe("https://api.memegoat.fr/media/test.webp");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user