409e92d6ae
Build and Push Docker Images / Build Docker Image (push) Has been cancelled
Build and Push Docker Images / Build Railway Docker Image (push) Has been cancelled
Build and Publish n8n Docker Image / test-image (push) Has been cancelled
Dependency Compatibility Check / Fresh Install Dependency Check (push) Has been cancelled
Build and Publish n8n Docker Image / build-and-push (push) Has been cancelled
Build and Publish n8n Docker Image / create-release (push) Has been cancelled
Automated Release / Detect Version Change (push) Has been cancelled
Automated Release / Generate Release Notes (push) Has been cancelled
Automated Release / Create GitHub Release (push) Has been cancelled
Automated Release / Package MCPB Bundle (push) Has been cancelled
Automated Release / Build and Verify (push) Has been cancelled
Automated Release / Publish to NPM (push) Has been cancelled
Automated Release / Build and Push Docker Images (push) Has been cancelled
Automated Release / Update Documentation (push) Has been cancelled
Automated Release / Notify Release Completion (push) Has been cancelled
Secret Scan / secretlint (push) Has been cancelled
Test Suite / test (push) Has been cancelled
Test Suite / cjs-runtime (push) Has been cancelled
Test Suite / publish-results (push) Has been cancelled
65 lines
2.4 KiB
TypeScript
65 lines
2.4 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import {
|
|
CANONICAL_CORE_NODES,
|
|
findMissingCoreNodes,
|
|
assertCoreNodesPresent
|
|
} from '@/scripts/core-node-check';
|
|
|
|
/**
|
|
* Guard for the validator FP audit finding: the shipped nodes.db was missing
|
|
* nodes-base.extractFromFile (a core node), producing hard "Unknown node
|
|
* type" errors in 69 workflows. The rebuild flow must fail loudly when any
|
|
* canonical core node is absent after a rebuild.
|
|
*/
|
|
describe('core-node completeness check', () => {
|
|
const lookupWithAll = { getNode: (_nodeType: string) => ({ nodeType: _nodeType }) };
|
|
const lookupMissing = (...missing: string[]) => ({
|
|
getNode: (nodeType: string) => (missing.includes(nodeType) ? null : { nodeType })
|
|
});
|
|
|
|
it('includes the canonical core nodes that regressed or must never regress', () => {
|
|
const required = [
|
|
'nodes-base.extractFromFile',
|
|
'nodes-base.convertToFile',
|
|
'nodes-base.readWriteFile',
|
|
'nodes-base.code',
|
|
'nodes-base.httpRequest',
|
|
'nodes-base.webhook',
|
|
'nodes-base.set',
|
|
'nodes-base.if',
|
|
'nodes-base.switch',
|
|
'nodes-base.merge',
|
|
'nodes-base.splitInBatches',
|
|
'nodes-base.executeWorkflow',
|
|
'nodes-base.respondToWebhook',
|
|
'nodes-base.scheduleTrigger',
|
|
'nodes-base.manualTrigger'
|
|
];
|
|
for (const nodeType of required) {
|
|
expect(CANONICAL_CORE_NODES).toContain(nodeType);
|
|
}
|
|
});
|
|
|
|
it('returns no missing nodes when all core nodes are present', () => {
|
|
expect(findMissingCoreNodes(lookupWithAll)).toEqual([]);
|
|
expect(() => assertCoreNodesPresent(lookupWithAll)).not.toThrow();
|
|
});
|
|
|
|
it('reports a single missing core node', () => {
|
|
const lookup = lookupMissing('nodes-base.extractFromFile');
|
|
expect(findMissingCoreNodes(lookup)).toEqual(['nodes-base.extractFromFile']);
|
|
});
|
|
|
|
it('throws listing every missing core node', () => {
|
|
const lookup = lookupMissing('nodes-base.extractFromFile', 'nodes-base.merge');
|
|
expect(() => assertCoreNodesPresent(lookup)).toThrow(/nodes-base\.extractFromFile/);
|
|
expect(() => assertCoreNodesPresent(lookup)).toThrow(/nodes-base\.merge/);
|
|
});
|
|
|
|
it('treats undefined lookup results as missing', () => {
|
|
const lookup = { getNode: (_nodeType: string) => undefined };
|
|
expect(findMissingCoreNodes(lookup)).toEqual([...CANONICAL_CORE_NODES]);
|
|
expect(() => assertCoreNodesPresent(lookup)).toThrow();
|
|
});
|
|
});
|