@@ -43,10 +43,12 @@ describe('sketch', () => {
43
43
(
44
44
[
45
45
[ '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 ] ,
48
51
[ 'No Spaces' , false ] ,
49
- [ '_canStartWithUnderscore' , true ] ,
50
52
[ 'Invalid+Char.ino' , false ] ,
51
53
[ '' , false ] ,
52
54
[ '/' , false ] ,
@@ -79,6 +81,7 @@ describe('sketch', () => {
79
81
'012345678901234567890123456789012345678901234567890123456789012' ,
80
82
] ,
81
83
[ 'foo bar' , 'foo_bar' ] ,
84
+ [ '_foobar' , '0foobar' ] ,
82
85
[ 'vAlid' , 'vAlid' ] ,
83
86
] . map ( ( [ input , expected ] ) =>
84
87
toMapIt ( input , expected , Sketch . toValidSketchFolderName )
@@ -102,6 +105,8 @@ describe('sketch', () => {
102
105
'0123456789012345678901234567890123456789012' + epochSuffix ,
103
106
] ,
104
107
[ 'foo bar' , 'foo_bar' + epochSuffix ] ,
108
+ [ '.foobar' , '0foobar' + epochSuffix ] ,
109
+ [ '-fooBar' , '0fooBar' + epochSuffix ] ,
105
110
[ 'vAlid' , 'vAlid' + epochSuffix ] ,
106
111
] . map ( ( [ input , expected ] ) =>
107
112
toMapIt ( input , expected , ( input : string ) =>
@@ -113,15 +118,25 @@ describe('sketch', () => {
113
118
describe ( 'toValidCloudSketchFolderName' , ( ) => {
114
119
[
115
120
[ '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
+ ] ,
117
125
[ 'regex++' , 'regex__' ] ,
118
- [ 'dots...' , 'dots___' ] ,
126
+ [ 'dots...' , 'dots...' ] ,
127
+ [ '.dots...' , '0dots...' ] ,
128
+ [ '-dashes---' , '0dashes---' ] ,
129
+ [ '_underscore___' , '0underscore___' ] ,
119
130
[ 'No Spaces' , 'No_Spaces' ] ,
120
- [ '_startsWithUnderscore' , '_startsWithUnderscore ' ] ,
121
- [ 'Invalid+Char.ino' , 'Invalid_Char_ino ' ] ,
131
+ [ '_startsWithUnderscore' , '0startsWithUnderscore ' ] ,
132
+ [ 'Invalid+Char.ino' , 'Invalid_Char.ino ' ] ,
122
133
[ '' , 'sketch' ] ,
123
- [ '/' , '_' ] ,
124
- [ '//trash/' , '__trash_' ] ,
134
+ [ '/' , '0' ] ,
135
+ [
136
+ '//////////////////////////////////////-/' ,
137
+ '0___________________________________' ,
138
+ ] ,
139
+ [ '//trash/' , '0_trash_' ] ,
125
140
[
126
141
'63Length_012345678901234567890123456789012345678901234567890123' ,
127
142
'63Length_012345678901234567890123456' ,
@@ -140,6 +155,15 @@ function toMapIt(
140
155
) : Mocha . Test {
141
156
return it ( `should map the '${ input } ' ${
142
157
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
+ } ) ;
145
169
}
0 commit comments