@@ -3,18 +3,17 @@ import { jest } from '@jest/globals';
3
3
import { EmailService } from '@seedcompany/nestjs-email' ;
4
4
import { Connection } from 'cypher-query-builder' ;
5
5
import { isValidId } from '~/common' ;
6
+ import { graphql } from '~/graphql' ;
6
7
import {
7
8
createSession ,
8
9
createTestApp ,
9
10
fragments ,
10
11
generateRegisterInput ,
11
- gql ,
12
12
login ,
13
13
logout ,
14
14
registerUser ,
15
15
type TestApp ,
16
16
} from './utility' ;
17
- import { type RawUser } from './utility/fragments' ;
18
17
19
18
describe ( 'Authentication e2e' , ( ) => {
20
19
let app : TestApp ;
@@ -38,13 +37,13 @@ describe('Authentication e2e', () => {
38
37
// create user first
39
38
await registerUser ( app , fakeUser ) ;
40
39
await app . graphql . mutate (
41
- gql `
40
+ graphql ( `
42
41
mutation forgotPassword($email: String!) {
43
42
forgotPassword(email: $email) {
44
43
__typename
45
44
}
46
45
}
47
- ` ,
46
+ ` ) ,
48
47
{
49
48
email : email ,
50
49
} ,
@@ -59,13 +58,13 @@ describe('Authentication e2e', () => {
59
58
const token = tokenRes ? tokenRes . token : '' ;
60
59
const newPassword = faker . internet . password ( ) ;
61
60
await app . graphql . mutate (
62
- gql `
61
+ graphql ( `
63
62
mutation resetPassword($input: ResetPasswordInput!) {
64
63
resetPassword(input: $input) {
65
64
__typename
66
65
}
67
66
}
68
- ` ,
67
+ ` ) ,
69
68
{
70
69
input : {
71
70
token : token ,
@@ -90,20 +89,22 @@ describe('Authentication e2e', () => {
90
89
91
90
await login ( app , { email : fakeUser . email , password : fakeUser . password } ) ;
92
91
const result = await app . graphql . query (
93
- gql `
94
- query user($id: ID!) {
95
- user(id: $id) {
96
- ...user
92
+ graphql (
93
+ `
94
+ query user($id: ID!) {
95
+ user(id: $id) {
96
+ ...user
97
+ }
97
98
}
98
- }
99
- ${ fragments . user }
100
- ` ,
99
+ ` ,
100
+ [ fragments . user ] ,
101
+ ) ,
101
102
{
102
103
id : user . id ,
103
104
} ,
104
105
) ;
105
106
106
- const actual : RawUser = result . user ;
107
+ const actual = result . user ;
107
108
expect ( actual ) . toBeTruthy ( ) ;
108
109
expect ( isValidId ( actual . id ) ) . toBe ( true ) ;
109
110
expect ( actual . email . value ) . toBe ( fakeUser . email . toLowerCase ( ) ) ;
@@ -125,13 +126,13 @@ describe('Authentication e2e', () => {
125
126
126
127
const newPassword = faker . internet . password ( ) ;
127
128
await app . graphql . mutate (
128
- gql `
129
+ graphql ( `
129
130
mutation changePassword($oldPassword: String!, $newPassword: String!) {
130
131
changePassword(oldPassword: $oldPassword, newPassword: $newPassword) {
131
132
__typename
132
133
}
133
134
}
134
- ` ,
135
+ ` ) ,
135
136
{
136
137
oldPassword : fakeUser . password ,
137
138
newPassword : newPassword ,
0 commit comments