1
- import context from '@aws-lambda-powertools/testing-utils/context' ;
2
1
import { AssertionError } from 'node:assert' ;
2
+ import context from '@aws-lambda-powertools/testing-utils/context' ;
3
3
import type { AppSyncResolverEvent , Context } from 'aws-lambda' ;
4
4
import { beforeEach , describe , expect , it , vi } from 'vitest' ;
5
5
import { AppSyncGraphQLResolver } from '../../../src/appsync-graphql/AppSyncGraphQLResolver.js' ;
@@ -760,7 +760,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
760
760
message : 'Aggregation failed' ,
761
761
} ,
762
762
] ) (
763
- 'should invoke exception handler for %s' ,
763
+ 'invokes exception handler for %s' ,
764
764
async ( {
765
765
errorClass,
766
766
message,
@@ -772,14 +772,9 @@ describe('Class: AppSyncGraphQLResolver', () => {
772
772
const app = new AppSyncGraphQLResolver ( ) ;
773
773
774
774
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
+ } ) ) ;
783
778
784
779
app . onQuery ( 'getUser' , async ( ) => {
785
780
throw errorClass === AggregateError
@@ -801,7 +796,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
801
796
}
802
797
) ;
803
798
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 ( ) => {
805
800
// Prepare
806
801
const app = new AppSyncGraphQLResolver ( ) ;
807
802
@@ -854,7 +849,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
854
849
} ) ;
855
850
} ) ;
856
851
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 ( ) => {
858
853
// Prepare
859
854
const app = new AppSyncGraphQLResolver ( ) ;
860
855
@@ -892,7 +887,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
892
887
} ) ;
893
888
} ) ;
894
889
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 ( ) => {
896
891
// Prepare
897
892
const app = new AppSyncGraphQLResolver ( ) ;
898
893
@@ -920,7 +915,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
920
915
} ) ;
921
916
} ) ;
922
917
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 ( ) => {
924
919
// Prepare
925
920
const app = new AppSyncGraphQLResolver ( { logger : console } ) ;
926
921
const errorToBeThrown = new Error ( 'Exception handler failed' ) ;
@@ -955,7 +950,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
955
950
) ;
956
951
} ) ;
957
952
958
- it ( 'should invoke sync exception handlers and return their result' , async ( ) => {
953
+ it ( 'invokes sync exception handlers and return their result' , async ( ) => {
959
954
// Prepare
960
955
const app = new AppSyncGraphQLResolver ( ) ;
961
956
@@ -985,7 +980,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
985
980
} ) ;
986
981
} ) ;
987
982
988
- it ( 'should not interfere with ResolverNotFoundException during exception handling' , async ( ) => {
983
+ it ( 'does not interfere with ResolverNotFoundException during exception handling' , async ( ) => {
989
984
// Prepare
990
985
const app = new AppSyncGraphQLResolver ( ) ;
991
986
@@ -1006,7 +1001,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
1006
1001
) . rejects . toThrow ( 'No resolver found for Query-nonExistentResolver' ) ;
1007
1002
} ) ;
1008
1003
1009
- it ( 'should work as a method decorator for `exceptionHandler`' , async ( ) => {
1004
+ it ( 'works as a method decorator for `exceptionHandler`' , async ( ) => {
1010
1005
// Prepare
1011
1006
const app = new AppSyncGraphQLResolver ( ) ;
1012
1007
@@ -1079,7 +1074,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
1079
1074
} ) ;
1080
1075
} ) ;
1081
1076
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 ( ) => {
1083
1078
// Prepare
1084
1079
const app = new AppSyncGraphQLResolver ( { logger : console } ) ;
1085
1080
@@ -1143,7 +1138,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
1143
1138
} ) ;
1144
1139
} ) ;
1145
1140
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 ( ) => {
1147
1142
// Prepare
1148
1143
const app = new AppSyncGraphQLResolver ( ) ;
1149
1144
@@ -1229,7 +1224,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
1229
1224
} ) ;
1230
1225
} ) ;
1231
1226
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 ( ) => {
1233
1228
// Prepare
1234
1229
const app = new AppSyncGraphQLResolver ( ) ;
1235
1230
@@ -1305,7 +1300,7 @@ describe('Class: AppSyncGraphQLResolver', () => {
1305
1300
} ) ;
1306
1301
} ) ;
1307
1302
1308
- it ( 'should handle empty array of error classes gracefully' , async ( ) => {
1303
+ it ( 'handles empty array of error classes gracefully' , async ( ) => {
1309
1304
// Prepare
1310
1305
const app = new AppSyncGraphQLResolver ( { logger : console } ) ;
1311
1306
0 commit comments