File tree 1 file changed +13
-9
lines changed
1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -16,18 +16,22 @@ describe("Bank Accounts", function () {
16
16
cy . intercept ( "GET" , "/notifications" ) . as ( "getNotifications" ) ;
17
17
18
18
cy . intercept ( "POST" , apiGraphQL , ( req ) => {
19
- const { body } = req ;
19
+ const operationAliases : Record < string , string > = {
20
+ ListBankAccount : "gqlListBankAccountQuery" ,
21
+ CreateBankAccount : "gqlCreateBankAccountMutation" ,
22
+ DeleteBankAccount : "gqlDeleteBankAccountMutation" ,
23
+ } ;
20
24
21
- if ( body . hasOwnProperty ( "operationName" ) && body . operationName === "ListBankAccount" ) {
22
- req . alias = "gqlListBankAccountQuery" ;
23
- }
25
+ const { body } = req ;
24
26
25
- if ( body . hasOwnProperty ( "operationName" ) && body . operationName === "CreateBankAccount" ) {
26
- req . alias = "gqlCreateBankAccountMutation" ;
27
- }
27
+ const operationName = body ?. operationName ;
28
28
29
- if ( body . hasOwnProperty ( "operationName" ) && body . operationName === "DeleteBankAccount" ) {
30
- req . alias = "gqlDeleteBankAccountMutation" ;
29
+ if (
30
+ body . hasOwnProperty ( "operationName" ) &&
31
+ operationName &&
32
+ operationAliases [ operationName ]
33
+ ) {
34
+ req . alias = operationAliases [ operationName ] ;
31
35
}
32
36
} ) ;
33
37
You can’t perform that action at this time.
0 commit comments