hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import { afterEach, describe, expect, it, vi } from "vitest"; |
| 2 | import { getAiCapabilities, getBridgeCertificate } from "../../ai"; |
| 3 | import { lastFetchCall, mockFetchSuccess } from "../helpers/mock-fetch"; |
| 4 | describe("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 | }); |