import { describe, expect, it } from "vitest"; import { readFileSync } from "node:fs"; import { resolve } from "node:path"; const read = (relativePath: string) => readFileSync(resolve(__dirname, relativePath), "utf8"); describe("Contract fee project permissions", () => { it("hides list create/delete controls when the matching backend operation is not allowed", () => { const source = read("./ContractFees.vue"); expect(source).toContain('v-if="canCreate"'); expect(source).toContain('v-if="canDelete"'); expect(source).toContain("if (!canCreate.value)"); expect(source).toContain("if (!canDelete.value)"); expect(source).not.toContain(':disabled="!canCreate"'); expect(source).not.toContain(':disabled="!canDelete || isInactiveSite(scope.row.center_id)"'); }); it("hides detail edit controls and blocks direct navigation without update permission", () => { const source = read("./ContractFeeDetail.vue"); expect(source).toContain('v-if="canWrite"'); expect(source).toContain("if (!canWrite.value)"); }); });