From cb7040fe58a9f2fdc82dd224a91471cc7ea0b4f2 Mon Sep 17 00:00:00 2001 From: ManojNB Date: Wed, 31 Jan 2024 17:00:48 -0800 Subject: [PATCH] fix: not appending notification configs --- .../core/__tests__/parseAWSExports.test.ts | 39 +++++++++++++++++++ packages/core/src/parseAWSExports.ts | 1 + 2 files changed, 40 insertions(+) diff --git a/packages/core/__tests__/parseAWSExports.test.ts b/packages/core/__tests__/parseAWSExports.test.ts index 9b50376bd38..cf158b3dac2 100644 --- a/packages/core/__tests__/parseAWSExports.test.ts +++ b/packages/core/__tests__/parseAWSExports.test.ts @@ -262,4 +262,43 @@ describe('parseAWSExports', () => { 'Invalid config parameter.' ); }); + it('should append Notification configs when both Push and InApp configs are available', () => { + const testConfig = { + aws_project_region: 'us-west-2', + aws_user_pools_id: userPoolId, + Notifications: { + Push: { + AWSPinpoint: { + appId: "appId", + region: "region" + } + }, + InAppMessaging: { + AWSPinpoint: { + appId: "appId", + region: "region" + } + } + } + }; + + expect(parseAWSExports(testConfig)).toMatchObject( + { + Notifications: { + PushNotification: { + Pinpoint: { + appId: "appId", + region: "region" + } + }, + InAppMessaging: { + Pinpoint: { + appId: "appId", + region: "region" + } + } + } + } + ); + }); }); diff --git a/packages/core/src/parseAWSExports.ts b/packages/core/src/parseAWSExports.ts index 3bbb1ba0f4a..6d1de4aebac 100644 --- a/packages/core/src/parseAWSExports.ts +++ b/packages/core/src/parseAWSExports.ts @@ -107,6 +107,7 @@ export const parseAWSExports = ( if (Push?.AWSPinpoint) { const { appId, region } = Push.AWSPinpoint; amplifyConfig.Notifications = { + ...amplifyConfig.Notifications, PushNotification: { Pinpoint: { appId,