test: cover every fix branch guide mutation

This commit is contained in:
sechmachine
2026-08-15 14:38:12 +07:00
parent 719e02ea90
commit 97e991317d
+11 -3
View File
@@ -62,10 +62,18 @@ const contents = readContents();
validate(contents); validate(contents);
if (process.argv.includes('--self-test')) { if (process.argv.includes('--self-test')) {
for (const {file} of documents) {
const positiveRecommendation = new Map(contents); const positiveRecommendation = new Map(contents);
positiveRecommendation.set('AGENTS.md', `${contents.get('AGENTS.md')}\nUse ${invalidForm} for a targeted repair.\n`); positiveRecommendation.set(file, `${contents.get(file)}\nUse ${invalidForm} for a targeted repair.\n`);
assert.throws(() => validate(positiveRecommendation), /AGENTS\.md contains an unapproved branch-form reference/); assert.throws(
() => validate(positiveRecommendation),
(error) => error instanceof Error
&& error.message.includes(`${file} contains an unapproved branch-form reference`)
);
}
} }
console.log(`Fix-branch workflow documentation: ${documents.length} approved statements validated`); console.log(`Fix-branch workflow documentation: ${documents.length} approved statements validated`);
if (process.argv.includes('--self-test')) console.log('Positive nested branch recommendation: rejected'); if (process.argv.includes('--self-test')) {
console.log(`Positive nested branch recommendations: ${documents.length}/${documents.length} rejected`);
}