mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Modified tests based on changes
This commit is contained in:
parent
0da656f872
commit
d4cf2f8680
|
@ -48,22 +48,4 @@ describe('presendAdditionalFields', () => {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should throw an error if options are empty but other parameters are set', async () => {
|
|
||||||
mockContext.getNodeParameter.mockReturnValueOnce({});
|
|
||||||
|
|
||||||
const requestOptions = {
|
|
||||||
method: 'POST' as const,
|
|
||||||
url: '/example-endpoint',
|
|
||||||
body: {},
|
|
||||||
headers: {},
|
|
||||||
};
|
|
||||||
|
|
||||||
await expect(presendAdditionalFields.call(mockContext, requestOptions)).rejects.toThrow(
|
|
||||||
new NodeOperationError(
|
|
||||||
mockContext.getNode(),
|
|
||||||
'At least one of the additional fields must be provided to update the group.',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,7 +34,7 @@ describe('presendStringifyBody', () => {
|
||||||
expect(result.body).toBeUndefined();
|
expect(result.body).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should handle an empty body gracefully', async () => {
|
test('should handle an empty body', async () => {
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
method: 'POST' as const,
|
method: 'POST' as const,
|
||||||
url: '/example-endpoint',
|
url: '/example-endpoint',
|
||||||
|
|
|
@ -65,24 +65,4 @@ describe('processAttributes', () => {
|
||||||
new ApplicationError('Invalid request body: Expected a JSON string or object.'),
|
new ApplicationError('Invalid request body: Expected a JSON string or object.'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should process attributes with custom prefix correctly', async () => {
|
|
||||||
mockGetNodeParameter.mockReturnValueOnce([{ Name: 'custom:age', Value: '30' }]);
|
|
||||||
|
|
||||||
const requestOptions = {
|
|
||||||
method: 'POST' as const,
|
|
||||||
url: '/example-endpoint',
|
|
||||||
headers: {},
|
|
||||||
body: JSON.stringify({ UserPoolId: 'mockPoolId' }),
|
|
||||||
};
|
|
||||||
|
|
||||||
const updatedRequestOptions = await processAttributes.call(mockContext, requestOptions);
|
|
||||||
|
|
||||||
const expectedBody = {
|
|
||||||
UserPoolId: 'mockPoolId',
|
|
||||||
UserAttributes: [{ Name: 'custom:age', Value: '30' }],
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(updatedRequestOptions.body).toBe(JSON.stringify(expectedBody));
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue