22
33const genericNames = require ( '../index' ) ;
44const test = require ( 'tape' ) ;
5+ const path = require ( 'path' ) ;
56
67// According to the CSS spec, identifiers cannot
78// start with a digit, two hyphens, or a hyphen
@@ -12,34 +13,34 @@ const test = require('tape');
1213test ( 'identity' , t => {
1314 const generate = genericNames ( '[local]' ) ;
1415
15- t . equal ( generate ( 'foo' , '/ test/case/source.css') , 'foo' ) ;
16+ t . equal ( generate ( 'foo' , path . join ( __dirname , ' test/case/source.css') ) , 'foo' ) ;
1617 t . end ( ) ;
1718} ) ;
1819
1920test ( 'leading digit' , t => {
2021 const generate = genericNames ( '0[local]' ) ;
2122
22- t . equal ( generate ( 'foo' , '/ test/case/source.css') , '_0foo' ) ;
23+ t . equal ( generate ( 'foo' , path . join ( __dirname , ' test/case/source.css') ) , '_0foo' ) ;
2324 t . end ( ) ;
2425} ) ;
2526
2627test ( 'leading digit in the token' , t => {
2728 const generate = genericNames ( '[local]' ) ;
2829
29- t . equal ( generate ( '0foo' , '/ test/case/source.css') , '_0foo' ) ;
30+ t . equal ( generate ( '0foo' , path . join ( __dirname , ' test/case/source.css') ) , '_0foo' ) ;
3031 t . end ( ) ;
3132} ) ;
3233
3334test ( 'leading two hyphens' , t => {
3435 const generate = genericNames ( '--[local]' ) ;
3536
36- t . equal ( generate ( 'foo' , '/ test/case/source.css') , '_--foo' ) ;
37+ t . equal ( generate ( 'foo' , path . join ( __dirname , ' test/case/source.css') ) , '_--foo' ) ;
3738 t . end ( ) ;
3839} ) ;
3940
4041test ( 'leading hyphen and digit' , t => {
4142 const generate = genericNames ( '-0[local]' ) ;
4243
43- t . equal ( generate ( 'foo' , '/ test/case/source.css') , '_-0foo' ) ;
44+ t . equal ( generate ( 'foo' , path . join ( __dirname , ' test/case/source.css') ) , '_-0foo' ) ;
4445 t . end ( ) ;
4546} ) ;
0 commit comments