mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-25 08:08:39 +00:00
fix: mock the ai status fetch in its activate test
This commit is contained in:
1 parent
e88d5a52e3
commit
d3c209af13
1 file changed
+12
-1
@@ -1,4 +1,10 @@
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { waitFor } from "@testing-library/react";
|
||||
|
||||
vi.mock("../../src/frontend/ai-api", async (importOriginal) => ({
|
||||
...(await importOriginal<Record<string, unknown>>()),
|
||||
getAiStatus: vi.fn(async () => ({ globallyEnabled: true, enabled: true })),
|
||||
}));
|
||||
import {
|
||||
renderWithApp,
|
||||
type RenderedPluginApp,
|
||||
@@ -50,4 +56,9 @@ describe(`${manifest.id} activate`, () => {
|
||||
expect(app.registered.settingsComponents()).toEqual([]);
|
||||
expect(app.registered.actions()).toEqual([]);
|
||||
});
|
||||
|
||||
it("adds the assistant tab once AI is on for the user", async () => {
|
||||
rendered = await renderWithApp(plugin, { manifest, locales });
|
||||
await waitFor(() => expect(rendered!.registered.tabs()).toEqual(["ai"]));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user