@@ -51,7 +51,6 @@ describe("createApp", () => {
5151
5252 describe ( "when all environment variables are set" , ( ) => {
5353 beforeEach ( ( ) => {
54- process . env . CDK_CONFIG_stackName = "test-stack"
5554 process . env . CDK_CONFIG_versionNumber = "1.2.3"
5655 process . env . CDK_CONFIG_commitId = "abc123def456"
5756 process . env . CDK_CONFIG_isPullRequest = "false"
@@ -62,19 +61,12 @@ describe("createApp", () => {
6261 const { app, props} = createApp ( buildParams ( ) )
6362
6463 expect ( app ) . toBeInstanceOf ( App )
65- expect ( props . stackName ) . toBe ( "test-stack-1-2-3" )
6664 expect ( props . version ) . toBe ( "1.2.3" )
6765 expect ( props . commitId ) . toBe ( "abc123def456" )
6866 expect ( props . isPullRequest ) . toBe ( false )
6967 expect ( props . env ?. region ) . toBe ( "eu-west-2" )
7068 } )
7169
72- test ( "creates stateful App with correct stackName" , ( ) => {
73- const { props} = createApp ( buildParams ( { isStateless : false } ) )
74-
75- expect ( props . stackName ) . toBe ( "test-stack" )
76- } )
77-
7870 test ( "uses custom region when provided" , ( ) => {
7971 const { props} = createApp ( buildParams ( { region : "us-east-1" } ) )
8072
@@ -111,13 +103,12 @@ describe("createApp", () => {
111103 expect ( addTagSpy ) . toHaveBeenCalledWith ( "DeploymentTool" , "CDK" )
112104 expect ( addTagSpy ) . toHaveBeenCalledWith ( "version" , "1.2.3" )
113105 expect ( addTagSpy ) . toHaveBeenCalledWith ( "commit" , "abc123def456" )
114- expect ( addTagSpy ) . toHaveBeenCalledWith ( "stackName" , "test-stack" )
115106 expect ( addTagSpy ) . toHaveBeenCalledWith ( "cdkApp" , "testApp" )
116107 expect ( addTagSpy ) . toHaveBeenCalledWith ( "repo" , "testRepo" )
117108 expect ( addTagSpy ) . toHaveBeenCalledWith ( "cfnDriftDetectionGroup" , "test-drift-group" )
118109
119- // Verify exactly 20 tags were added
120- expect ( addTagSpy ) . toHaveBeenCalledTimes ( 20 )
110+ // Verify exactly 19 tags were added
111+ expect ( addTagSpy ) . toHaveBeenCalledTimes ( 19 )
121112
122113 // Restore the spy
123114 tagsOfSpy . mockRestore ( )
@@ -133,7 +124,6 @@ describe("createApp", () => {
133124
134125 describe ( "when isPullRequest is true" , ( ) => {
135126 beforeEach ( ( ) => {
136- process . env . CDK_CONFIG_stackName = "pr-stack"
137127 process . env . CDK_CONFIG_versionNumber = "0.0.1-pr"
138128 process . env . CDK_CONFIG_commitId = "pr123"
139129 process . env . CDK_CONFIG_isPullRequest = "true"
@@ -143,19 +133,12 @@ describe("createApp", () => {
143133 test ( "correctly modifies props" , ( ) => {
144134 const { props} = createApp ( buildParams ( ) )
145135
146- expect ( props . stackName ) . toBe ( "pr-stack" )
147136 expect ( props . version ) . toBe ( "0.0.1-pr" )
148137 expect ( props . commitId ) . toBe ( "pr123" )
149138 expect ( props . isPullRequest ) . toBe ( true )
150139 expect ( props . environment ) . toBe ( "test-environment" )
151140 } )
152141
153- test ( "creates stateful App with unmodified stackName" , ( ) => {
154- const { props} = createApp ( buildParams ( { isStateless : false } ) )
155-
156- expect ( props . stackName ) . toBe ( "pr-stack" )
157- } )
158-
159142 test ( "modifies drift detection group with -pull-request suffix" , ( ) => {
160143 // Spy on Tags.of(app).add to verify tag calls
161144 const addTagSpy = vi . fn ( )
@@ -174,19 +157,8 @@ describe("createApp", () => {
174157 } )
175158
176159 describe ( "when environment variables are missing" , ( ) => {
177- test ( "throws error when stackName is not set" , ( ) => {
178- process . env . CDK_CONFIG_versionNumber = "1.0.0"
179- process . env . CDK_CONFIG_commitId = "abc123"
180- process . env . CDK_CONFIG_isPullRequest = "false"
181- process . env . CDK_CONFIG_environment = "test-environment"
182-
183- expect ( ( ) => {
184- createApp ( buildParams ( ) )
185- } ) . toThrow ( "Environment variable CDK_CONFIG_stackName is not set" )
186- } )
187160
188161 test ( "throws error when versionNumber is not set" , ( ) => {
189- process . env . CDK_CONFIG_stackName = "test-stack"
190162 process . env . CDK_CONFIG_commitId = "abc123"
191163 process . env . CDK_CONFIG_isPullRequest = "false"
192164 process . env . CDK_CONFIG_environment = "test-environment"
@@ -197,7 +169,6 @@ describe("createApp", () => {
197169 } )
198170
199171 test ( "throws error when commitId is not set" , ( ) => {
200- process . env . CDK_CONFIG_stackName = "test-stack"
201172 process . env . CDK_CONFIG_versionNumber = "1.0.0"
202173 process . env . CDK_CONFIG_isPullRequest = "false"
203174 process . env . CDK_CONFIG_environment = "test-environment"
@@ -208,7 +179,6 @@ describe("createApp", () => {
208179 } )
209180
210181 test ( "throws error when isPullRequest is not set" , ( ) => {
211- process . env . CDK_CONFIG_stackName = "test-stack"
212182 process . env . CDK_CONFIG_versionNumber = "1.0.0"
213183 process . env . CDK_CONFIG_commitId = "abc123"
214184 process . env . CDK_CONFIG_environment = "test-environment"
@@ -218,7 +188,6 @@ describe("createApp", () => {
218188 } )
219189
220190 test ( "throws error when environment is not set" , ( ) => {
221- process . env . CDK_CONFIG_stackName = "test-stack"
222191 process . env . CDK_CONFIG_versionNumber = "1.0.0"
223192 process . env . CDK_CONFIG_commitId = "abc123"
224193 process . env . CDK_CONFIG_isPullRequest = "false"
0 commit comments