2024-DEV-BUT3/__tests__/api/inspirobot.test.jsx

19 lines
592 B
JavaScript

import { describe, it, expect } from "vitest";
import { findInspiration } from "../../src/api/inspirobot"
describe("Inspirobot API", () => {
it("return a string", async () => {
let imageUrl = await findInspiration();
let isString = typeof imageUrl == 'string'
expect(isString).toBe(true);
});
it("returns a valid image URL or an empty string", async () => {
let query = 'cat';
let imageUrl = await findInspiration(query);
let okResult = imageUrl.endsWith('.jpg') || imageUrl == ""
expect(okResult).toBe(true)
});
});