@@ -32,3 +32,24 @@ Object.keys( pipelines ).forEach( dirname => {
3232 } ) ;
3333 } ) ;
3434} )
35+
36+ // special case for testing multiple sources
37+ describe ( 'multiple sources' , ( ) => {
38+ let testDir = path . join ( __dirname , 'test-cases' )
39+ let testCase = 'multiple-sources' ;
40+ let dirname = 'test-cases' ;
41+ if ( fs . existsSync ( path . join ( testDir , testCase , "source1.css" ) ) ) {
42+ it ( "should " + testCase . replace ( / - / g, " " ) , done => {
43+ let expected = normalize ( fs . readFileSync ( path . join ( testDir , testCase , "expected.css" ) , "utf-8" ) )
44+ let loader = new FileSystemLoader ( testDir , pipelines [ dirname ] )
45+ let expectedTokens = JSON . parse ( fs . readFileSync ( path . join ( testDir , testCase , "expected.json" ) , "utf-8" ) )
46+ loader . fetch ( `${ testCase } /source1.css` , "/" ) . then ( tokens1 => {
47+ loader . fetch ( `${ testCase } /source2.css` , "/" ) . then ( tokens2 => {
48+ assert . equal ( loader . finalSource , expected )
49+ const tokens = Object . assign ( { } , tokens1 , tokens2 ) ;
50+ assert . equal ( JSON . stringify ( tokens ) , JSON . stringify ( expectedTokens ) )
51+ } ) . then ( done , done )
52+ } )
53+ } ) ;
54+ }
55+ } ) ;
0 commit comments