Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

1.3 KB
Raw Blame
import { expect, test } from "vitest";
import { serverOnlyRouterOperationMetadata } from "./__generated__/server-only-router-operation-metadata";
import { localOnlyOperationInputs } from "./local-operation-inputs";
import { publicApiOperations } from "./operations";
import { publicApiOperationDocumentation } from "./operation-docs";
import { publicRuntimeOperationContracts } from "./runtime-contracts";

const getSourceOperationCommands = () => [
  ...Object.values(serverOnlyRouterOperationMetadata).map(
    ({ command }) => command
  ),
  ...publicRuntimeOperationContracts.map(({ command }) => command),
  ...localOnlyOperationInputs.map(({ command }) => command),
];

const sortCommands = (commands: readonly string[]) =>
  [...commands].sort((left, right) => left.localeCompare(right));

test("keeps public API operation coverage aligned", () => {
  expect(
    sortCommands(publicApiOperationDocumentation.map(({ command }) => command))
  ).toEqual(sortCommands(getSourceOperationCommands()));

  expect(
    sortCommands(publicApiOperations.map(({ command }) => command))
  ).toEqual(sortCommands(getSourceOperationCommands()));

  expect(publicApiOperations.map(({ command }) => command)).toEqual(
    publicApiOperationDocumentation.map(({ command }) => command)
  );
});