@@ -234,17 +234,32 @@ function getTemplate () {
234
234
lab . experiment ( 'when template plugin is set' , function ( ) {
235
235
lab . experiment ( 'as sql file loader' , function ( ) {
236
236
const name = 'test' ;
237
- const plugins = Plugins . createSinglePlugin (
238
- `template:overwrite:provider:${ name } ` ,
239
- opts => {
240
- return `test all variables` ;
241
- }
242
- ) ;
243
- const migration = new Template ( fileName , dirName , date , name , plugins ) ;
244
237
245
238
lab . test ( 'should return sql file loader template' , ( ) => {
246
- const actual = migration . getTemplate ( ) ;
247
- Code . expect ( actual ) . to . equal ( `test all variables` ) ;
239
+ const plugins = Plugins . createSinglePlugin (
240
+ `template:overwrite:provider:${ name } ` ,
241
+ opts => {
242
+ return `test all variables` ;
243
+ }
244
+ ) ;
245
+ const migration = new Template ( fileName , dirName , date , name , plugins ) ;
246
+
247
+ Code . expect ( migration . getTemplate ( ) ) . to . equal ( `test all variables` ) ;
248
+ } ) ;
249
+
250
+ lab . test ( 'should throw if plugin fails' , ( ) => {
251
+ const plugins = Plugins . createSinglePlugin (
252
+ `template:overwrite:provider:${ name } ` ,
253
+ opts => {
254
+ throw new Error ( 'test' ) ;
255
+ }
256
+ ) ;
257
+ const migration = new Template ( fileName , dirName , date , name , plugins ) ;
258
+
259
+ Code . expect ( migration . getTemplate . bind ( migration ) ) . to . throw (
260
+ Error ,
261
+ 'test'
262
+ ) ;
248
263
} ) ;
249
264
} ) ;
250
265
@@ -263,6 +278,23 @@ function getTemplate () {
263
278
} ) ;
264
279
} ) ;
265
280
281
+ lab . experiment ( 'as sql default ignore on init template' , function ( ) {
282
+ const migration = new Template (
283
+ fileName ,
284
+ dirName ,
285
+ date ,
286
+ Template . TemplateType . SQL_FILE_LOADER_IGNORE_ON_INIT ,
287
+ internals
288
+ ) ;
289
+
290
+ lab . test ( 'should return sql ignore on init template' , ( ) => {
291
+ const actual = migration . getTemplate ( ) ;
292
+ Code . expect ( actual ) . to . equal (
293
+ migration . sqlFileLoaderIgnoreOnInitTemplate ( )
294
+ ) ;
295
+ } ) ;
296
+ } ) ;
297
+
266
298
lab . experiment ( 'as default coffee' , function ( ) {
267
299
const migration = new Template (
268
300
fileName ,
0 commit comments