Files
HiveGrid-Wireframes/hivegrid-cloud/apps/web/app/routes/admin/entities/groups/entity-group-slug-boundary.test.ts
T

23 lines
911 B
TypeScript

import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
function readRouteSource(path: string) {
return readFileSync(new URL(path, import.meta.url), "utf8");
}
describe("entity group route slug boundary", () => {
it("rejects reserved tenant child route slugs before creating groups", () => {
const source = readRouteSource("new.tsx");
expect(source).toContain("isReservedTenantChildRouteSlug(slug)");
expect(source.indexOf("isReservedTenantChildRouteSlug(slug)")).toBeLessThan(source.indexOf("await createEntityGroup"));
});
it("rejects reserved tenant child route slugs before updating groups", () => {
const source = readRouteSource("$id.tsx");
expect(source).toContain("isReservedTenantChildRouteSlug(slug)");
expect(source.indexOf("isReservedTenantChildRouteSlug(slug)")).toBeLessThan(source.indexOf("await updateEntityGroup"));
});
});