Skip to content

Commit 93b0ba1

Browse files
author
Abdelhalim Dadouche
committed
replacing reaplce all with global regexp
1 parent ecf0181 commit 93b0ba1

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

test/codebuild-embedded-linux.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe("EmbeddedLinuxCodeBuildProjectStack", () => {
6969
Match.objectLike({
7070
CidrIp: {
7171
"Fn::ImportValue": Match.stringLikeRegexp(
72-
`${common.stackName}:ExportsOutputFnGetAtt${props.vpc.node.id.replaceAll("-", "")}*`,
72+
`${common.stackName}:ExportsOutputFnGetAtt${props.vpc.node.id.replace(/-/g, "")}*`,
7373
),
7474
},
7575
FromPort: 2049,
@@ -96,7 +96,7 @@ describe("EmbeddedLinuxCodeBuildProjectStack", () => {
9696
":",
9797
{
9898
"Fn::ImportValue": Match.stringLikeRegexp(
99-
`${common.stackName}:ExportsOutputFnGetAtt${props.ecrRepository.node.id.replaceAll("-", "")}`,
99+
`${common.stackName}:ExportsOutputFnGetAtt${props.ecrRepository.node.id.replace(/-/g, "")}`,
100100
),
101101
},
102102
],
@@ -112,7 +112,7 @@ describe("EmbeddedLinuxCodeBuildProjectStack", () => {
112112
":",
113113
{
114114
"Fn::ImportValue": Match.stringLikeRegexp(
115-
`${common.stackName}:ExportsOutputFnGetAtt${props.ecrRepository.node.id.replaceAll("-", "")}`,
115+
`${common.stackName}:ExportsOutputFnGetAtt${props.ecrRepository.node.id.replace(/-/g, "")}`,
116116
),
117117
},
118118
],
@@ -126,7 +126,7 @@ describe("EmbeddedLinuxCodeBuildProjectStack", () => {
126126
"/",
127127
{
128128
"Fn::ImportValue": Match.stringLikeRegexp(
129-
`${common.stackName}:ExportsOutputRef${props.ecrRepository.node.id.replaceAll("-", "")}`,
129+
`${common.stackName}:ExportsOutputRef${props.ecrRepository.node.id.replace(/-/g, "")}`,
130130
),
131131
},
132132
":latest",
@@ -263,7 +263,7 @@ describe("EmbeddedLinuxCodeBuildProjectStack Custom", () => {
263263
Match.objectLike({
264264
CidrIp: {
265265
"Fn::ImportValue": Match.stringLikeRegexp(
266-
`${common.stackName}:ExportsOutputFnGetAtt${props.vpc.node.id.replaceAll("-", "")}*`,
266+
`${common.stackName}:ExportsOutputFnGetAtt${props.vpc.node.id.replace(/-/g, "")}*`,
267267
),
268268
},
269269
FromPort: 2049,
@@ -290,7 +290,7 @@ describe("EmbeddedLinuxCodeBuildProjectStack Custom", () => {
290290
":",
291291
{
292292
"Fn::ImportValue": Match.stringLikeRegexp(
293-
`${common.stackName}:ExportsOutputFnGetAtt${props.ecrRepository.node.id.replaceAll("-", "")}`,
293+
`${common.stackName}:ExportsOutputFnGetAtt${props.ecrRepository.node.id.replace(/-/g, "")}`,
294294
),
295295
},
296296
],
@@ -306,7 +306,7 @@ describe("EmbeddedLinuxCodeBuildProjectStack Custom", () => {
306306
":",
307307
{
308308
"Fn::ImportValue": Match.stringLikeRegexp(
309-
`${common.stackName}:ExportsOutputFnGetAtt${props.ecrRepository.node.id.replaceAll("-", "")}`,
309+
`${common.stackName}:ExportsOutputFnGetAtt${props.ecrRepository.node.id.replace(/-/g, "")}`,
310310
),
311311
},
312312
],
@@ -320,7 +320,7 @@ describe("EmbeddedLinuxCodeBuildProjectStack Custom", () => {
320320
"/",
321321
{
322322
"Fn::ImportValue": Match.stringLikeRegexp(
323-
`${common.stackName}:ExportsOutputRef${props.ecrRepository.node.id.replaceAll("-", "")}`,
323+
`${common.stackName}:ExportsOutputRef${props.ecrRepository.node.id.replace(/-/g, "")}`,
324324
),
325325
},
326326
":latest",

test/codepipeline-embedded-linux-nag.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ function addNagSuppressions(
162162
regex: `/Resource::arn:aws:ec2:${DEFAULT_ENV.region}::snapshot/\\*$/g`,
163163
},
164164
{
165-
regex: `/Resource::<${_props.pipelineOutputBucket.node.id.replaceAll("-", "")}A5072518.Arn>/\\*$/g`,
165+
regex: `/Resource::<${_props.pipelineOutputBucket.node.id.replace(/-/g, "")}A5072518.Arn>/\\*$/g`,
166166
},
167167
{
168-
regex: `/Resource::${_stack.stackName}:ExportsOutputFnGetAtt${_props.pipelineOutputBucket.node.id.replaceAll("-", "").toLowerCase()}A5072518ArnD3542377/\\*$/g`,
168+
regex: `/Resource::${_stack.stackName}:ExportsOutputFnGetAtt${_props.pipelineOutputBucket.node.id.replace(/-/g, "").toLowerCase()}A5072518ArnD3542377/\\*$/g`,
169169
},
170170
{
171171
regex: `/Resource::test-common:ExportsOutputFnGetAtttestoutA5072518ArnD3542377/\\*$/g`,

test/codepipeline-embedded-linux.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ describe("EmbeddedLinuxCodePipelineStack", () => {
140140
":",
141141
{
142142
"Fn::ImportValue": Match.stringLikeRegexp(
143-
`${common.stackName}:ExportsOutputFnGetAtt${props.ecrRepository.node.id.replaceAll("-", "")}*`,
143+
`${common.stackName}:ExportsOutputFnGetAtt${props.ecrRepository.node.id.replace(/-/g, "")}*`,
144144
),
145145
},
146146
],
@@ -156,7 +156,7 @@ describe("EmbeddedLinuxCodePipelineStack", () => {
156156
":",
157157
{
158158
"Fn::ImportValue": Match.stringLikeRegexp(
159-
`${common.stackName}:ExportsOutputFnGetAtt${props.ecrRepository.node.id.replaceAll("-", "")}*`,
159+
`${common.stackName}:ExportsOutputFnGetAtt${props.ecrRepository.node.id.replace(/-/g, "")}*`,
160160
),
161161
},
162162
],
@@ -170,7 +170,7 @@ describe("EmbeddedLinuxCodePipelineStack", () => {
170170
"/",
171171
{
172172
"Fn::ImportValue": Match.stringLikeRegexp(
173-
`${common.stackName}:ExportsOutputRef${props.ecrRepository.node.id.replaceAll("-", "")}*`,
173+
`${common.stackName}:ExportsOutputRef${props.ecrRepository.node.id.replace(/-/g, "")}*`,
174174
),
175175
},
176176
":latest",
@@ -232,7 +232,7 @@ describe("EmbeddedLinuxCodePipelineStack", () => {
232232
Match.objectLike({
233233
CidrIp: {
234234
"Fn::ImportValue": Match.stringLikeRegexp(
235-
`${common.stackName}:ExportsOutputFnGetAtt${props.vpc.node.id.replaceAll("-", "")}*`,
235+
`${common.stackName}:ExportsOutputFnGetAtt${props.vpc.node.id.replace(/-/g, "")}*`,
236236
),
237237
},
238238
FromPort: 2049,

0 commit comments

Comments
 (0)