mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-13 16:14:07 -08:00
109442f38f
* Create new version for S3 * Update S3 to new aws s3 methods * Switch from SAOP to Rest api * Add multipart request * Seperate stream into chunks and send the multipart * Fix chunk into buffer * Fix wrong sha256 mismatch * Add abort multipart on error * Complete multipart and list parts * Change format to xml and add a minmum size of 5MB for each part * Fix returned data for uploading a file * Remove console.logs * Seperate needed headers and multipart headers * Throw error on aborting, remove console.logs * Remove soap request from generic function * Keep buffer * Add unit test for V2 * fix upload file content body * removed unused import * Fix bug where the object was too smal and used only one part * Fix naming for bucket name * Fix issue with file name not returning data * Add parent name * Remove console.logs * Add content type * fix headears for other upload mode --------- Co-authored-by: Marcus <marcus@n8n.io>
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import nock from 'nock';
|
|
import { getWorkflowFilenames, initBinaryDataManager, testWorkflows } from '@test/nodes/Helpers';
|
|
|
|
const workflows = getWorkflowFilenames(__dirname);
|
|
|
|
describe('Test S3 V1 Node', () => {
|
|
describe('File Upload', () => {
|
|
let mock: nock.Scope;
|
|
const now = 1683028800000;
|
|
|
|
beforeAll(async () => {
|
|
jest.useFakeTimers({ doNotFake: ['nextTick'], now });
|
|
|
|
await initBinaryDataManager();
|
|
|
|
nock.disableNetConnect();
|
|
mock = nock('https://bucket.s3.eu-central-1.amazonaws.com');
|
|
});
|
|
|
|
beforeEach(async () => {
|
|
mock.get('/?location').reply(
|
|
200,
|
|
`<?xml version="1.0" encoding="UTF-8"?>
|
|
<LocationConstraint>
|
|
<LocationConstraint>eu-central-1</LocationConstraint>
|
|
</LocationConstraint>`,
|
|
{
|
|
'content-type': 'application/xml',
|
|
},
|
|
);
|
|
|
|
mock
|
|
.put('/binary.json')
|
|
.matchHeader(
|
|
'X-Amz-Content-Sha256',
|
|
'e43abcf3375244839c012f9633f95862d232a95b00d5bc7348b3098b9fed7f32',
|
|
)
|
|
.once()
|
|
.reply(200, { success: true });
|
|
});
|
|
|
|
afterAll(() => {
|
|
nock.restore();
|
|
});
|
|
|
|
testWorkflows(workflows);
|
|
});
|
|
});
|