contract.test.ts 972 B

1234567891011121314151617181920212223242526
  1. import { describe, expect, it } from "vitest";
  2. import {
  3. createOfficialCommandEndpoint,
  4. OFFICIAL_COMMAND_ROUTES,
  5. withOfficialCommandEnv,
  6. type CliOfficialCommandEndpointContract,
  7. } from "../../src/official-command-endpoint/index.js";
  8. import { cliOfficialCommandEndpointModule } from "../../src/official-command-endpoint/module.js";
  9. describe("cli-official-command-endpoint contract", () => {
  10. it("declares its module manifest", () => {
  11. expect(cliOfficialCommandEndpointModule.id).toBe("cli-official-command-endpoint");
  12. });
  13. it("is implemented by the public entrypoint", () => {
  14. const contract: CliOfficialCommandEndpointContract = {
  15. createOfficialCommandEndpoint,
  16. withOfficialCommandEnv,
  17. };
  18. expect(typeof contract.createOfficialCommandEndpoint).toBe("function");
  19. });
  20. it("only lends identity to the Sites API", () => {
  21. expect(OFFICIAL_COMMAND_ROUTES).toEqual([{ prefix: "/api/v1/sites", pluginId: "zcode-site" }]);
  22. });
  23. });