@@ -26,6 +26,7 @@ describe('Introspection', () => {
2626 descriptions : false ,
2727 specifiedByUrl : true ,
2828 directiveIsRepeatable : true ,
29+ errorBehavior : true ,
2930 } ) ;
3031
3132 const result = graphqlSync ( { schema, source } ) ;
@@ -35,6 +36,7 @@ describe('Introspection', () => {
3536 queryType : { name : 'SomeObject' , kind : 'OBJECT' } ,
3637 mutationType : null ,
3738 subscriptionType : null ,
39+ defaultErrorBehavior : 'PROPAGATE' ,
3840 types : [
3941 {
4042 kind : 'OBJECT' ,
@@ -1754,4 +1756,60 @@ describe('Introspection', () => {
17541756 } ) ;
17551757 expect ( result ) . to . not . have . property ( 'errors' ) ;
17561758 } ) ;
1759+
1760+ it ( 'reflects the default error behavior (default)' , ( ) => {
1761+ const schema = buildSchema ( `
1762+ type SomeObject {
1763+ someField: String
1764+ }
1765+
1766+ schema {
1767+ query: SomeObject
1768+ }
1769+ ` ) ;
1770+
1771+ const source = getIntrospectionQuery ( {
1772+ descriptions : false ,
1773+ specifiedByUrl : true ,
1774+ directiveIsRepeatable : true ,
1775+ } ) ;
1776+
1777+ const result = graphqlSync ( { schema, source } ) ;
1778+ expect ( result ) . to . deep . equal ( {
1779+ data : {
1780+ __schema : {
1781+ defaultErrorBehavior : 'PROPAGATE' ,
1782+ } ,
1783+ } ,
1784+ } ) ;
1785+ } ) ;
1786+
1787+ it ( 'reflects the default error behavior (NO_PROPAGATE)' , ( ) => {
1788+ const schema = buildSchema ( `
1789+ type SomeObject {
1790+ someField: String
1791+ }
1792+
1793+ schema @behavior(onError: NO_PROPAGATE) {
1794+ query: SomeObject
1795+ }
1796+ ` ) ;
1797+
1798+ const source = /* GraphQL */ `
1799+ {
1800+ __schema {
1801+ defaultErrorBehavior
1802+ }
1803+ }
1804+ ` ;
1805+
1806+ const result = graphqlSync ( { schema, source } ) ;
1807+ expect ( result ) . to . deep . equal ( {
1808+ data : {
1809+ __schema : {
1810+ defaultErrorBehavior : 'NO_PROPAGATE' ,
1811+ } ,
1812+ } ,
1813+ } ) ;
1814+ } ) ;
17571815} ) ;
0 commit comments