test(3566): remove raw-text greps from codex hooks regression
This commit is contained in:
@@ -86,7 +86,7 @@ describe('#3566 — Codex feature flag is canonical "hooks" (not legacy "codex_h
|
|||||||
|
|
||||||
test('fresh install writes [features].hooks = true and never emits codex_hooks', () => {
|
test('fresh install writes [features].hooks = true and never emits codex_hooks', () => {
|
||||||
withCodexHome(codexHome, () => install(true, 'codex'));
|
withCodexHome(codexHome, () => install(true, 'codex'));
|
||||||
const { text, parsed } = readConfig(codexHome);
|
const { parsed } = readConfig(codexHome);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
featuresHooks(parsed),
|
featuresHooks(parsed),
|
||||||
@@ -98,15 +98,6 @@ describe('#3566 — Codex feature flag is canonical "hooks" (not legacy "codex_h
|
|||||||
undefined,
|
undefined,
|
||||||
'fresh install must NOT write legacy [features].codex_hooks',
|
'fresh install must NOT write legacy [features].codex_hooks',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Belt-and-suspenders: the raw text should also not embed the legacy key.
|
|
||||||
// (Acceptable because the rule's intent is "no codex_hooks key anywhere";
|
|
||||||
// parseTomlToObject only proves the resolved shape, not absence of the
|
|
||||||
// string in a stale comment.)
|
|
||||||
assert.ok(
|
|
||||||
!/^\s*codex_hooks\s*=/m.test(text) && !/^\s*features\.codex_hooks\s*=/m.test(text),
|
|
||||||
`raw config.toml must not contain a codex_hooks assignment, got:\n${text}`,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('install over a pre-existing legacy [features].codex_hooks line preserves it (user-owned, #2760 defensive)', () => {
|
test('install over a pre-existing legacy [features].codex_hooks line preserves it (user-owned, #2760 defensive)', () => {
|
||||||
@@ -153,20 +144,13 @@ describe('#3566 — Codex feature flag is canonical "hooks" (not legacy "codex_h
|
|||||||
fs.writeFileSync(path.join(codexHome, 'config.toml'), userOwned);
|
fs.writeFileSync(path.join(codexHome, 'config.toml'), userOwned);
|
||||||
|
|
||||||
withCodexHome(codexHome, () => install(true, 'codex'));
|
withCodexHome(codexHome, () => install(true, 'codex'));
|
||||||
const { text, parsed } = readConfig(codexHome);
|
const { parsed } = readConfig(codexHome);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
featuresHooks(parsed),
|
featuresHooks(parsed),
|
||||||
true,
|
true,
|
||||||
'user-owned hooks=true must be preserved',
|
'user-owned hooks=true must be preserved',
|
||||||
);
|
);
|
||||||
// No duplicate line emission — exactly one hooks-assignment in the file.
|
|
||||||
const hooksAssignments = text.match(/^\s*hooks\s*=/gm) || [];
|
|
||||||
assert.strictEqual(
|
|
||||||
hooksAssignments.length,
|
|
||||||
1,
|
|
||||||
`expected exactly one hooks = assignment, got ${hooksAssignments.length}`,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('uninstall removes GSD-owned canonical hooks line but preserves user-owned hooks', () => {
|
test('uninstall removes GSD-owned canonical hooks line but preserves user-owned hooks', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user