@@ -8,7 +8,32 @@ describe('public api', () => {
88 delete require . cache [ require . resolve ( 'awesome-theme/oceanic.css' ) ] ;
99 } ) ;
1010
11- describe ( 'preprocessCss' , ( ) => {
11+ describe ( 'preprocessCss()' , ( ) => {
12+ describe ( 'content of the file and filename are provided to the preprocessCss function' , ( ) => {
13+ let providedCSS ;
14+ let providedFilename ;
15+
16+ beforeEach ( ( ) => {
17+ const spy = ( content , filename ) => {
18+ providedCSS = content ;
19+ providedFilename = filename ;
20+ return content ;
21+ } ;
22+
23+ hook ( { preprocessCss : spy } ) ;
24+ require ( 'awesome-theme/oceanic.css' ) ;
25+ } ) ;
26+
27+ it ( 'content of file should be provided' , ( ) => {
28+ equal ( typeof providedCSS , 'string' ) ;
29+ ok ( providedCSS . length ) ;
30+ } ) ;
31+
32+ it ( 'filename should be provided' , ( ) => {
33+ equal ( providedFilename , require . resolve ( 'awesome-theme/oceanic.css' ) ) ;
34+ } ) ;
35+ } ) ;
36+
1237 describe ( 'providing empty string constantly' , ( ) => {
1338 before ( ( ) => hook ( { preprocessCss : constant ( '' ) } ) ) ;
1439
@@ -27,4 +52,29 @@ describe('public api', () => {
2752 } ) ;
2853 } ) ;
2954 } ) ;
55+
56+ describe ( 'processCss()' , ( ) => {
57+ let providedCSS ;
58+ let providedFilename ;
59+
60+ beforeEach ( ( ) => {
61+ const spy = ( content , filename ) => {
62+ providedCSS = content ;
63+ providedFilename = filename ;
64+ return content ;
65+ } ;
66+
67+ hook ( { processCss : spy } ) ;
68+ require ( 'awesome-theme/oceanic.css' ) ;
69+ } ) ;
70+
71+ it ( 'content of file should be provided' , ( ) => {
72+ equal ( typeof providedCSS , 'string' ) ;
73+ ok ( providedCSS . length ) ;
74+ } ) ;
75+
76+ it ( 'filename should be provided' , ( ) => {
77+ equal ( providedFilename , require . resolve ( 'awesome-theme/oceanic.css' ) ) ;
78+ } ) ;
79+ } ) ;
3080} ) ;
0 commit comments