@@ -43,10 +43,12 @@ describe('sketch', () => {
4343    ( 
4444      [ 
4545        [ 'sketch' ,  true ] , 
46-         [ 'no-dashes' ,  false ] , 
47-         [ 'no-dots' ,  false ] , 
46+         [ 'can-contain-dashes' ,  true ] , 
47+         [ 'can.contain.dots' ,  true ] , 
48+         [ '-cannot-start-with-dash' ,  false ] , 
49+         [ '.cannot.start.with.dash' ,  false ] , 
50+         [ '_cannot_start_with_underscore' ,  false ] , 
4851        [ 'No Spaces' ,  false ] , 
49-         [ '_canStartWithUnderscore' ,  true ] , 
5052        [ 'Invalid+Char.ino' ,  false ] , 
5153        [ '' ,  false ] , 
5254        [ '/' ,  false ] , 
@@ -79,6 +81,7 @@ describe('sketch', () => {
7981        '012345678901234567890123456789012345678901234567890123456789012' , 
8082      ] , 
8183      [ 'foo bar' ,  'foo_bar' ] , 
84+       [ '_foobar' ,  '0foobar' ] , 
8285      [ 'vAlid' ,  'vAlid' ] , 
8386    ] . map ( ( [ input ,  expected ] )  => 
8487      toMapIt ( input ,  expected ,  Sketch . toValidSketchFolderName ) 
@@ -102,6 +105,8 @@ describe('sketch', () => {
102105        '0123456789012345678901234567890123456789012'  +  epochSuffix , 
103106      ] , 
104107      [ 'foo bar' ,  'foo_bar'  +  epochSuffix ] , 
108+       [ '.foobar' ,  '0foobar'  +  epochSuffix ] , 
109+       [ '-fooBar' ,  '0fooBar'  +  epochSuffix ] , 
105110      [ 'vAlid' ,  'vAlid'  +  epochSuffix ] , 
106111    ] . map ( ( [ input ,  expected ] )  => 
107112      toMapIt ( input ,  expected ,  ( input : string )  => 
@@ -113,15 +118,25 @@ describe('sketch', () => {
113118  describe ( 'toValidCloudSketchFolderName' ,  ( )  =>  { 
114119    [ 
115120      [ 'sketch' ,  'sketch' ] , 
116-       [ 'can-contain-slash-and-dot.ino' ,  'can_contain_slash_and_dot_ino' ] , 
121+       [ 
122+         'slash-and-dot-is-ok+but+no+plus.ino' , 
123+         'slash-and-dot-is-ok_but_no_plus.ino' , 
124+       ] , 
117125      [ 'regex++' ,  'regex__' ] , 
118-       [ 'dots...' ,  'dots___' ] , 
126+       [ 'dots...' ,  'dots...' ] , 
127+       [ '.dots...' ,  '0dots...' ] , 
128+       [ '-dashes---' ,  '0dashes---' ] , 
129+       [ '_underscore___' ,  '0underscore___' ] , 
119130      [ 'No Spaces' ,  'No_Spaces' ] , 
120-       [ '_startsWithUnderscore' ,  '_startsWithUnderscore ' ] , 
121-       [ 'Invalid+Char.ino' ,  'Invalid_Char_ino ' ] , 
131+       [ '_startsWithUnderscore' ,  '0startsWithUnderscore ' ] , 
132+       [ 'Invalid+Char.ino' ,  'Invalid_Char.ino ' ] , 
122133      [ '' ,  'sketch' ] , 
123-       [ '/' ,  '_' ] , 
124-       [ '//trash/' ,  '__trash_' ] , 
134+       [ '/' ,  '0' ] , 
135+       [ 
136+         '//////////////////////////////////////-/' , 
137+         '0___________________________________' , 
138+       ] , 
139+       [ '//trash/' ,  '0_trash_' ] , 
125140      [ 
126141        '63Length_012345678901234567890123456789012345678901234567890123' , 
127142        '63Length_012345678901234567890123456' , 
@@ -140,6 +155,15 @@ function toMapIt(
140155) : Mocha . Test  { 
141156  return  it ( `should map the '${ input }  ' ${  
142157    cloud  ? 'cloud '  : ''  
143-   }  sketch folder name to '${ expected }  '`,  ( )  => 
144-     expect ( testMe ( input ) ) . to . be . equal ( expected ) ) ; 
158+   }  sketch folder name to '${ expected }  '`,  ( )  =>  { 
159+     const  actual  =  testMe ( input ) ; 
160+     expect ( actual ) . to . be . equal ( expected ) ; 
161+     const  errorMessage  =  Sketch . validateSketchFolderName ( actual ) ; 
162+     try  { 
163+       expect ( errorMessage ) . to . be . undefined ; 
164+     }  catch  ( err )  { 
165+       console . log ( 'HELLO' ,  actual ,  errorMessage ) ; 
166+       throw  err ; 
167+     } 
168+   } ) ; 
145169} 
0 commit comments