@@ -64,27 +64,6 @@ describe('Feathers application', () => {
6464 } ) ;
6565 } ) ;
6666
67- it ( 'providers are getting called with a service' , ( ) => {
68- const app = feathers ( ) ;
69- let providerRan = false ;
70-
71- app . providers . push ( function ( service , location , options ) {
72- assert . ok ( service . dummy ) ;
73- assert . equal ( location , 'dummy' ) ;
74- assert . deepEqual ( options , { } ) ;
75- providerRan = true ;
76- } ) ;
77-
78- app . use ( '/dummy' , {
79- dummy : true ,
80- get ( ) { }
81- } ) ;
82-
83- assert . ok ( providerRan ) ;
84-
85- app . setup ( ) ;
86- } ) ;
87-
8867 describe ( 'Services' , ( ) => {
8968 it ( 'calling .use with a non service object throws' , ( ) => {
9069 const app = feathers ( ) ;
@@ -291,4 +270,50 @@ describe('Feathers application', () => {
291270 assert . ok ( _setup ) ;
292271 } ) ;
293272 } ) ;
273+
274+ describe ( 'providers' , ( ) => {
275+ it ( 'are getting called with a service' , ( ) => {
276+ const app = feathers ( ) ;
277+ let providerRan = false ;
278+
279+ app . providers . push ( function ( service , location , options ) {
280+ assert . ok ( service . dummy ) ;
281+ assert . equal ( location , 'dummy' ) ;
282+ assert . deepEqual ( options , { } ) ;
283+ providerRan = true ;
284+ } ) ;
285+
286+ app . use ( '/dummy' , {
287+ dummy : true ,
288+ get ( ) { }
289+ } ) ;
290+
291+ assert . ok ( providerRan ) ;
292+
293+ app . setup ( ) ;
294+ } ) ;
295+
296+ it ( 'are getting called with a service and options' , ( ) => {
297+ const app = feathers ( ) ;
298+ const opts = { test : true } ;
299+
300+ let providerRan = false ;
301+
302+ app . providers . push ( function ( service , location , options ) {
303+ assert . ok ( service . dummy ) ;
304+ assert . equal ( location , 'dummy' ) ;
305+ assert . deepEqual ( options , opts ) ;
306+ providerRan = true ;
307+ } ) ;
308+
309+ app . use ( '/dummy' , {
310+ dummy : true ,
311+ get ( ) { }
312+ } , opts ) ;
313+
314+ assert . ok ( providerRan ) ;
315+
316+ app . setup ( ) ;
317+ } ) ;
318+ } ) ;
294319} ) ;
0 commit comments