@@ -67,28 +67,31 @@ describe('Global Utils', () => {
6767 } ) ;
6868
6969 it ( 'should disable both if one is disabled' , ( ) => {
70- const original = api1 . context [ '_getContextManager' ] ( ) ;
71-
72- api1 . context . setGlobalContextManager ( new NoopContextManager ( ) ) ;
70+ const manager = new NoopContextManager ( ) ;
71+ api1 . context . setGlobalContextManager ( manager ) ;
7372
74- assert . notStrictEqual ( original , api1 . context [ '_getContextManager' ] ( ) ) ;
73+ assert . strictEqual ( manager , api1 . context [ '_getContextManager' ] ( ) ) ;
7574 api2 . context . disable ( ) ;
76- assert . strictEqual ( original , api1 . context [ '_getContextManager' ] ( ) ) ;
75+ assert . notStrictEqual ( manager , api1 . context [ '_getContextManager' ] ( ) ) ;
7776 } ) ;
7877
7978 it ( 'should return the module NoOp implementation if the version is a mismatch' , ( ) => {
80- const original = api1 . context [ '_getContextManager' ] ( ) ;
8179 const newContextManager = new NoopContextManager ( ) ;
8280 api1 . context . setGlobalContextManager ( newContextManager ) ;
8381
82+ // ensure new context manager is returned
8483 assert . strictEqual ( api1 . context [ '_getContextManager' ] ( ) , newContextManager ) ;
8584
8685 const globalInstance = getGlobal ( 'context' ) ;
8786 assert . ok ( globalInstance ) ;
8887 // @ts -expect-error we are modifying internals for testing purposes here
8988 _globalThis [ Symbol . for ( GLOBAL_API_SYMBOL_KEY ) ] . version = '0.0.1' ;
9089
91- assert . strictEqual ( api1 . context [ '_getContextManager' ] ( ) , original ) ;
90+ // ensure new context manager is not returned because version above is incompatible
91+ assert . notStrictEqual (
92+ api1 . context [ '_getContextManager' ] ( ) ,
93+ newContextManager
94+ ) ;
9295 } ) ;
9396
9497 it ( 'should log an error if there is a duplicate registration' , ( ) => {
0 commit comments