mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-27 13:39:44 -08:00
75541e91f2
Story: [PAY-846](https://linear.app/n8n/issue/PAY-846) | Related: https://github.com/n8n-io/n8n/pull/7225 For the S3 backend for external storage of binary data and execution data, the `getAsStream` method in the binary data manager interface used by FS and S3 will need to become async. This is a breaking change for nodes-base.
36 lines
1 KiB
TypeScript
36 lines
1 KiB
TypeScript
import { prepareRequestBody } from '../../GenericFunctions';
|
|
import type { BodyParameter, BodyParametersReducer } from '../../GenericFunctions';
|
|
|
|
describe('HTTP Node Utils, prepareRequestBody', () => {
|
|
it('should call default reducer', async () => {
|
|
const bodyParameters: BodyParameter[] = [
|
|
{
|
|
name: 'foo.bar',
|
|
value: 'baz',
|
|
},
|
|
];
|
|
const defaultReducer: BodyParametersReducer = jest.fn();
|
|
|
|
await prepareRequestBody(bodyParameters, 'json', 3, defaultReducer);
|
|
|
|
expect(defaultReducer).toBeCalledTimes(1);
|
|
expect(defaultReducer).toBeCalledWith({}, { name: 'foo.bar', value: 'baz' });
|
|
});
|
|
|
|
it('should call process dot notations', async () => {
|
|
const bodyParameters: BodyParameter[] = [
|
|
{
|
|
name: 'foo.bar.spam',
|
|
value: 'baz',
|
|
},
|
|
];
|
|
const defaultReducer: BodyParametersReducer = jest.fn();
|
|
|
|
const result = await prepareRequestBody(bodyParameters, 'json', 4, defaultReducer);
|
|
|
|
expect(defaultReducer).toBeCalledTimes(0);
|
|
expect(result).toBeDefined();
|
|
expect(result).toEqual({ foo: { bar: { spam: 'baz' } } });
|
|
});
|
|
});
|