From d4cf2f8680ea52973c0a1324f8b679632a398e64 Mon Sep 17 00:00:00 2001 From: Adina Totorean Date: Fri, 10 Jan 2025 11:57:29 +0200 Subject: [PATCH] Modified tests based on changes --- .../test/PresendAdditionalFields.test.ts | 18 ----------------- .../Cognito/test/PresendStringifyBody.test.ts | 2 +- .../Cognito/test/ProcessAttributes.test.ts | 20 ------------------- 3 files changed, 1 insertion(+), 39 deletions(-) diff --git a/packages/nodes-base/nodes/Aws/Cognito/test/PresendAdditionalFields.test.ts b/packages/nodes-base/nodes/Aws/Cognito/test/PresendAdditionalFields.test.ts index dfa83c01b72ad..781232f0c0b05 100644 --- a/packages/nodes-base/nodes/Aws/Cognito/test/PresendAdditionalFields.test.ts +++ b/packages/nodes-base/nodes/Aws/Cognito/test/PresendAdditionalFields.test.ts @@ -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.', - ), - ); - }); }); diff --git a/packages/nodes-base/nodes/Aws/Cognito/test/PresendStringifyBody.test.ts b/packages/nodes-base/nodes/Aws/Cognito/test/PresendStringifyBody.test.ts index 8ffe54efdffd8..cc38b91c9b8f2 100644 --- a/packages/nodes-base/nodes/Aws/Cognito/test/PresendStringifyBody.test.ts +++ b/packages/nodes-base/nodes/Aws/Cognito/test/PresendStringifyBody.test.ts @@ -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', diff --git a/packages/nodes-base/nodes/Aws/Cognito/test/ProcessAttributes.test.ts b/packages/nodes-base/nodes/Aws/Cognito/test/ProcessAttributes.test.ts index a54235d8d32b6..82f4d951fea32 100644 --- a/packages/nodes-base/nodes/Aws/Cognito/test/ProcessAttributes.test.ts +++ b/packages/nodes-base/nodes/Aws/Cognito/test/ProcessAttributes.test.ts @@ -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)); - }); });