@@ -8,7 +8,32 @@ describe('public api', () => {
8
8
delete require . cache [ require . resolve ( 'awesome-theme/oceanic.css' ) ] ;
9
9
} ) ;
10
10
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
+
12
37
describe ( 'providing empty string constantly' , ( ) => {
13
38
before ( ( ) => hook ( { preprocessCss : constant ( '' ) } ) ) ;
14
39
@@ -27,4 +52,29 @@ describe('public api', () => {
27
52
} ) ;
28
53
} ) ;
29
54
} ) ;
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
+ } ) ;
30
80
} ) ;
0 commit comments