From e5f1c58c11d211a7d2aa18ccfed62c0a0d63e3fc Mon Sep 17 00:00:00 2001 From: Affaan Mustafa Date: Thu, 12 Feb 2026 16:58:27 -0800 Subject: [PATCH] test: add regression tests for empty frontmatter field rejection Add 2 tests verifying validate-agents correctly rejects agents with empty model and empty tools values in YAML frontmatter. --- tests/ci/validators.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/ci/validators.test.js b/tests/ci/validators.test.js index 444a7e1..65592ab 100644 --- a/tests/ci/validators.test.js +++ b/tests/ci/validators.test.js @@ -217,6 +217,24 @@ function runTests() { assert.ok(result.stdout.includes('skipping'), 'Should say skipping'); })) passed++; else failed++; + if (test('rejects agent with empty model value', () => { + const testDir = createTestDir(); + fs.writeFileSync(path.join(testDir, 'empty.md'), '---\nmodel:\ntools: Read, Write\n---\n# Empty model'); + const result = runValidatorWithDir('validate-agents', 'AGENTS_DIR', testDir); + assert.strictEqual(result.code, 1, 'Should reject empty model'); + assert.ok(result.stderr.includes('model'), 'Should mention model field'); + cleanupTestDir(testDir); + })) passed++; else failed++; + + if (test('rejects agent with empty tools value', () => { + const testDir = createTestDir(); + fs.writeFileSync(path.join(testDir, 'empty.md'), '---\nmodel: claude-sonnet-4-5-20250929\ntools:\n---\n# Empty tools'); + const result = runValidatorWithDir('validate-agents', 'AGENTS_DIR', testDir); + assert.strictEqual(result.code, 1, 'Should reject empty tools'); + assert.ok(result.stderr.includes('tools'), 'Should mention tools field'); + cleanupTestDir(testDir); + })) passed++; else failed++; + // ========================================== // validate-hooks.js // ==========================================