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.
Resize-Api/src/tests/imgProcessingSpec.ts

26 lines
785 B
TypeScript

import app from "../index"
import resizeImg from "../utilities/imgProcessing"
import sizeOf from 'image-size'
import supertest from "supertest"
const request = supertest(app);
describe('Test on utilities', () => {
it('Image should have correct size after resize', async () => {
let outputImg = await resizeImg(400, 400, 'fjord');
let dimensions = sizeOf(outputImg);
expect(dimensions.width).toBe(400);
expect(dimensions.height).toBe(400);
})
})
describe('Test on the image endpoint with resize', () => {
it('Resize working with filename and width/height parameters', async () => {
const response = await request.get('/api/image?filename=encenadaport&width=200&height=200');
expect(response.status).toBe(200);
})
})