import app from "../index" import supertest from "supertest" import path from "path" import fs from "fs" const request = supertest(app); // Endpoint testing describe('Test endpoint responses', () => { it('Check if input images folder exists', async () => { let inputimgPath: string = path.resolve("images/full", `fjord.jpg`); let result = fs.existsSync(inputimgPath) expect(result).toBe(true); }) it('Get the api endpoint', async () => { const response = await request.get('/api/image?filename=fjord'); expect(response.status).toBe(200); }) it('Throw an error if the image name is incorrect', async () => { const response = await request.get('/api/image?filename=test'); expect(response.status).toBe(404); }) })