fix: make tools-documentation test dynamically read n8n version from package.json

- Removed hardcoded version check in test
- Test now reads actual n8n version from package.json at runtime
- Fixes test failure when n8n version is updated

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-07-30 16:19:03 +02:00
parent 4847fae1a1
commit f23fc92c01

View File

@@ -115,14 +115,7 @@ vi.mock('@/mcp/tool-docs', () => ({
}
}));
// Mock package.json for version info
vi.mock('../../package.json', () => ({
default: {
dependencies: {
n8n: '^1.103.2'
}
}
}));
// No need to mock package.json - let the actual module read it
describe('tools-documentation', () => {
beforeEach(() => {
@@ -223,7 +216,11 @@ describe('tools-documentation', () => {
expect(overview).toContain('# n8n MCP Tools Reference');
expect(overview).toContain('## Important: Compatibility Notice');
expect(overview).toContain('n8n version 1.103.2');
// The tools-documentation module dynamically reads version from package.json
// so we need to read it the same way to match
const packageJson = require('../../../package.json');
const n8nVersion = packageJson.dependencies.n8n.replace(/[^0-9.]/g, '');
expect(overview).toContain(`n8n version ${n8nVersion}`);
expect(overview).toContain('## Code Node Configuration');
expect(overview).toContain('## Standard Workflow Pattern');
expect(overview).toContain('**Discovery Tools**');