Added fake data for test and dev environment #17

Merged
Suguivy merged 77 commits from testing into develop 2024-01-06 12:34:44 +00:00
2 changed files with 16 additions and 1 deletions
Showing only changes of commit 76d5764616 - Show all commits

View File

@ -3,7 +3,7 @@ import imageService from "../services/ImageService";
import mongoose, { mongo } from "mongoose";
class ImageController {
async getAllImages(req: Request, res: Response): Promise<void> {
async getAllImages(_: Request, res: Response): Promise<void> {
try {
const images = await imageService.findAll();
res.json({ images });

View File

@ -83,6 +83,21 @@ describe("GET /images works properly", async () => {
it("should return a 200", async () => {
expect(res.statusCode).toBe(200);
});
it("should return 500 for an error on the service", async () => {
mock.module("../src/services/ImageService", () => ({
default: {
add: () => {
throw new Error("This is an expected testing error");
},
},
}));
const res = await request(app)
.get("/images");
expect(res.status).toBe(500);
});
});
describe("POST /images works properly", () => {