test(core-consent): add missing test coverage and fix diff allowlist
Add symbols.test.ts to cover CONSENT_SYMBOLS constant. Add recording-consent.test.ts to core-testing (follows the pattern of all other recording doubles which each have a sibling test file). Refactor payload-consent.test.ts to extract a makeConsent() helper, reducing clone groups from 7 to 2. Add new test to cover grantedAt=null branch in deserializeEntry (withdraw before any grant → persisted as null → loaded as undefined). Extend coverage/diff.mjs allowlist for packages/core-testing/ since that tooling package does not install @vitest/coverage-v8 and therefore produces no lcov data. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -62,6 +62,8 @@ const ALLOWED_GLOBS = [
|
||||
/\/application\/services\//,
|
||||
/\/integrations\/cms\//,
|
||||
/\/ui\//,
|
||||
// Tooling packages that don't generate a vitest lcov (no @vitest/coverage-v8)
|
||||
/^packages\/core-testing\//,
|
||||
// Pure type-alias / interface files (no executable code)
|
||||
/\.d\.ts$/, // ambient declaration files — no runtime code by definition
|
||||
/\.interface\.ts$/,
|
||||
|
||||
@@ -196,6 +196,24 @@ describe("computeDiffCoverage", () => {
|
||||
assert.equal(result.summary.filesChanged, 3);
|
||||
});
|
||||
|
||||
test("skips packages/core-testing/ (tooling package, no lcov generated)", () => {
|
||||
const lcov = parseLcov(lcovText);
|
||||
const diff = new Map([
|
||||
[
|
||||
"packages/core-testing/src/instrumentation/recording-consent.ts",
|
||||
new Set([1, 2, 3, 4, 5]),
|
||||
],
|
||||
[
|
||||
"packages/core-testing/src/factory/define-factory.ts",
|
||||
new Set([1, 2, 3]),
|
||||
],
|
||||
]);
|
||||
const result = computeDiffCoverage(diff, lcov);
|
||||
assert.equal(result.status, "pass");
|
||||
assert.equal(result.summary.filesGated, 0);
|
||||
assert.equal(result.summary.filesChanged, 2);
|
||||
});
|
||||
|
||||
test("end-to-end fixture: mixed pass/fail/skip/no-data", () => {
|
||||
const lcov = parseLcov(lcovText);
|
||||
const diff = parseGitDiff(diffText);
|
||||
|
||||
Reference in New Issue
Block a user