Skip to content

Commit a57bd91

Browse files
committed
Test glob with special characters
Signed-off-by: Kyle Harding <[email protected]>
1 parent 5469c90 commit a57bd91

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

test/unit/lib/glob.test.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,29 @@ describe('glob test', function () {
7474
str = 'java/csrf-protection-disabled'
7575
expect(str.search(pattern)>=0).toBeTruthy()
7676
})
77-
77+
78+
test('Test Glob with special regex characters', () => {
79+
// Test for repository names with a period (.)
80+
let pattern = new Glob('.sentry')
81+
let str = '.sentry'
82+
expect(str.search(pattern)>=0).toBeTruthy()
83+
str = 'some-repo'
84+
expect(str.search(pattern)>=0).toBeFalsy()
85+
str = 'other-sentry-repo'
86+
expect(str.search(pattern)>=0).toBeFalsy()
87+
88+
// Test for other special regex characters
89+
pattern = new Glob('repo+name')
90+
str = 'repo+name'
91+
expect(str.search(pattern)>=0).toBeTruthy()
92+
str = 'reponame'
93+
expect(str.search(pattern)>=0).toBeFalsy()
94+
95+
pattern = new Glob('repo[1-3]')
96+
str = 'repo[1-3]'
97+
expect(str.search(pattern)>=0).toBeTruthy()
98+
str = 'repo1'
99+
expect(str.search(pattern)>=0).toBeFalsy()
100+
})
101+
78102
})

0 commit comments

Comments
 (0)