File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff 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} )
You can’t perform that action at this time.
0 commit comments