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
60 lines
1.5 KiB
TypeScript
60 lines
1.5 KiB
TypeScript
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
|
import type { WorkflowTestData } from 'n8n-workflow';
|
|
import path from 'path';
|
|
|
|
describe('Test Read Binary Files Node', () => {
|
|
const testHarness = new NodeTestHarness();
|
|
const workflowData = testHarness.readWorkflowJSON('ReadBinaryFiles.workflow.json');
|
|
const node = workflowData.nodes.find((n) => n.name === 'Read Binary Files')!;
|
|
const dir = path.join(__dirname, 'data').split('\\').join('/');
|
|
node.parameters.fileSelector = `${dir}/*.json`;
|
|
|
|
const tests: WorkflowTestData[] = [
|
|
{
|
|
description: 'nodes/ReadBinaryFiles/test/ReadBinaryFiles.workflow.json',
|
|
input: {
|
|
workflowData,
|
|
},
|
|
output: {
|
|
assertBinaryData: true,
|
|
nodeData: {
|
|
'Read Binary Files': [
|
|
[
|
|
{
|
|
binary: {
|
|
data: {
|
|
mimeType: 'application/json',
|
|
fileType: 'json',
|
|
fileExtension: 'json',
|
|
data: 'ewoJInRpdGxlIjogIkxvcmVtIElwc3VtIgp9Cg==',
|
|
fileName: 'sample.json',
|
|
fileSize: '28 B',
|
|
},
|
|
},
|
|
json: {},
|
|
},
|
|
{
|
|
binary: {
|
|
data: {
|
|
mimeType: 'application/json',
|
|
fileType: 'json',
|
|
fileExtension: 'json',
|
|
data: 'ewoJInRpdGxlIjogIklwc3VtIExvcmVtIgp9Cg==',
|
|
fileName: 'sample2.json',
|
|
fileSize: '28 B',
|
|
},
|
|
},
|
|
json: {},
|
|
},
|
|
],
|
|
],
|
|
},
|
|
},
|
|
},
|
|
];
|
|
|
|
for (const testData of tests) {
|
|
testHarness.setupTest(testData);
|
|
}
|
|
});
|