Files
Termix/plugins/wake-on-lan/tests/frontend/activate.test.tsx
T

34 lines
1.0 KiB
TypeScript

import { afterEach, describe, expect, it } from "vitest";
import {
renderWithApp,
type RenderedPluginApp,
} from "@termix/plugin-sdk/testing";
import type { PluginManifest } from "@termix/plugin-sdk/manifest";
import * as plugin from "../../src/frontend/index";
import manifestJson from "../../manifest.json";
import locales from "../../locales/en.json";
const manifest = manifestJson as unknown as PluginManifest;
let rendered: RenderedPluginApp | null = null;
afterEach(async () => {
await rendered?.deactivate();
rendered = null;
});
describe(`${manifest.id} activate`, () => {
it("registers the Wake host action", async () => {
rendered = await renderWithApp(plugin, { manifest, locales });
expect(rendered.registered.hostActions()).toEqual([
expect.objectContaining({ id: "wake-on-lan" }),
]);
});
it("removes the host action on deactivate", async () => {
const app = await renderWithApp(plugin, { manifest, locales });
await app.deactivate();
expect(app.registered.hostActions()).toEqual([]);
});
});