test(e2e): count palette offenders instead of deduping them

The gate compared `[...new Set(offenders)]` against ACCEPTED, so a waiver that
names one node absorbed any number of nodes carrying the same token — a second
element reusing an already-waived off-palette class stayed green, against the
"waive one node, not a rule" contract. Compare the sorted offender list
directly: two nodes with a waived token now fail where one is accepted. All 18
scans stay green (each waived token appears exactly once today).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Sergey Kozyrenko
2026-07-25 03:57:53 +07:00
co-authored by Claude Opus 4.8
parent 4867ad2d6c
commit 5f7a2285be
+4 -4
View File
@@ -105,7 +105,7 @@ test.describe('palette compliance', { tag: '@cross' }, () => {
const offenders = await scanOffenders(page);
const key = `${routes.settings.providers} (populated)`;
expect([...new Set(offenders)], `off-palette colours on ${key}`).toEqual(ACCEPTED[key] ?? []);
expect(offenders.sort(), `off-palette colours on ${key}`).toEqual([...(ACCEPTED[key] ?? [])].sort());
});
});
@@ -119,8 +119,8 @@ test.describe('palette compliance', { tag: '@cross' }, () => {
const offenders = await scanOffenders(page);
expect([...new Set(offenders)], `off-palette colours on ${entry.path}`).toEqual(
ACCEPTED[entry.path] ?? [],
expect(offenders.sort(), `off-palette colours on ${entry.path}`).toEqual(
[...(ACCEPTED[entry.path] ?? [])].sort(),
);
});
@@ -136,7 +136,7 @@ test.describe('palette compliance', { tag: '@cross' }, () => {
const offenders = await scanOffenders(page);
const key = `${entry.path} [${tab.name}]`;
expect([...new Set(offenders)], `off-palette colours on ${key}`).toEqual(ACCEPTED[key] ?? []);
expect(offenders.sort(), `off-palette colours on ${key}`).toEqual([...(ACCEPTED[key] ?? [])].sort());
});
}
});