Skip to content

Commit dd40d47

Browse files
committed
test: update tests to handle regexp to be case insensitive
Addresses https://github.com/angular/angular-cli/security/code-scanning/94 (cherry picked from commit a09f27a)
1 parent 28f4d68 commit dd40d47

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/angular/build/src/utils/index-file/auto-csp_spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ describe('auto-csp', () => {
108108
// Head loader script is in the head.
109109
expect(result).toContain(`</script></head>`);
110110
// Only two loader scripts are created.
111-
expect(Array.from(result.matchAll(/<script>/g)).length).toEqual(2);
111+
expect(Array.from(result.matchAll(/<script>/gi)).length).toEqual(2);
112112
});
113113

114114
it('should rewrite source scripts with weird URLs', async () => {
@@ -174,7 +174,7 @@ describe('auto-csp', () => {
174174
/console.log\('bar'\);<\/script>\s*<script>\s*var scripts = \[\['.\/main3.js', '', false, false\],\['.\/main4.js', '', false, false\]\];/,
175175
);
176176
// Exactly 4 scripts should be left.
177-
expect(Array.from(result.matchAll(/<script>/g)).length).toEqual(4);
177+
expect(Array.from(result.matchAll(/<script>/gi)).length).toEqual(4);
178178
});
179179

180180
it('should write a loader script that appends to head', async () => {
@@ -200,7 +200,7 @@ describe('auto-csp', () => {
200200
// Head loader script is in the head.
201201
expect(result).toContain(`</script></head>`);
202202
// Only one loader script is created.
203-
expect(Array.from(result.matchAll(/<script>/g)).length).toEqual(1);
203+
expect(Array.from(result.matchAll(/<script>/gi)).length).toEqual(1);
204204
});
205205

206206
it('should rewrite a single inline script with CRLF', async () => {

0 commit comments

Comments
 (0)