19 lines
592 B
React
19 lines
592 B
React
|
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)
|
||
|
});
|
||
|
});
|