You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
804 B
TypeScript
34 lines
804 B
TypeScript
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);
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|