Files
alighasami 3d5eaf9445
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

66 lines
2.4 KiB
TypeScript

import { NodeConnectionTypes } from 'n8n-workflow';
import { getInputs, nodeProperties } from '../methods/config';
describe('config', () => {
describe('getInputs', () => {
it('should return basic inputs for all parameters', () => {
const inputs = getInputs({});
expect(inputs).toHaveLength(3);
expect(inputs[0].type).toBe(NodeConnectionTypes.Main);
expect(inputs[1].type).toBe(NodeConnectionTypes.AiLanguageModel);
expect(inputs[2].type).toBe(NodeConnectionTypes.AiOutputParser);
});
it('should exclude the OutputParser when hasOutputParser is false', () => {
const inputs = getInputs({ hasOutputParser: false });
expect(inputs).toHaveLength(2);
expect(inputs[0].type).toBe(NodeConnectionTypes.Main);
expect(inputs[1].type).toBe(NodeConnectionTypes.AiLanguageModel);
});
it('should include the OutputParser when hasOutputParser is true', () => {
const inputs = getInputs({ hasOutputParser: true });
expect(inputs).toHaveLength(3);
expect(inputs[2].type).toBe(NodeConnectionTypes.AiOutputParser);
});
it('should exclude the FallbackInput when needsFallback is false', () => {
const inputs = getInputs({ hasOutputParser: true, needsFallback: false });
expect(inputs).toHaveLength(3);
expect(inputs[0].type).toBe(NodeConnectionTypes.Main);
expect(inputs[1].type).toBe(NodeConnectionTypes.AiLanguageModel);
expect(inputs[2].type).toBe(NodeConnectionTypes.AiOutputParser);
});
it('should include the FallbackInput when needsFallback is true', () => {
const inputs = getInputs({ hasOutputParser: false, needsFallback: true });
expect(inputs).toHaveLength(3);
expect(inputs[2].type).toBe(NodeConnectionTypes.AiLanguageModel);
});
});
describe('nodeProperties', () => {
it('should have the expected properties', () => {
expect(Array.isArray(nodeProperties)).toBe(true);
expect(nodeProperties.length).toBeGreaterThan(0);
const promptParams = nodeProperties.filter((prop) => prop.name === 'prompt');
expect(promptParams.length).toBeGreaterThan(0);
const messagesParam = nodeProperties.find((prop) => prop.name === 'messages');
expect(messagesParam).toBeDefined();
expect(messagesParam?.type).toBe('fixedCollection');
const hasOutputParserParam = nodeProperties.find((prop) => prop.name === 'hasOutputParser');
expect(hasOutputParserParam).toBeDefined();
expect(hasOutputParserParam?.type).toBe('boolean');
});
});
});