import { describe, it, expect } from "vitest"; import { readFileSync } from "node:fs"; import { join, dirname } from "node:path"; import { fileURLToPath } from "node:url"; const __dirname = dirname(fileURLToPath(import.meta.url)); const REPO_ROOT = join(__dirname, "..", ".."); const FEATURES = ["auth", "blog", "media", "marketing-pages", "navigation"]; const ANCHORS = { "src/index.ts": ["// ", "// "], "src/di/symbols.ts": ["// ", "// ", "// "], "src/di/bind-production.ts": ["// ", "// ", "// "], "src/di/bind-dev-seed.ts": ["// ", "// ", "// "], "src/integrations/cms/index.ts": ["// "], }; describe("// anchor presence in core-eslint/base.js", () => { it("base.js contains realtime-rules-imports anchor", () => { const baseSource = readFileSync(join(REPO_ROOT, "packages/core-eslint/base.js"), "utf8"); expect(baseSource).toContain("// "); expect(baseSource).toContain("// "); }); it("base.js contains events-rules anchor", () => { const baseSource = readFileSync(join(REPO_ROOT, "packages/core-eslint/base.js"), "utf8"); expect(baseSource).toContain("// "); }); }); describe("// anchor presence in feature packages", () => { for (const feature of FEATURES) { for (const [relPath, anchors] of Object.entries(ANCHORS)) { it(`packages/${feature}/${relPath} contains all required anchors`, () => { const path = join(REPO_ROOT, "packages", feature, relPath); const content = readFileSync(path, "utf8"); for (const anchor of anchors) { expect(content).toContain(anchor); } }); } } });