11import {
2- addAuthWithEmailVerificationAndUserPoolGroupTriggers ,
32 addFunction ,
4- amplifyPull ,
53 amplifyPushAuth ,
64 createNewProjectDir ,
75 deleteProject ,
@@ -10,10 +8,6 @@ import {
108 generateRandomShortId ,
119 getAppId ,
1210 getProjectMeta ,
13- getTeamProviderInfo ,
14- gitCleanFdx ,
15- gitCommitAll ,
16- gitInit ,
1711 initJSProjectWithProfile ,
1812} from '@aws-amplify/amplify-e2e-core' ;
1913import { addEnvironmentCarryOverEnvVars , checkoutEnvironment , removeEnvironment } from '../environment/env' ;
@@ -108,82 +102,3 @@ describe('upload and delete parameters', () => {
108102 ) ;
109103 } ) ;
110104} ) ;
111-
112- describe ( 'parameters in Parameter Store' , ( ) => {
113- let projRoot : string ;
114- const envName = 'enva' ;
115-
116- beforeAll ( async ( ) => {
117- projRoot = await createNewProjectDir ( 'multi-env-parameters-test' ) ;
118- } ) ;
119-
120- afterAll ( async ( ) => {
121- await deleteProject ( projRoot ) ;
122- deleteProjectDir ( projRoot ) ;
123- } ) ;
124-
125- it ( 'hydrates missing parameters into TPI on pull' , async ( ) => {
126- await initJSProjectWithProfile ( projRoot , { disableAmplifyAppCreation : false , envName } ) ;
127- const meta = getProjectMeta ( projRoot ) ;
128- expect ( meta ) . toBeDefined ( ) ;
129- const appId = getAppId ( projRoot ) ;
130- expect ( appId ) . toBeDefined ( ) ;
131- const region = meta . providers . awscloudformation . Region ;
132- expect ( region ) . toBeDefined ( ) ;
133- await gitInit ( projRoot ) ;
134- await gitCommitAll ( projRoot ) ; // commit all just after init, so no categories block exists in TPI yet
135-
136- const envVariableName = 'envVariableName' ;
137- const envVariableValue = 'envVariableValue' ;
138-
139- const fnName = `parameterstestfn${ generateRandomShortId ( ) } ` ;
140- await addFunction (
141- projRoot ,
142- {
143- name : fnName ,
144- functionTemplate : 'Hello World' ,
145- environmentVariables : {
146- key : envVariableName ,
147- value : envVariableValue ,
148- } ,
149- } ,
150- 'nodejs' ,
151- ) ;
152- await addAuthWithEmailVerificationAndUserPoolGroupTriggers ( projRoot ) ;
153- await amplifyPushAuth ( projRoot ) ;
154- const expectedParamsAfterPush = [
155- { name : 'deploymentBucketName' } ,
156- { name : envVariableName , value : envVariableValue } ,
157- { name : 's3Key' } ,
158- ] ;
159- await expectParametersOptionalValue ( expectedParamsAfterPush , [ ] , region , appId , envName , 'function' , fnName ) ;
160-
161- const preCleanTpi = getTeamProviderInfo ( projRoot ) ;
162-
163- // test pull --restore same dir
164- await gitCleanFdx ( projRoot ) ; // clear TPI
165- await amplifyPull ( projRoot , { appId, envName, withRestore : true , emptyDir : true } ) ;
166- const postPullWithRestoreTpi = getTeamProviderInfo ( projRoot ) ;
167- expect ( postPullWithRestoreTpi ) . toEqual ( preCleanTpi ) ;
168-
169- // test pull same dir
170- await gitCleanFdx ( projRoot ) ; // clear TPI
171- await amplifyPull ( projRoot , { appId, envName, withRestore : false , emptyDir : true } ) ;
172- const postPullWithoutRestoreTpi = getTeamProviderInfo ( projRoot ) ;
173- expect ( postPullWithoutRestoreTpi ) . toEqual ( preCleanTpi ) ;
174-
175- expect ( await getTpiAfterPullInEmptyDir ( appId , envName , true ) ) . toEqual ( preCleanTpi ) ;
176- expect ( await getTpiAfterPullInEmptyDir ( appId , envName , false ) ) . toEqual ( preCleanTpi ) ;
177- } ) ;
178-
179- const getTpiAfterPullInEmptyDir = async ( appId : string , envName : string , withRestore : boolean ) : Promise < Record < string , any > > => {
180- let emptyDir : string ;
181- try {
182- emptyDir = await createNewProjectDir ( 'empty-dir-parameters-test' ) ;
183- await amplifyPull ( emptyDir , { appId, envName, withRestore, emptyDir : true } ) ;
184- return getTeamProviderInfo ( emptyDir ) ;
185- } finally {
186- deleteProjectDir ( emptyDir ) ;
187- }
188- } ;
189- } ) ;
0 commit comments