mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
34 lines
1.0 KiB
TypeScript
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([]);
|
|
});
|
|
});
|