contract.test.ts 914 B

12345678910111213141516171819202122232425
  1. import { describe, expect, it } from "vitest";
  2. import { ALL_KINDS } from "#office/contract.ts";
  3. import { OFFICE_RUNTIME_OUTPUTS } from "./contract.ts";
  4. import { examplePdfPlugin } from "./contract.example.ts";
  5. import { officeRuntimeModule } from "./module.ts";
  6. // 契约测试只 import contract 与 module,不知道实现是谁。
  7. describe("office-runtime contract", () => {
  8. it("declares its module manifest", () => {
  9. expect(officeRuntimeModule.id).toBe("office-runtime");
  10. });
  11. it("guarantees the server and panel entry points the built-in plugins depend on", () => {
  12. expect(OFFICE_RUNTIME_OUTPUTS).toEqual([
  13. "dist/server.mjs",
  14. "dist/ui/assets.json",
  15. "dist/ui/panel.html",
  16. ]);
  17. });
  18. it("only accepts formats the runtime can open", () => {
  19. const { config } = examplePdfPlugin();
  20. expect(config.kinds.every((kind) => ALL_KINDS.includes(kind))).toBe(true);
  21. });
  22. });