From 0a340cfa91f25508177f5981a77d95100269cfbd Mon Sep 17 00:00:00 2001 From: ashika112 Date: Wed, 30 Oct 2024 16:16:51 -0700 Subject: [PATCH] fix bundle size & test --- packages/aws-amplify/package.json | 2 +- .../middleware/retry/defaultRetryDecider.test.ts | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/aws-amplify/package.json b/packages/aws-amplify/package.json index 8aee4213a57..2a808815c19 100644 --- a/packages/aws-amplify/package.json +++ b/packages/aws-amplify/package.json @@ -317,7 +317,7 @@ "name": "[Analytics] identifyUser (Pinpoint)", "path": "./dist/esm/analytics/index.mjs", "import": "{ identifyUser }", - "limit": "15.99 kB" + "limit": "16.00 kB" }, { "name": "[Analytics] enable", diff --git a/packages/core/__tests__/clients/middleware/retry/defaultRetryDecider.test.ts b/packages/core/__tests__/clients/middleware/retry/defaultRetryDecider.test.ts index decdd2b53db..0cee3a38ec1 100644 --- a/packages/core/__tests__/clients/middleware/retry/defaultRetryDecider.test.ts +++ b/packages/core/__tests__/clients/middleware/retry/defaultRetryDecider.test.ts @@ -23,7 +23,7 @@ describe('getRetryDecider', () => { jest.resetAllMocks(); }); - it('should handle network errors', async () => { + describe('created retryDecider', () => { const mockNetworkErrorThrownFromFetch = new AmplifyError({ name: AmplifyErrorCode.NetworkError, message: 'Network Error', @@ -35,20 +35,25 @@ describe('getRetryDecider', () => { test.each([ [ 'a network error from the fetch handler', - true, + { + retryable: true, + }, mockNetworkErrorThrownFromFetch, ], [ 'a network error from the XHR handler defined in Storage', - true, + { + retryable: true, + }, mockNetworkErrorThrownFromXHRInStorage, ], - ])('when receives %p returns %p', (_, expected, error) => { + ])('when receives %p returns %p', async (_, expected, error) => { const mockResponse = {} as unknown as HttpResponse; mockErrorParser.mockReturnValueOnce(error); const retryDecider = getRetryDecider(mockErrorParser); + const result = await retryDecider(mockResponse, error); - expect(retryDecider(mockResponse, error)).resolves.toBe(expected); + expect(result).toEqual(expected); }); });