@@ -685,9 +685,16 @@ describe('ParseGraphQLServer', () => {
685685 }
686686 } ) ;
687687
688- it ( 'should always work with master key' , async ( ) => {
689- const introspection =
690- await apolloClient . query ( {
688+ it ( 'should always work with master key in node environment production' , async ( ) => {
689+ const originalNodeEnv = process . env . NODE_ENV ;
690+ try {
691+ // Apollo Server have changing behavior based on the NODE_ENV variable
692+ // so we need to set it to production to get the expected behavior
693+ // and cover correctly the introspection cases
694+ process . env . NODE_ENV = 'production' ;
695+ await createGQLFromParseServer ( parseServer ) ;
696+
697+ const introspection = await apolloClient . query ( {
691698 query : gql `
692699 query Introspection {
693700 __schema {
@@ -701,10 +708,45 @@ describe('ParseGraphQLServer', () => {
701708 headers : {
702709 'X-Parse-Master-Key' : 'test' ,
703710 } ,
704- }
705- } , )
706- expect ( introspection . data ) . toBeDefined ( ) ;
707- expect ( introspection . errors ) . not . toBeDefined ( ) ;
711+ } ,
712+ } ) ;
713+ expect ( introspection . data ) . toBeDefined ( ) ;
714+ expect ( introspection . errors ) . not . toBeDefined ( ) ;
715+ } finally {
716+ process . env . NODE_ENV = originalNodeEnv ;
717+ }
718+ } ) ;
719+
720+ it ( 'should always work with master key in node environment development' , async ( ) => {
721+ const originalNodeEnv = process . env . NODE_ENV ;
722+ try {
723+ // Apollo Server have changing behavior based on the NODE_ENV variable
724+ // so we need to set it to development to get the expected behavior
725+ // and cover correctly the introspection cases
726+ process . env . NODE_ENV = 'development' ;
727+ await createGQLFromParseServer ( parseServer ) ;
728+
729+ const introspection = await apolloClient . query ( {
730+ query : gql `
731+ query Introspection {
732+ __schema {
733+ types {
734+ name
735+ }
736+ }
737+ }
738+ ` ,
739+ context : {
740+ headers : {
741+ 'X-Parse-Master-Key' : 'test' ,
742+ } ,
743+ } ,
744+ } ) ;
745+ expect ( introspection . data ) . toBeDefined ( ) ;
746+ expect ( introspection . errors ) . not . toBeDefined ( ) ;
747+ } finally {
748+ process . env . NODE_ENV = originalNodeEnv ;
749+ }
708750 } ) ;
709751
710752 it ( 'should always work with maintenance key' , async ( ) => {
0 commit comments