-
Notifications
You must be signed in to change notification settings - Fork 820
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrates notifications category to support in app messaging cha…
…nnel notifications (#11170) * feat: migrates notifications category to support in app messaging channel notifications
- Loading branch information
Showing
12 changed files
with
277 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 62 additions & 7 deletions
69
packages/amplify-category-analytics/src/migrations/in-app-messaging-migration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...s/src/__tests__/migration_tests/notifications-migration/notifications-migration-2.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { | ||
addNotificationChannel, | ||
amplifyPushAuth, | ||
createNewProjectDir, | ||
deleteProject, | ||
deleteProjectDir, | ||
} from '@aws-amplify/amplify-e2e-core'; | ||
import { initJSProjectWithProfile, versionCheck } from '../../../migration-helpers'; | ||
import { addLegacySmsNotificationChannel } from '../../../migration-helpers/notifications-helpers'; | ||
import { getShortId } from '../../../migration-helpers/utils'; | ||
|
||
describe('amplify add notifications', () => { | ||
let projectRoot: string; | ||
const migrateFromVersion = { v: '10.0.0' }; | ||
const migrateToVersion = { v: 'uninitialized' }; | ||
|
||
beforeEach(async () => { | ||
projectRoot = await createNewProjectDir('notification-migration-2'); | ||
}); | ||
|
||
afterEach(async () => { | ||
await deleteProject(projectRoot, undefined, true); | ||
deleteProjectDir(projectRoot); | ||
}); | ||
|
||
beforeAll(async () => { | ||
await versionCheck(process.cwd(), false, migrateFromVersion); | ||
await versionCheck(process.cwd(), true, migrateToVersion); | ||
}); | ||
|
||
it('should add in app notifications if another notification channel added with an older version', async () => { | ||
expect(migrateFromVersion.v).not.toEqual(migrateToVersion.v); | ||
const settings = { resourceName: `notification${getShortId()}` }; | ||
|
||
await initJSProjectWithProfile(projectRoot, {}, false); | ||
await addLegacySmsNotificationChannel(projectRoot, settings.resourceName); | ||
await addNotificationChannel(projectRoot, settings, 'In-App Messaging', true, true, true); | ||
await amplifyPushAuth(projectRoot, true); | ||
}); | ||
|
||
it('should add in app notifications if another notification channel added and pushed with an older version', async () => { | ||
expect(migrateFromVersion.v).not.toEqual(migrateToVersion.v); | ||
const settings = { resourceName: `notification${getShortId()}` }; | ||
|
||
await initJSProjectWithProfile(projectRoot, {}, false); | ||
await addLegacySmsNotificationChannel(projectRoot, settings.resourceName); | ||
await amplifyPushAuth(projectRoot, false); | ||
await addNotificationChannel(projectRoot, settings, 'In-App Messaging', true, true, true); | ||
await amplifyPushAuth(projectRoot, true); | ||
}); | ||
}); |
Oops, something went wrong.