@@ -590,6 +590,7 @@ __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
590590 const testSchema = buildSchema ( /* GraphQL */ `
591591 type Query {
592592 a: A
593+ c: C
593594 }
594595
595596 enum A {
@@ -606,11 +607,17 @@ __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
606607 type B {
607608 a: String
608609 }
610+
611+ enum C {
612+ Y
613+ Z
614+ }
609615 ` ) ;
610616
611617 const config = {
612618 enumValues : {
613619 A : 'MyA' ,
620+ C : '../enums.js#MyC' ,
614621 } ,
615622 typesPrefix : 'GQL_' ,
616623 } ;
@@ -622,9 +629,13 @@ __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
622629
623630 expect ( mergedOutputs ) . not . toContain ( `A: A;` ) ;
624631 expect ( mergedOutputs ) . not . toContain ( `A: GQL_A;` ) ;
632+ expect ( mergedOutputs ) . not . toContain ( `C: GQL_MyC;` ) ;
625633 expect ( mergedOutputs ) . toContain ( `NotMapped: GQL_NotMapped;` ) ;
626634 expect ( mergedOutputs ) . not . toContain ( `NotMapped: NotMapped;` ) ;
635+ expect ( mergedOutputs ) . toContain ( `A: MyA;` ) ;
627636 expect ( mergedOutputs ) . toContain ( `B: GQL_B;` ) ;
637+ expect ( mergedOutputs ) . toContain ( `C: C;` ) ;
638+ expect ( mergedOutputs ) . toContain ( `import { MyC as C } from '../enums.js';` ) ;
628639 } ) ;
629640
630641 it ( 'Should allow to generate optional __resolveType' , async ( ) => {
@@ -2260,7 +2271,7 @@ export type ResolverFn<TResult, TParent, TContext, TArgs> = (
22602271 ProjectRoleDetail : '../entities#ProjectRole' ,
22612272 } ,
22622273 enumValues : {
2263- ProjectRole : '../entities#ProjectRole ' ,
2274+ ProjectRole : '../entities#AnotherProjectRole ' ,
22642275 } ,
22652276 } ;
22662277
@@ -2272,8 +2283,11 @@ export type ResolverFn<TResult, TParent, TContext, TArgs> = (
22722283 expect ( output . prepend . filter ( t => t . includes ( 'import' ) ) . length ) . toBe ( 2 ) ;
22732284 expect ( output . prepend . filter ( t => t . includes ( 'ProjectRole' ) ) . length ) . toBe ( 0 ) ;
22742285 expect ( tsContent . prepend . filter ( t => t . includes ( 'ProjectRole' ) ) . length ) . toBe ( 1 ) ;
2275- expect ( tsContent . prepend . includes ( `import { ProjectRole } from '../entities';` ) ) . toBeTruthy ( ) ;
2276- expect ( output . prepend . includes ( `import { ProjectRole } from '../entities';` ) ) . toBeFalsy ( ) ;
2286+ expect ( output . content . includes ( 'AnotherProjectRole' ) ) . toBeFalsy ( ) ;
2287+ expect (
2288+ tsContent . prepend . includes ( `import { AnotherProjectRole as ProjectRole } from '../entities';` )
2289+ ) . toBeTruthy ( ) ;
2290+ expect ( output . prepend . includes ( `import { AnotherProjectRole as ProjectRole } from '../entities';` ) ) . toBeFalsy ( ) ;
22772291 } ) ;
22782292
22792293 it ( '#3264 - enumValues is not being applied to directive resolver' , async ( ) => {
0 commit comments