@@ -110,16 +110,6 @@ describe('LifeCycle', () => {
110110 const instance = new MyObserver ( ) ;
111111 expect ( isLifeCycleObserver ( instance ) ) . to . be . true ( ) ;
112112 } ) ;
113-
114- it ( 'returns false for null' , ( ) => {
115- // eslint-disable-next-line @typescript-eslint/no-explicit-any
116- expect ( isLifeCycleObserver ( null as any ) ) . to . be . false ( ) ;
117- } ) ;
118-
119- it ( 'returns false for undefined' , ( ) => {
120- // eslint-disable-next-line @typescript-eslint/no-explicit-any
121- expect ( isLifeCycleObserver ( undefined as any ) ) . to . be . false ( ) ;
122- } ) ;
123113 } ) ;
124114
125115 describe ( 'isLifeCycleObserverClass' , ( ) => {
@@ -181,13 +171,6 @@ describe('LifeCycle', () => {
181171 class DerivedObserver extends BaseObserver { }
182172 expect ( isLifeCycleObserverClass ( DerivedObserver ) ) . to . be . true ( ) ;
183173 } ) ;
184-
185- it ( 'returns false for class with non-prototype' , ( ) => {
186- // eslint-disable-next-line @typescript-eslint/no-explicit-any
187- const NotAClass = function ( ) { } as any ;
188- NotAClass . prototype = undefined ;
189- expect ( isLifeCycleObserverClass ( NotAClass ) ) . to . be . false ( ) ;
190- } ) ;
191174 } ) ;
192175
193176 describe ( 'asLifeCycleObserver' , ( ) => {
@@ -277,78 +260,6 @@ describe('LifeCycle', () => {
277260 } ) ;
278261
279262 describe ( '@lifeCycleObserver decorator' , ( ) => {
280- it ( 'decorates class as life cycle observer' , ( ) => {
281- @lifeCycleObserver ( )
282- class MyObserver implements LifeCycleObserver {
283- async start ( ) { }
284- }
285-
286- const ctx = new Context ( ) ;
287- ctx . bind ( 'my.observer' ) . toClass ( MyObserver ) ;
288- const binding = ctx . getBinding ( 'my.observer' ) ;
289- expect ( Array . from ( binding . tagNames ) ) . to . containEql (
290- CoreTags . LIFE_CYCLE_OBSERVER ,
291- ) ;
292- } ) ;
293-
294- it ( 'decorates class with group name' , ( ) => {
295- @lifeCycleObserver ( 'my-group' )
296- class MyObserver implements LifeCycleObserver {
297- async start ( ) { }
298- }
299-
300- const ctx = new Context ( ) ;
301- ctx . bind ( 'my.observer' ) . toClass ( MyObserver ) ;
302- const binding = ctx . getBinding ( 'my.observer' ) ;
303- expect ( binding . tagMap [ CoreTags . LIFE_CYCLE_OBSERVER_GROUP ] ) . to . equal (
304- 'my-group' ,
305- ) ;
306- } ) ;
307-
308- it ( 'decorates class with empty group name' , ( ) => {
309- @lifeCycleObserver ( '' )
310- class MyObserver implements LifeCycleObserver {
311- async start ( ) { }
312- }
313-
314- const ctx = new Context ( ) ;
315- ctx . bind ( 'my.observer' ) . toClass ( MyObserver ) ;
316- const binding = ctx . getBinding ( 'my.observer' ) ;
317- expect ( binding . tagMap [ CoreTags . LIFE_CYCLE_OBSERVER_GROUP ] ) . to . equal ( '' ) ;
318- } ) ;
319-
320- it ( 'decorates class with additional binding specs' , ( ) => {
321- @lifeCycleObserver ( 'my-group' , { scope : BindingScope . SINGLETON } )
322- class MyObserver implements LifeCycleObserver {
323- async start ( ) { }
324- }
325-
326- const ctx = new Context ( ) ;
327- ctx . bind ( 'my.observer' ) . toClass ( MyObserver ) ;
328- const binding = ctx . getBinding ( 'my.observer' ) ;
329- expect ( binding . scope ) . to . equal ( BindingScope . SINGLETON ) ;
330- expect ( binding . tagMap [ CoreTags . LIFE_CYCLE_OBSERVER_GROUP ] ) . to . equal (
331- 'my-group' ,
332- ) ;
333- } ) ;
334-
335- it ( 'decorates class with multiple binding specs' , ( ) => {
336- @lifeCycleObserver (
337- 'my-group' ,
338- { scope : BindingScope . SINGLETON } ,
339- { tags : [ 'custom-tag' ] } ,
340- )
341- class MyObserver implements LifeCycleObserver {
342- async start ( ) { }
343- }
344-
345- const ctx = new Context ( ) ;
346- ctx . bind ( 'my.observer' ) . toClass ( MyObserver ) ;
347- const binding = ctx . getBinding ( 'my.observer' ) ;
348- expect ( binding . scope ) . to . equal ( BindingScope . SINGLETON ) ;
349- expect ( Array . from ( binding . tagNames ) ) . to . containEql ( 'custom-tag' ) ;
350- } ) ;
351-
352263 it ( 'works with @injectable decorator' , ( ) => {
353264 @lifeCycleObserver ( 'my-group' )
354265 @injectable ( { scope : BindingScope . SINGLETON } )
0 commit comments