Files
n8n-enterprise-unlocked/packages/nodes-base/nodes/HttpRequest/test/binaryData/HttpRequest.test.ts
कारतोफ्फेलस्क्रिप्ट™ 73e8d76e13 refactor: Overhaul nodes-testing setup - Part 1 (no-changelog) (#14303)
2025-04-01 10:15:13 +02:00

29 lines
787 B
TypeScript

import nock from 'nock';
import { getWorkflowFilenames, initBinaryDataService, testWorkflows } from '@test/nodes/Helpers';
describe('Test Binary Data Download', () => {
const baseUrl = 'https://dummy.domain';
beforeAll(async () => {
await initBinaryDataService();
nock(baseUrl)
.persist()
.get('/path/to/image.png')
.reply(200, Buffer.from('test'), { 'content-type': 'image/png' });
nock(baseUrl)
.persist()
.get('/redirect-to-image')
.reply(302, {}, { location: baseUrl + '/path/to/image.png' });
nock(baseUrl).persist().get('/custom-content-disposition').reply(200, Buffer.from('testing'), {
'content-disposition': 'attachment; filename="testing.jpg"',
});
});
const workflows = getWorkflowFilenames(__dirname);
testWorkflows(workflows);
});