Modified tests based on changes

This commit is contained in:
Adina Totorean 2025-01-10 11:57:29 +02:00
parent 0da656f872
commit d4cf2f8680
3 changed files with 1 additions and 39 deletions

View file

@ -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.',
),
);
});
});

View file

@ -34,7 +34,7 @@ describe('presendStringifyBody', () => {
expect(result.body).toBeUndefined();
});
test('should handle an empty body gracefully', async () => {
test('should handle an empty body', async () => {
const requestOptions = {
method: 'POST' as const,
url: '/example-endpoint',

View file

@ -65,24 +65,4 @@ describe('processAttributes', () => {
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));
});
});