@@ -128,6 +128,25 @@ describe('ServiceLocator', () => {
128128 serviceLocator . setEventManager ( customEventManager ) ;
129129 } ) . toThrow ( / E v e n t M a n a g e r i s a l r e a d y i n u s e / ) ;
130130 } ) ;
131+
132+ test ( 'warns about implicit configuration when configuration was not set beforehand' , ( ) => {
133+ const warningSpy = vi . fn ( ) ;
134+ serviceLocator . setLogger ( makeMockLogger ( { warning : warningSpy } ) ) ;
135+
136+ serviceLocator . getEventManager ( ) ;
137+
138+ expect ( warningSpy ) . toHaveBeenCalledWith ( expect . stringMatching ( / i m p l i c i t l y s e t c o n f i g u r a t i o n / ) ) ;
139+ } ) ;
140+
141+ test ( 'does not warn about implicit configuration when configuration was already set' , ( ) => {
142+ const warningSpy = vi . fn ( ) ;
143+ serviceLocator . setLogger ( makeMockLogger ( { warning : warningSpy } ) ) ;
144+ serviceLocator . setConfiguration ( new Configuration ( ) ) ;
145+
146+ serviceLocator . getEventManager ( ) ;
147+
148+ expect ( warningSpy ) . not . toHaveBeenCalled ( ) ;
149+ } ) ;
131150 } ) ;
132151
133152 describe ( 'StorageBackend' , ( ) => {
@@ -168,6 +187,25 @@ describe('ServiceLocator', () => {
168187 serviceLocator . setStorageBackend ( customStorageBackend ) ;
169188 } ) . toThrow ( / S t o r a g e B a c k e n d i s a l r e a d y i n u s e / ) ;
170189 } ) ;
190+
191+ test ( 'warns about implicit configuration when configuration was not set beforehand' , ( ) => {
192+ const warningSpy = vi . fn ( ) ;
193+ serviceLocator . setLogger ( makeMockLogger ( { warning : warningSpy } ) ) ;
194+
195+ serviceLocator . getStorageBackend ( ) ;
196+
197+ expect ( warningSpy ) . toHaveBeenCalledWith ( expect . stringMatching ( / i m p l i c i t l y s e t c o n f i g u r a t i o n / ) ) ;
198+ } ) ;
199+
200+ test ( 'does not warn about implicit configuration when configuration was already set' , ( ) => {
201+ const warningSpy = vi . fn ( ) ;
202+ serviceLocator . setLogger ( makeMockLogger ( { warning : warningSpy } ) ) ;
203+ serviceLocator . setConfiguration ( new Configuration ( ) ) ;
204+
205+ serviceLocator . getStorageBackend ( ) ;
206+
207+ expect ( warningSpy ) . not . toHaveBeenCalled ( ) ;
208+ } ) ;
171209 } ) ;
172210
173211 describe ( 'Logger' , ( ) => {
0 commit comments