1- import context from '@aws-lambda-powertools/testing-utils/context' ;
21import { AssertionError } from 'node:assert' ;
2+ import context from '@aws-lambda-powertools/testing-utils/context' ;
33import type { AppSyncResolverEvent , Context } from 'aws-lambda' ;
44import { beforeEach , describe , expect , it , vi } from 'vitest' ;
55import { AppSyncGraphQLResolver } from '../../../src/appsync-graphql/AppSyncGraphQLResolver.js' ;
@@ -760,7 +760,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
760760 message : 'Aggregation failed' ,
761761 } ,
762762 ] ) (
763- 'should invoke exception handler for %s' ,
763+ 'invokes exception handler for %s' ,
764764 async ( {
765765 errorClass,
766766 message,
@@ -772,14 +772,9 @@ describe('Class: AppSyncGraphQLResolver', () => {
772772 const app = new AppSyncGraphQLResolver ( ) ;
773773
774774 app . exceptionHandler ( errorClass , async ( err ) => ( {
775- message,
776- errorName : err . constructor . name ,
777- } ) ;
778- return {
779- message,
780- errorName : err . constructor . name ,
781- } ;
782- } ) ;
775+ message,
776+ errorName : err . constructor . name ,
777+ } ) ) ;
783778
784779 app . onQuery ( 'getUser' , async ( ) => {
785780 throw errorClass === AggregateError
@@ -801,7 +796,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
801796 }
802797 ) ;
803798
804- it ( 'should handle multiple different error types with specific exception handlers' , async ( ) => {
799+ it ( 'handles multiple different error types with specific exception handlers' , async ( ) => {
805800 // Prepare
806801 const app = new AppSyncGraphQLResolver ( ) ;
807802
@@ -854,7 +849,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
854849 } ) ;
855850 } ) ;
856851
857- it ( 'should prefer exact error class match over inheritance match during exception handling' , async ( ) => {
852+ it ( 'prefers exact error class match over inheritance match during exception handling' , async ( ) => {
858853 // Prepare
859854 const app = new AppSyncGraphQLResolver ( ) ;
860855
@@ -892,7 +887,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
892887 } ) ;
893888 } ) ;
894889
895- it ( 'should fall back to default error formatting when no exception handler is found' , async ( ) => {
890+ it ( 'falls back to default error formatting when no exception handler is found' , async ( ) => {
896891 // Prepare
897892 const app = new AppSyncGraphQLResolver ( ) ;
898893
@@ -920,7 +915,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
920915 } ) ;
921916 } ) ;
922917
923- it ( 'should fall back to default error formatting when exception handler throws an error' , async ( ) => {
918+ it ( 'falls back to default error formatting when exception handler throws an error' , async ( ) => {
924919 // Prepare
925920 const app = new AppSyncGraphQLResolver ( { logger : console } ) ;
926921 const errorToBeThrown = new Error ( 'Exception handler failed' ) ;
@@ -955,7 +950,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
955950 ) ;
956951 } ) ;
957952
958- it ( 'should invoke sync exception handlers and return their result' , async ( ) => {
953+ it ( 'invokes sync exception handlers and return their result' , async ( ) => {
959954 // Prepare
960955 const app = new AppSyncGraphQLResolver ( ) ;
961956
@@ -985,7 +980,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
985980 } ) ;
986981 } ) ;
987982
988- it ( 'should not interfere with ResolverNotFoundException during exception handling' , async ( ) => {
983+ it ( 'does not interfere with ResolverNotFoundException during exception handling' , async ( ) => {
989984 // Prepare
990985 const app = new AppSyncGraphQLResolver ( ) ;
991986
@@ -1006,7 +1001,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
10061001 ) . rejects . toThrow ( 'No resolver found for Query-nonExistentResolver' ) ;
10071002 } ) ;
10081003
1009- it ( 'should work as a method decorator for `exceptionHandler`' , async ( ) => {
1004+ it ( 'works as a method decorator for `exceptionHandler`' , async ( ) => {
10101005 // Prepare
10111006 const app = new AppSyncGraphQLResolver ( ) ;
10121007
@@ -1079,7 +1074,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
10791074 } ) ;
10801075 } ) ;
10811076
1082- it ( 'should handle array of error classes with single exception handler function' , async ( ) => {
1077+ it ( 'handles array of error classes with single exception handler function' , async ( ) => {
10831078 // Prepare
10841079 const app = new AppSyncGraphQLResolver ( { logger : console } ) ;
10851080
@@ -1143,7 +1138,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
11431138 } ) ;
11441139 } ) ;
11451140
1146- it ( 'should preserve scope when using array error handler as method decorator' , async ( ) => {
1141+ it ( 'preserves scope when using array error handler as method decorator' , async ( ) => {
11471142 // Prepare
11481143 const app = new AppSyncGraphQLResolver ( ) ;
11491144
@@ -1229,7 +1224,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
12291224 } ) ;
12301225 } ) ;
12311226
1232- it ( 'should handle mix of single and array error handlers with proper precedence' , async ( ) => {
1227+ it ( 'handles mix of single and array error handlers with proper precedence' , async ( ) => {
12331228 // Prepare
12341229 const app = new AppSyncGraphQLResolver ( ) ;
12351230
@@ -1305,7 +1300,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
13051300 } ) ;
13061301 } ) ;
13071302
1308- it ( 'should handle empty array of error classes gracefully' , async ( ) => {
1303+ it ( 'handles empty array of error classes gracefully' , async ( ) => {
13091304 // Prepare
13101305 const app = new AppSyncGraphQLResolver ( { logger : console } ) ;
13111306
0 commit comments