33const should = require ( "should" ) ;
44const sinon = require ( "sinon" ) ;
55const ContextReplacementPlugin = require ( "../lib/ContextReplacementPlugin" ) ;
6- const applyPluginWithOptions = require ( "./helpers/applyPluginWithOptions" ) ;
76const PluginEnvironment = require ( "./helpers/PluginEnvironment" ) ;
87
98describe ( "ContextReplacementPlugin" , ( ) => {
@@ -40,14 +39,14 @@ describe("ContextReplacementPlugin", () => {
4039 should ( instance . newContentCreateContextMap ) . be . a . Function ( ) ;
4140
4241 let x = ( nothing , obj ) => {
43- should ( obj . test ) . be . exactly ( "obj" )
42+ should ( obj . test ) . be . exactly ( "obj" ) ;
4443 } ;
4544
4645 let spy = sinon . spy ( x ) ;
4746
4847 instance . newContentCreateContextMap ( undefined , spy ) ;
4948
50- should ( spy . called ) . be . exactly ( true )
49+ should ( spy . called ) . be . exactly ( true ) ;
5150
5251 } ) ;
5352
@@ -68,10 +67,10 @@ describe("ContextReplacementPlugin", () => {
6867 let obj = buildPluginWithParams ( / s e l e c t o r / , "./folder" , true , / f i l t e r / ) ;
6968
7069 let x = ( nothing , result ) => {
71- should ( result . request ) . be . exactly ( ' ./folder' )
72- should ( result . dependencies [ 0 ] . critical ) . be . exactly ( false )
73- should ( result . recursive ) . be . exactly ( true )
74- should ( result . regExp instanceof RegExp ) . be . exactly ( true )
70+ should ( result . request ) . be . exactly ( " ./folder" ) ;
71+ should ( result . dependencies [ 0 ] . critical ) . be . exactly ( false ) ;
72+ should ( result . recursive ) . be . exactly ( true ) ;
73+ should ( result . regExp instanceof RegExp ) . be . exactly ( true ) ;
7574 } ;
7675
7776 let spy = sinon . spy ( x ) ;
@@ -81,24 +80,24 @@ describe("ContextReplacementPlugin", () => {
8180 dependencies : [ {
8281 critical : true
8382 } ]
84- } , spy )
83+ } , spy ) ;
8584
86- should ( spy . called ) . be . exactly ( true )
85+ should ( spy . called ) . be . exactly ( true ) ;
8786 } ) ;
8887
8988 it ( "default call with newContentCallback as a function" , ( ) => {
9089 let obj = buildPluginWithParams ( / s e l e c t o r / , ( result ) => {
91- should ( result . request ) . be . exactly ( ' selector' )
92- should ( result . dependencies [ 0 ] . critical ) . be . exactly ( false )
93- should ( result . recursive ) . be . exactly ( undefined )
94- should ( result . regExp ) . be . exactly ( undefined )
90+ should ( result . request ) . be . exactly ( " selector" ) ;
91+ should ( result . dependencies [ 0 ] . critical ) . be . exactly ( false ) ;
92+ should ( result . recursive ) . be . exactly ( undefined ) ;
93+ should ( result . regExp ) . be . exactly ( undefined ) ;
9594 } , true , / f i l t e r / ) ;
9695
9796 let x = ( nothing , result ) => {
98- should ( result . request ) . be . exactly ( ' selector' )
99- should ( result . dependencies [ 0 ] . critical ) . be . exactly ( false )
100- should ( result . recursive ) . be . exactly ( undefined )
101- should ( result . regExp ) . be . exactly ( undefined )
97+ should ( result . request ) . be . exactly ( " selector" ) ;
98+ should ( result . dependencies [ 0 ] . critical ) . be . exactly ( false ) ;
99+ should ( result . recursive ) . be . exactly ( undefined ) ;
100+ should ( result . regExp ) . be . exactly ( undefined ) ;
102101 } ;
103102
104103 let spy = sinon . spy ( x ) ;
@@ -108,9 +107,9 @@ describe("ContextReplacementPlugin", () => {
108107 dependencies : [ {
109108 critical : false
110109 } ]
111- } , spy )
110+ } , spy ) ;
112111
113- should ( spy . called ) . be . exactly ( true )
112+ should ( spy . called ) . be . exactly ( true ) ;
114113 } ) ;
115114
116115 it ( "call when result is false" , ( ) => {
@@ -124,7 +123,7 @@ describe("ContextReplacementPlugin", () => {
124123
125124 obj . beforeResolve . handler ( false , spy ) ;
126125
127- should ( spy . called ) . be . exactly ( true )
126+ should ( spy . called ) . be . exactly ( true ) ;
128127 } ) ;
129128 } ) ;
130129
@@ -133,8 +132,8 @@ describe("ContextReplacementPlugin", () => {
133132 let obj = buildPluginWithParams ( / s e l e c t o r / , "./folder" , true , / f i l t e r / ) ;
134133
135134 let x = ( nothing , result ) => {
136- result . resource . should . containEql ( ' selector' )
137- result . resource . should . containEql ( ' folder' )
135+ result . resource . should . containEql ( " selector" ) ;
136+ result . resource . should . containEql ( " folder" ) ;
138137 } ;
139138
140139 let spy = sinon . spy ( x ) ;
@@ -146,14 +145,14 @@ describe("ContextReplacementPlugin", () => {
146145 } ]
147146 } , spy ) ;
148147
149- should ( spy . called ) . be . exactly ( true )
148+ should ( spy . called ) . be . exactly ( true ) ;
150149 } ) ;
151150
152151 it ( "default call where regex is incorrect" , ( ) => {
153152 let obj = buildPluginWithParams ( / s e l e c t o r / , "./folder" , true , / f i l t e r / ) ;
154153
155154 let x = ( nothing , result ) => {
156- result . resource . should . containEql ( ' importwontwork' )
155+ result . resource . should . containEql ( " importwontwork" ) ;
157156 } ;
158157
159158 let spy = sinon . spy ( x ) ;
@@ -165,7 +164,7 @@ describe("ContextReplacementPlugin", () => {
165164 } ]
166165 } , spy ) ;
167166
168- should ( spy . called ) . be . exactly ( true )
167+ should ( spy . called ) . be . exactly ( true ) ;
169168 } ) ;
170169
171170 it ( "default call where regex is correct" , ( ) => {
@@ -174,7 +173,7 @@ describe("ContextReplacementPlugin", () => {
174173 } , true , / f i l t e r / ) ;
175174
176175 let x = ( nothing , result ) => {
177- result . resource . should . equal ( ' selector' )
176+ result . resource . should . equal ( " selector" ) ;
178177 } ;
179178
180179 let spy = sinon . spy ( x ) ;
@@ -186,17 +185,17 @@ describe("ContextReplacementPlugin", () => {
186185 } ]
187186 } , spy ) ;
188187
189- should ( spy . called ) . be . exactly ( true )
188+ should ( spy . called ) . be . exactly ( true ) ;
190189 } ) ;
191190
192191 it ( "default call where regex is correct and using function as newContent Resource" , ( ) => {
193192 let obj = buildPluginWithParams ( / s e l e c t o r / , ( result ) => {
194- result . resource = "imadifferentselector"
193+ result . resource = "imadifferentselector" ;
195194 } , true , / f i l t e r / ) ;
196195
197196 let x = ( nothing , result ) => {
198- result . resource . should . containEql ( ' selector' )
199- result . resource . should . containEql ( ' imadifferentselector' )
197+ result . resource . should . containEql ( " selector" ) ;
198+ result . resource . should . containEql ( " imadifferentselector" ) ;
200199 } ;
201200
202201 let spy = sinon . spy ( x ) ;
@@ -208,10 +207,10 @@ describe("ContextReplacementPlugin", () => {
208207 } ]
209208 } , spy ) ;
210209
211- should ( spy . called ) . be . exactly ( true )
210+ should ( spy . called ) . be . exactly ( true ) ;
212211 } ) ;
213212
214- } )
213+ } ) ;
215214
216215 } ) ;
217216} ) ;
@@ -223,7 +222,7 @@ let buildPluginWithParams = (resourceRegExp, newContentResource, newContentRecur
223222 instance . apply ( pluginEnvironment . getEnvironmentStub ( ) ) ;
224223
225224 let contextModuleFactory = pluginEnvironment . getEventBindings ( ) [ 0 ] ;
226- pluginEnvironment . getEventBindings ( ) . length . should . be . exactly ( 1 )
225+ pluginEnvironment . getEventBindings ( ) . length . should . be . exactly ( 1 ) ;
227226
228227 let contextModuleFactoryPluginEnv = new PluginEnvironment ( ) ;
229228
@@ -239,5 +238,5 @@ let buildPluginWithParams = (resourceRegExp, newContentResource, newContentRecur
239238 contextModuleFactory,
240239 beforeResolve,
241240 afterResolve
242- }
241+ } ;
243242} ;
0 commit comments