* fix(#3312): require static frontend evidence before ui-plan-gate blocks * fix(#3312): fill changeset pr reference * fix(#3312): align regression assertions with section heading and legacy artifact shape --------- Co-authored-by: sim <sim@local>
This commit is contained in:
@@ -23,13 +23,13 @@ describe('UI_TOKENS', () => {
|
||||
});
|
||||
|
||||
describe('checkUiPresence', () => {
|
||||
test('returns { hasUI: false, tokens: [] } for non-string input', () => {
|
||||
assert.deepStrictEqual(checkUiPresence(42), { hasUI: false, tokens: [] });
|
||||
assert.deepStrictEqual(checkUiPresence(null), { hasUI: false, tokens: [] });
|
||||
test('returns { hasUI: false, tokens: [], matchedToken: null, matchedLine: null } for non-string input', () => {
|
||||
assert.deepStrictEqual(checkUiPresence(42), { hasUI: false, tokens: [], matchedToken: null, matchedLine: null });
|
||||
assert.deepStrictEqual(checkUiPresence(null), { hasUI: false, tokens: [], matchedToken: null, matchedLine: null });
|
||||
});
|
||||
|
||||
test('returns false for empty string', () => {
|
||||
assert.deepStrictEqual(checkUiPresence(''), { hasUI: false, tokens: [] });
|
||||
assert.deepStrictEqual(checkUiPresence(''), { hasUI: false, tokens: [], matchedToken: null, matchedLine: null });
|
||||
});
|
||||
|
||||
test('detects standalone UI token (case-insensitive)', () => {
|
||||
@@ -61,6 +61,38 @@ describe('checkUiPresence', () => {
|
||||
assert.ok(result.tokens.includes('frontend'));
|
||||
});
|
||||
|
||||
// ── #3312: hyphenated proper nouns DO match the sniffer (by design — the same
|
||||
// boundary rule that catches `micro-frontend`). The false-positive fix lives in
|
||||
// the GATE (computeUiPlanGate structural corroboration), NOT in the sniffer:
|
||||
// weakening this rule would regress `micro-frontend`. These tests pin the
|
||||
// sniffer behavior AND the matchedToken/matchedLine introspection fields the
|
||||
// gate forwards so an operator can see what tripped it.
|
||||
|
||||
test('#3312 hyphenated proper noun (dashboard-financeiro) matches the sniffer — surfaced via matchedToken/matchedLine', () => {
|
||||
const result = checkUiPresence('Fix broken references in dashboard-financeiro and .env.tpl.');
|
||||
assert.strictEqual(result.hasUI, true,
|
||||
'the sniffer matches `dashboard` at the hyphen boundary — this is the #3312 trigger, intentionally preserved');
|
||||
assert.deepStrictEqual(result.tokens, ['dashboard']);
|
||||
assert.strictEqual(result.matchedToken, 'dashboard');
|
||||
assert.ok(
|
||||
typeof result.matchedLine === 'string' && result.matchedLine.includes('dashboard-financeiro'),
|
||||
'matchedLine carries the first matching line so the operator sees the proper-noun context',
|
||||
);
|
||||
});
|
||||
|
||||
test('matchedLine is the FIRST line containing a match', () => {
|
||||
const result = checkUiPresence('Intro line with no tokens.\nBuild the login form.\nAlso a dashboard.');
|
||||
assert.strictEqual(result.matchedToken, 'form');
|
||||
assert.strictEqual(result.matchedLine, 'Build the login form.');
|
||||
});
|
||||
|
||||
test('`**UI hint**: yes` with no token matches reports null matchedToken/matchedLine', () => {
|
||||
const result = checkUiPresence('**UI hint**: yes\n\nBackend API refactor.\n');
|
||||
assert.strictEqual(result.hasUI, true, 'hint:yes is authoritative');
|
||||
assert.strictEqual(result.matchedToken, null);
|
||||
assert.strictEqual(result.matchedLine, null);
|
||||
});
|
||||
|
||||
test('normalises CRLF line endings', () => {
|
||||
const result = checkUiPresence('Phase 1\r\nBuild a form\r\nDone');
|
||||
assert.ok(result.hasUI);
|
||||
|
||||
Reference in New Issue
Block a user