2024-05-11 22:37:32 +02:00
|
|
|
|
import { describe, it, expect } from "vitest";
|
|
|
|
|
import { searchAndResizeImage } from "../../src/api/image-request"
|
|
|
|
|
|
2024-05-11 22:53:06 +02:00
|
|
|
|
// Ces tests sont comment<6E>s pour ne pas provoquer de requ<71>tes <20> r<>p<EFBFBD>titions qui r<>sulteraient en un blocage de google
|
2024-05-11 22:37:32 +02:00
|
|
|
|
|
2024-05-11 22:53:06 +02:00
|
|
|
|
//describe("Image request API", () => {
|
2024-05-11 22:37:32 +02:00
|
|
|
|
|
|
|
|
|
|
2024-05-11 22:53:06 +02:00
|
|
|
|
// it("return a string", async () => {
|
|
|
|
|
// let query = 'cat';
|
|
|
|
|
// let imageUrl = await searchAndResizeImage(query);
|
|
|
|
|
// let isString = typeof imageUrl == 'string'
|
|
|
|
|
// expect(isString).toBe(true);
|
|
|
|
|
// });
|
2024-05-11 22:37:32 +02:00
|
|
|
|
|
2024-05-11 22:53:06 +02:00
|
|
|
|
// it("returns a valid image URL when results are found", async () => {
|
|
|
|
|
// let query = 'cat';
|
|
|
|
|
// let imageUrl = await searchAndResizeImage(query);
|
|
|
|
|
// expect(imageUrl).toMatch(/^https?:\/\/.*\.(?:png|jpg|jpeg|gif|webp)$/i);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// it("returns an empty string when no image is found", async () => {
|
|
|
|
|
// const query = '[][][][][][][][][][][][][][]'; //cette requ<71>te ne renvoie aucune image
|
|
|
|
|
// const imageUrl = await searchAndResizeImage(query);
|
|
|
|
|
// expect(imageUrl).toEqual('');
|
|
|
|
|
// });
|
|
|
|
|
//});
|