Skip to content

Commit

Permalink
Modified tests based on changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adina-hub committed Jan 10, 2025
1 parent 0da656f commit d4cf2f8
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
});

0 comments on commit d4cf2f8

Please sign in to comment.