@@ -21,9 +21,12 @@ describe('App React CRUD Integration Tests', () => {
2121 kernel = new ObjectKernel ( ) ;
2222 const driver = new InMemoryDriver ( ) ;
2323
24+ // Handle CommonJS/ESM interop for config loading
25+ const appConfig = ( todoConfig as any ) . default || todoConfig ;
26+
2427 await kernel . use ( new ObjectQLPlugin ( ) ) ;
2528 await kernel . use ( new DriverPlugin ( driver , 'memory' ) ) ;
26- await kernel . use ( new AppPlugin ( todoConfig ) ) ;
29+ await kernel . use ( new AppPlugin ( appConfig ) ) ;
2730
2831 // 2. Initialize MSW Plugin to generate handlers
2932 const mswPlugin = new MSWPlugin ( {
@@ -83,6 +86,7 @@ describe('App React CRUD Integration Tests', () => {
8386 }
8487
8588 // HttpDispatcher expects { data, count } for query/list
89+ console . log ( `[BrokerShim-Test] find/query(${ params . object } ) -> count: ${ all . length } ` ) ;
8690 return { data : all , count : all . length } ;
8791 }
8892 }
@@ -96,9 +100,13 @@ describe('App React CRUD Integration Tests', () => {
96100 objs = SchemaRegistry . getAllObjects ( ) ;
97101 }
98102
99- console . log ( 'DEBUG: metadata.objects returned count:' , objs . length , 'names:' , objs . map ( ( o : any ) => o . name ) ) ;
103+ // console.log('DEBUG: metadata.objects returned count:', objs.length, 'names:', objs.map((o: any) => o.name));
100104 return objs ;
101105 }
106+ if ( method === 'getObject' ) {
107+ // Try Registry first for speed/correctness
108+ return SchemaRegistry . getObject ( params . objectName ) || ( ql ? ql . getObject ( params . objectName ) : null ) ;
109+ }
102110 if ( method === 'getObject' ) {
103111 // Try Registry first for speed/correctness
104112 return SchemaRegistry . getObject ( params . objectName ) || ql . getObject ( params . objectName ) ;
@@ -130,6 +138,8 @@ describe('App React CRUD Integration Tests', () => {
130138 }
131139
132140
141+
142+
133143 // 3. Set up MSW Node Server with handlers from the plugin
134144 const handlers = mswPlugin . getHandlers ( ) ;
135145 console . log ( 'DEBUG: MSW Handlers registered:' , handlers . map ( h => h . info . header ) ) ;
@@ -178,6 +188,18 @@ describe('App React CRUD Integration Tests', () => {
178188 expect ( taskObject ?. label ) . toBe ( 'Todo Task' ) ;
179189 } ) ;
180190
191+ it ( 'should have initial seeded data' , async ( ) => {
192+ // Find tasks without filter
193+ const response = await client . data . find ( 'todo_task' , { } ) ;
194+ // Response format: { success: true, data: [...], meta: { count: N } }
195+ const list = response . data ;
196+ expect ( list ) . toBeDefined ( ) ;
197+ expect ( Array . isArray ( list ) ) . toBe ( true ) ;
198+ // Expect at least 5 seeded records
199+ expect ( list . length ) . toBeGreaterThanOrEqual ( 1 ) ;
200+ console . log ( `[Test] Initial data check: Found ${ list . length } records.` ) ;
201+ } ) ;
202+
181203 it ( 'should check if ui protocol getUiView is available' , async ( ) => {
182204 // Use client.meta.getView
183205 // This might fail if protocol service doesn't support getUiView in this test env
0 commit comments