File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed
Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -30,18 +30,18 @@ await describe('windows-unc-path-connect', async () => {
3030} ) ;
3131await describe ( 'windows-unc-path-connect/validators' , async ( ) => {
3232 const goodUncPaths = [ '\\\\192.168.1.1\\folder' ] ;
33+ const badUncPaths = [
34+ '192.168.1.1' ,
35+ '\\192.168.1.1' ,
36+ '\\\\192.168.1.1\\folder" /delete'
37+ ] ;
3338 await describe ( 'uncPathIsSafe()' , async ( ) => {
3439 await it ( 'Returns "true" for good UNC paths' , ( ) => {
3540 for ( const goodUncPath of goodUncPaths ) {
3641 assert . strictEqual ( uncPathIsSafe ( goodUncPath ) , true ) ;
3742 }
3843 } ) ;
3944 await it ( 'Returns "false" for bad UNC paths' , ( ) => {
40- const badUncPaths = [
41- '192.168.1.1' ,
42- '\\192.168.1.1' ,
43- '\\\\192.168.1.1\\folder" /delete'
44- ] ;
4545 for ( const badUncPath of badUncPaths ) {
4646 assert . strictEqual ( uncPathIsSafe ( badUncPath ) , false ) ;
4747 assert . strictEqual ( uncPathOptionsAreSafe ( {
Original file line number Diff line number Diff line change @@ -52,6 +52,13 @@ await describe('windows-unc-path-connect', async () => {
5252await describe ( 'windows-unc-path-connect/validators' , async ( ) => {
5353 const goodUncPaths : UncPath [ ] = [ '\\\\192.168.1.1\\folder' ]
5454
55+ const badUncPaths = [
56+ // eslint-disable-next-line sonarjs/no-hardcoded-ip
57+ '192.168.1.1' , // missing slashes
58+ '\\192.168.1.1' , // missing double slash beginning
59+ '\\\\192.168.1.1\\folder" /delete' // includes double quote
60+ ]
61+
5562 await describe ( 'uncPathIsSafe()' , async ( ) => {
5663 await it ( 'Returns "true" for good UNC paths' , ( ) => {
5764 for ( const goodUncPath of goodUncPaths ) {
@@ -60,15 +67,10 @@ await describe('windows-unc-path-connect/validators', async () => {
6067 } )
6168
6269 await it ( 'Returns "false" for bad UNC paths' , ( ) => {
63- const badUncPaths = [
64- // eslint-disable-next-line sonarjs/no-hardcoded-ip
65- '192.168.1.1' , // missing slashes
66- '\\192.168.1.1' , // missing double slash beginning
67- '\\\\192.168.1.1\\folder" /delete' // includes double quote
68- ]
6970
7071 for ( const badUncPath of badUncPaths ) {
7172 assert . strictEqual ( uncPathIsSafe ( badUncPath ) , false )
73+
7274 assert . strictEqual (
7375 uncPathOptionsAreSafe ( {
7476 uncPath : badUncPath
You can’t perform that action at this time.
0 commit comments