@@ -151,6 +151,7 @@ describe("controlplane", async () => {
151151 // Verify field descriptions from TailorDBField
152152 const inputType = passThrough ?. inputs ?. find ( ( i ) => i . name === "input" ) ;
153153 expect ( inputType ?. type ?. kind ) . toBe ( "UserDefined" ) ;
154+ expect ( inputType ?. type ?. name ) . toBe ( "PassThroughInput" ) ;
154155
155156 // Verify response field descriptions
156157 const userInfoResponse = passThrough ?. response ?. type ?. fields ?. find (
@@ -385,6 +386,144 @@ describe("dataplane", () => {
385386 const result = await graphQLClient . rawRequest ( query ) ;
386387 expect ( result . errors ) . toBeDefined ( ) ;
387388 } ) ;
389+
390+ test ( "verifies output typeName via GraphQL introspection" , async ( ) => {
391+ const introspectionQuery = gql `
392+ query {
393+ __type(name: "Query") {
394+ fields {
395+ name
396+ type {
397+ name
398+ kind
399+ ofType {
400+ name
401+ }
402+ }
403+ }
404+ }
405+ }
406+ ` ;
407+ const result = await graphQLClient . rawRequest ( introspectionQuery ) ;
408+ expect ( result . errors ) . toBeUndefined ( ) ;
409+
410+ const queryType = result . data as {
411+ __type : {
412+ fields : {
413+ name : string ;
414+ type : { name : string | null ; kind : string ; ofType : { name : string } | null } ;
415+ } [ ] ;
416+ } ;
417+ } ;
418+ const passThroughField = queryType . __type . fields . find ( ( f ) => f . name === "passThrough" ) ;
419+ expect ( passThroughField ) . toBeDefined ( ) ;
420+
421+ // Verify the output type name
422+ const outputTypeName = passThroughField ?. type . name ?? passThroughField ?. type . ofType ?. name ;
423+ expect ( outputTypeName ) . toBe ( "NestedProfile" ) ;
424+ } ) ;
425+
426+ test ( "toResolverOutput produces types matching TailorDB introspection" , async ( ) => {
427+ // Helper to get field type name
428+ const getTypeName = (
429+ field : { type : { name : string | null ; ofType : { name : string } | null } } | undefined ,
430+ ) => field ?. type ?. name ?? field ?. type ?. ofType ?. name ;
431+
432+ // Get the passThrough resolver's output type name
433+ const schemaQuery = gql `
434+ query {
435+ __schema {
436+ queryType {
437+ fields {
438+ name
439+ type {
440+ name
441+ ofType {
442+ name
443+ }
444+ }
445+ }
446+ }
447+ }
448+ }
449+ ` ;
450+ const schemaResult = await graphQLClient . rawRequest ( schemaQuery ) ;
451+ const queryFields = (
452+ schemaResult . data as {
453+ __schema : {
454+ queryType : {
455+ fields : {
456+ name : string ;
457+ type : { name : string | null ; ofType : { name : string } | null } ;
458+ } [ ] ;
459+ } ;
460+ } ;
461+ }
462+ ) . __schema . queryType . fields ;
463+ const passThroughField = queryFields . find ( ( f ) => f . name === "passThrough" ) ;
464+ const passThroughTypeName = getTypeName ( passThroughField ) ;
465+
466+ // Get nested field types for passThrough output
467+ const typeQuery = gql `
468+ query GetType($name: String!) {
469+ __type(name: $name) {
470+ fields {
471+ name
472+ type {
473+ name
474+ ofType {
475+ name
476+ }
477+ }
478+ }
479+ }
480+ }
481+ ` ;
482+ const passThroughTypeResult = await graphQLClient . rawRequest ( typeQuery , {
483+ name : passThroughTypeName ,
484+ } ) ;
485+ const passThroughFields = (
486+ passThroughTypeResult . data as {
487+ __type : {
488+ fields : {
489+ name : string ;
490+ type : { name : string | null ; ofType : { name : string } | null } ;
491+ } [ ] ;
492+ } ;
493+ }
494+ ) . __type . fields ;
495+
496+ // Get TailorDB NestedProfile type for comparison
497+ const tailorDbResult = await graphQLClient . rawRequest ( typeQuery , { name : "NestedProfile" } ) ;
498+ const tailorDbFields = (
499+ tailorDbResult . data as {
500+ __type : {
501+ fields : {
502+ name : string ;
503+ type : { name : string | null ; ofType : { name : string } | null } ;
504+ } [ ] ;
505+ } ;
506+ }
507+ ) . __type . fields ;
508+
509+ // Verify field types match (including backward relations from new types)
510+ const fieldsToCheck = [
511+ "userInfo" , // nested object
512+ "metadata" , // nested object
513+ "avatar" , // file field
514+ "ownerID" , // n-1 relation (foreign key)
515+ "owner" , // n-1 relation (navigation property)
516+ "detail" , // 1-1 backward relation (from ProfileDetail)
517+ "comments" , // n-1 backward relation (from ProfileComment)
518+ ] ;
519+ for ( const fieldName of fieldsToCheck ) {
520+ const passThroughFieldType = getTypeName (
521+ passThroughFields . find ( ( f ) => f . name === fieldName ) ,
522+ ) ;
523+ const tailorDbFieldType = getTypeName ( tailorDbFields . find ( ( f ) => f . name === fieldName ) ) ;
524+ expect ( passThroughFieldType ) . toBe ( tailorDbFieldType ) ;
525+ }
526+ } ) ;
388527 } ) ;
389528
390529 test ( "env" , async ( ) => {
0 commit comments