profile.test.ts 820 B

12345678910111213141516171819202122
  1. import { beforeEach, describe, expect, it, vi } from "vitest";
  2. import type { Profile } from "#office/profile.ts";
  3. // Single-format plugins: wording names only what each one opens.
  4. const as = (profile: Profile) => {
  5. vi.resetModules();
  6. vi.doMock("#office/profile.ts", () => ({ PROFILE: profile }));
  7. };
  8. describe("a PDF-only profile", () => {
  9. beforeEach(() =>
  10. as({ name: "pdf", version: "0.2.0", title: { en: "PDF", "zh-CN": "PDF" }, kinds: ["pdf"] }),
  11. );
  12. it("addresses the plugin's own server and resources", async () => {
  13. const contract = await import("#office/contract.ts");
  14. expect(contract.SERVER_NAME).toBe("pdf");
  15. expect(contract.PANEL_URI).toBe("ui://pdf/panel.html");
  16. expect(contract.kindOf("paper.pdf")).toBe("pdf");
  17. expect(contract.kindOf("report.docx")).toBeNull();
  18. });
  19. });