-
Notifications
You must be signed in to change notification settings - Fork 816
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: adding new environment when having a project with notifications
- Loading branch information
Showing
6 changed files
with
108 additions
and
44 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
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
59 changes: 59 additions & 0 deletions
59
packages/amplify-e2e-tests/src/__tests__/notifications-multi-env.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,59 @@ | ||
import { | ||
addNotificationChannel, | ||
amplifyStatus, | ||
createNewProjectDir, | ||
deleteProject, | ||
deleteProjectDir, | ||
getAppId, | ||
initJSProjectWithProfile, | ||
} from '@aws-amplify/amplify-e2e-core'; | ||
import { addEnvironment, listEnvironment } from '../environment/env'; | ||
import { | ||
getShortId, | ||
} from '../import-helpers'; | ||
|
||
describe('notification category test - SMS', () => { | ||
const testChannel = 'SMS'; | ||
const testChannelSelection = 'SMS'; | ||
const projectPrefix = `notification${testChannel}`.substring(0, 19); | ||
const projectSettings = { | ||
name: projectPrefix, | ||
disableAmplifyAppCreation: false, | ||
}; | ||
|
||
let projectRoot: string; | ||
|
||
beforeEach(async () => { | ||
projectRoot = await createNewProjectDir(projectPrefix); | ||
}); | ||
|
||
afterEach(async () => { | ||
await deleteProject(projectRoot); | ||
deleteProjectDir(projectRoot); | ||
}); | ||
|
||
// inline channels | ||
it(`should add and remove the ${testChannel} channel correctly when no pinpoint is configured`, async () => { | ||
await initJSProjectWithProfile(projectRoot, projectSettings); | ||
|
||
// add sms channel | ||
const settings = { resourceName: `${projectPrefix}${getShortId()}` }; | ||
await addNotificationChannel(projectRoot, settings, testChannelSelection); | ||
|
||
const appId = getAppId(projectRoot); | ||
expect(appId).toBeDefined(); | ||
|
||
// expect that Notifications, Analytics, and Auth categories are shown | ||
await amplifyStatus(projectRoot, 'Notifications'); | ||
await amplifyStatus(projectRoot, 'Analytics'); | ||
await amplifyStatus(projectRoot, 'Auth'); | ||
|
||
await addEnvironment(projectRoot, { envName: 'prod' }); | ||
await listEnvironment(projectRoot, { numEnv: 2 }); | ||
|
||
// expect that Notifications, Analytics, and Auth categories are shown in the new env | ||
await amplifyStatus(projectRoot, 'Notifications'); | ||
await amplifyStatus(projectRoot, 'Analytics'); | ||
await amplifyStatus(projectRoot, 'Auth'); | ||
}); | ||
}); |