15 lines
723 B
TypeScript
15 lines
723 B
TypeScript
import { readFileSync } from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
import path from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const source = readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), "./EntityForm.tsx"), "utf8");
|
|
|
|
describe("EntityForm routing examples", () => {
|
|
it("renders entity API examples through the canonical API host helper", () => {
|
|
expect(source).toContain("apiPath(`entities/${slug || \"entity-name\"}/rows`, { mode: \"host-aware\" })");
|
|
expect(source).toContain("rootData.apiBaseUrl ? new URL(apiRowsPath, rootData.apiBaseUrl).toString() : apiRowsPath");
|
|
expect(source).not.toContain("Generates entity API at /v1/entities/");
|
|
});
|
|
});
|