forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits

ai.test.ts17 lines, 807 bytesHistoryRawDownload
1import { afterEach, describe, expect, it, vi } from "vitest";
2import { getAiCapabilities, getBridgeCertificate } from "../../ai";
3import { lastFetchCall, mockFetchSuccess } from "../helpers/mock-fetch";
4describe("ai API", () => {
5 afterEach(() => vi.restoreAllMocks());
6 it("gets the bridge certificate", async () => {
7 mockFetchSuccess({ protocol: "hab/1", certificate_pem: "pem", fingerprint_sha256: "hash" });
8 await getBridgeCertificate();
9 expect(lastFetchCall()[0]).toBe("/api/ai/certificate");
10 });
11 it("gets the bridge capabilities", async () => {
12 mockFetchSuccess({ enabled: true, protocol: "hab/2", capabilities: [] });
13 const result = await getAiCapabilities();
14 expect(result.protocol).toBe("hab/2");
15 expect(lastFetchCall()[0]).toBe("/api/ai/capabilities");
16 });
17});