File tree Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -309,7 +309,9 @@ export function createStore<T = any>({
309309 } ,
310310 } ) ;
311311 } catch ( e ) {
312- console . error ( `${ service } has unexpected errors.` ) ;
312+ console . error (
313+ `provide: '${ ServiceIdentifier . toString ( ) } ' has unexpected errors.`
314+ ) ;
313315 throw e ;
314316 }
315317 } ) ;
Original file line number Diff line number Diff line change @@ -318,3 +318,51 @@ test('Unexpected multi-inject: module with multiple module injection with same m
318318 container . get ( FooBar ) ;
319319 } ) . toThrowErrorMatchingSnapshot ( ) ;
320320} ) ;
321+
322+ test ( 'check defineProperties error' , ( ) => {
323+ const options = { foo : 'bar' } ;
324+
325+ @injectable ( )
326+ class Todos {
327+ @state
328+ list : string [ ] = [ ] ;
329+ }
330+
331+ const create = ( ) => {
332+ const ServiceIdentifiers = new Map ( ) ;
333+ const modules = [ Todos , { provide : 'options' , useValue : options } ] ;
334+ const container = createContainer ( {
335+ ServiceIdentifiers,
336+ modules,
337+ options : {
338+ defaultScope : 'Singleton' ,
339+ } ,
340+ } ) ;
341+ container . get ( Todos ) ;
342+ createStore ( {
343+ modules,
344+ container,
345+ ServiceIdentifiers,
346+ loadedModules : new Set ( ) ,
347+ load : ( ...args : any [ ] ) => {
348+ //
349+ } ,
350+ pluginHooks : {
351+ middleware : [ ] ,
352+ beforeCombineRootReducers : [ ] ,
353+ afterCombineRootReducers : [ ] ,
354+ enhancer : [ ] ,
355+ preloadedStateHandler : [ ] ,
356+ afterCreateStore : [ ] ,
357+ provider : [ ] ,
358+ } ,
359+ } ) ;
360+ } ;
361+ create ( ) ;
362+ jest . spyOn ( global . console , 'error' ) ;
363+
364+ expect ( create ) . toThrowError ( ) ;
365+ expect ( console . error ) . toBeCalledWith (
366+ "provide: 'options' has unexpected errors."
367+ ) ;
368+ } ) ;
You can’t perform that action at this time.
0 commit comments