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);
    })
})