mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-01-30 06:22:04 +00:00
test: make templates database validation critical instead of optional
Previously, the CI test only warned when templates were missing but always passed. This allowed the templates database to be lost without failing CI. Now the test will fail if templates are empty or below the expected count of 2500. Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -175,14 +175,18 @@ describe.skipIf(!dbExists)('Database Content Validation', () => {
|
||||
).toBeGreaterThan(100); // Should have ~108 triggers
|
||||
});
|
||||
|
||||
it('MUST have templates table (optional but recommended)', () => {
|
||||
it('MUST have templates table populated', () => {
|
||||
const templatesCount = db.prepare('SELECT COUNT(*) as count FROM templates').get();
|
||||
|
||||
if (templatesCount.count === 0) {
|
||||
console.warn('WARNING: No workflow templates found. Run: npm run fetch:templates');
|
||||
}
|
||||
// This is not critical, so we don't fail the test
|
||||
expect(templatesCount.count).toBeGreaterThanOrEqual(0);
|
||||
expect(templatesCount.count,
|
||||
'CRITICAL: Templates table is EMPTY! Templates are required for search_templates MCP tool and real-world examples. ' +
|
||||
'Run: npm run fetch:templates OR restore from git history.'
|
||||
).toBeGreaterThan(0);
|
||||
|
||||
expect(templatesCount.count,
|
||||
`WARNING: Expected at least 2500 templates, got ${templatesCount.count}. ` +
|
||||
'Templates may have been partially lost. Run: npm run fetch:templates'
|
||||
).toBeGreaterThanOrEqual(2500);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user