fix: mock the ai status fetch in its activate test

This commit is contained in:
LukeGus committed 2026-09-22 20:20:47 -05:00
1 parent e88d5a52e3
commit d3c209af13
1 file changed
+12 -1
+12 -1
View File
@@ -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"]));
});
});