@@ -298,35 +298,6 @@ describe('#crud-typeorm', () => {
298298
299299 await app . init ( ) ;
300300 server = app . getHttpServer ( ) ;
301-
302- // Diagnostic: snapshot users/companies state at #basic-crud beforeAll
303- try {
304- const usersSvc : any = app . get ( UsersService ) ;
305- const ds : any = usersSvc ?. repo ?. manager ?. connection ;
306- if ( ds ?. query ) {
307- const isMy = ds . options ?. type === 'mysql' ;
308- const q = isMy ? '`' : '"' ;
309- const userCount = await ds . query ( `SELECT COUNT(*) AS c FROM users` ) ;
310- const user5 = await ds . query (
311- `SELECT id, ${ q } companyId${ q } , ${ q } profileId${ q } , ${ q } deletedAt${ q } FROM users WHERE id = 5 OR ${ q } profileId${ q } = 5` ,
312- ) ;
313- const companies = await ds . query ( `SELECT id, ${ q } deletedAt${ q } FROM companies WHERE id IN (1, 2, 3, 4, 5) ORDER BY id` ) ;
314- // eslint-disable-next-line no-console
315- console . log (
316- '[diag beforeAll] dialect:' ,
317- ds . options ?. type ,
318- 'userCount:' ,
319- JSON . stringify ( userCount ) ,
320- 'user5:' ,
321- JSON . stringify ( user5 ) ,
322- 'companies1-5:' ,
323- JSON . stringify ( companies ) ,
324- ) ;
325- }
326- } catch ( err ) {
327- // eslint-disable-next-line no-console
328- console . log ( '[diag beforeAll] failed:' , ( err as Error ) . message ) ;
329- }
330301 } ) ;
331302
332303 beforeEach ( ( ) => {
@@ -464,84 +435,7 @@ describe('#crud-typeorm', () => {
464435 } ) ;
465436 } ) ;
466437 it ( 'should return an entity with compound key' , async ( ) => {
467- // CI-side diagnostic: dump registered Express routes that mention `users4`,
468- // then full response shape. Goal — prove whether the route is registered
469- // at all in CI MySQL, and if so what NestJS actually returns.
470- try {
471- const router =
472- ( server as any ) ?. _events ?. request ?. _router ??
473- ( server as any ) ?. _events ?. request ?. router ??
474- ( server as any ) ?. router ;
475- const stack = router ?. stack ?? [ ] ;
476- const routes : string [ ] = [ ] ;
477- for ( const layer of stack ) {
478- if ( layer ?. route ?. path ) {
479- const methods = Object . keys ( layer . route . methods || { } ) . join ( ',' ) ;
480- routes . push ( `${ methods . toUpperCase ( ) } ${ layer . route . path } ` ) ;
481- } else if ( layer ?. handle ?. stack ) {
482- for ( const sub of layer . handle . stack ) {
483- if ( sub ?. route ?. path ) {
484- const methods = Object . keys ( sub . route . methods || { } ) . join ( ',' ) ;
485- routes . push ( `${ methods . toUpperCase ( ) } ${ sub . route . path } ` ) ;
486- }
487- }
488- }
489- }
490- const users4Routes = routes . filter ( ( r ) => r . toLowerCase ( ) . includes ( 'users4' ) ) ;
491- // eslint-disable-next-line no-console
492- console . log (
493- '[diag users4] count:' ,
494- users4Routes . length ,
495- 'sample:' ,
496- JSON . stringify ( users4Routes . slice ( 0 , 10 ) ) ,
497- 'total-routes:' ,
498- routes . length ,
499- ) ;
500- } catch ( err ) {
501- // eslint-disable-next-line no-console
502- console . log ( '[diag users4] introspection failed:' , ( err as Error ) . message ) ;
503- }
504-
505- // Second diag: dump user-5 row state directly via the app's DataSource,
506- // then the targeted SELECT the route would emit. Catches mid-suite mutation.
507- try {
508- const usersSvc : any = app . get ( UsersService ) ;
509- const ds : any = usersSvc ?. repo ?. manager ?. connection ;
510- if ( ds ?. query ) {
511- const isMy = ds . options ?. type === 'mysql' ;
512- const q = isMy ? '`' : '"' ;
513- const cols = `id, ${ q } companyId${ q } , ${ q } profileId${ q } , ${ q } deletedAt${ q } ` ;
514- const all5 = await ds . query ( `SELECT ${ cols } FROM users WHERE id = 5 OR ${ q } profileId${ q } = 5` ) ;
515- // eslint-disable-next-line no-console
516- console . log ( '[diag user5 rows]' , JSON . stringify ( all5 ) ) ;
517- const targeted = await ds . query (
518- `SELECT ${ cols } FROM users WHERE ${ q } companyId${ q } = 1 AND ${ q } profileId${ q } = 5 AND ${ q } deletedAt${ q } IS NULL` ,
519- ) ;
520- // eslint-disable-next-line no-console
521- console . log ( '[diag targeted]' , JSON . stringify ( targeted ) ) ;
522- } else {
523- // eslint-disable-next-line no-console
524- console . log ( '[diag] no DataSource on app' ) ;
525- }
526- } catch ( err ) {
527- // eslint-disable-next-line no-console
528- console . log ( '[diag db query failed]' , ( err as Error ) . message ) ;
529- }
530-
531438 const res = await request ( server ) . get ( '/users4/1/5' ) ;
532- if ( res . status !== 200 ) {
533- // eslint-disable-next-line no-console
534- console . log (
535- '[diag /users4/1/5] status:' ,
536- res . status ,
537- 'body:' ,
538- JSON . stringify ( res . body ) ,
539- 'text:' ,
540- res . text ,
541- 'headers:' ,
542- JSON . stringify ( res . headers ) ,
543- ) ;
544- }
545439 expect ( res . status ) . toBe ( 200 ) ;
546440 expect ( res . body . id ) . toBe ( 5 ) ;
547441 } ) ;
0 commit comments