@@ -5,95 +5,95 @@ import { ApplicationModule } from '../code-first/app.module';
5
5
import { CatsModule } from '../code-first/cats/cats.module' ;
6
6
7
7
describe ( 'GraphQL - Resolver registration methods' , ( ) => {
8
- let app : INestApplication ;
9
-
10
- describe ( 'useClass' , ( ) => {
11
- beforeEach ( async ( ) => {
12
- const module = await Test . createTestingModule ( {
13
- imports : [ ApplicationModule , CatsModule . register ( 'useClass' ) ] ,
14
- } ) . compile ( ) ;
15
-
16
- app = module . createNestApplication ( ) ;
17
- await app . init ( ) ;
18
- } ) ;
8
+ let app : INestApplication ;
19
9
20
- it ( 'should return the cats result' , async ( ) => {
21
- return request ( app . getHttpServer ( ) )
22
- . post ( '/graphql' )
23
- . send ( {
24
- operationName : null ,
25
- variables : { } ,
26
- query : 'query {\n getAnimalName \n}\n' ,
27
- } )
28
- . expect ( 200 , {
29
- data : {
30
- getAnimalName : 'cat' ,
31
- }
32
- } ) ;
33
- } ) ;
10
+ describe ( 'useClass' , ( ) => {
11
+ beforeEach ( async ( ) => {
12
+ const module = await Test . createTestingModule ( {
13
+ imports : [ ApplicationModule , CatsModule . register ( 'useClass' ) ] ,
14
+ } ) . compile ( ) ;
34
15
35
- afterEach ( async ( ) => {
36
- await app . close ( ) ;
37
- } ) ;
16
+ app = module . createNestApplication ( ) ;
17
+ await app . init ( ) ;
38
18
} ) ;
39
-
40
- describe ( 'useValue' , ( ) => {
41
- beforeEach ( async ( ) => {
42
- const module = await Test . createTestingModule ( {
43
- imports : [ ApplicationModule , CatsModule . register ( 'useValue' ) ] ,
44
- } ) . compile ( ) ;
45
-
46
- app = module . createNestApplication ( ) ;
47
- await app . init ( ) ;
48
- } ) ;
49
19
50
- it ( 'should return the cats result' , async ( ) => {
51
- return request ( app . getHttpServer ( ) )
52
- . post ( '/graphql' )
53
- . send ( {
54
- operationName : null ,
55
- variables : { } ,
56
- query : 'query {\n getAnimalName \n}\n' ,
57
- } )
58
- . expect ( 200 , {
59
- data : {
60
- getAnimalName : 'cat' ,
61
- }
62
- } ) ;
20
+ it ( 'should return the cats result' , async ( ) => {
21
+ return request ( app . getHttpServer ( ) )
22
+ . post ( '/graphql' )
23
+ . send ( {
24
+ operationName : null ,
25
+ variables : { } ,
26
+ query : 'query {\n getAnimalName \n}\n' ,
27
+ } )
28
+ . expect ( 200 , {
29
+ data : {
30
+ getAnimalName : 'cat' ,
31
+ } ,
63
32
} ) ;
33
+ } ) ;
64
34
65
- afterEach ( async ( ) => {
66
- await app . close ( ) ;
67
- } ) ;
35
+ afterEach ( async ( ) => {
36
+ await app . close ( ) ;
68
37
} ) ;
69
-
70
- describe ( 'useFactory' , ( ) => {
71
- beforeEach ( async ( ) => {
72
- const module = await Test . createTestingModule ( {
73
- imports : [ ApplicationModule , CatsModule . register ( 'useFactory' ) ] ,
74
- } ) . compile ( ) ;
75
-
76
- app = module . createNestApplication ( ) ;
77
- await app . init ( ) ;
78
- } ) ;
79
-
80
- it ( 'should return the cats result' , async ( ) => {
81
- return request ( app . getHttpServer ( ) )
82
- . post ( '/graphql' )
83
- . send ( {
84
- operationName : null ,
85
- variables : { } ,
86
- query : 'query {\n getAnimalName \n}\n' ,
87
- } )
88
- . expect ( 200 , {
89
- data : {
90
- getAnimalName : 'cat' ,
91
- }
92
- } ) ;
38
+ } ) ;
39
+
40
+ describe ( 'useValue' , ( ) => {
41
+ beforeEach ( async ( ) => {
42
+ const module = await Test . createTestingModule ( {
43
+ imports : [ ApplicationModule , CatsModule . register ( 'useValue' ) ] ,
44
+ } ) . compile ( ) ;
45
+
46
+ app = module . createNestApplication ( ) ;
47
+ await app . init ( ) ;
48
+ } ) ;
49
+
50
+ it ( 'should return the cats result' , async ( ) => {
51
+ return request ( app . getHttpServer ( ) )
52
+ . post ( '/graphql' )
53
+ . send ( {
54
+ operationName : null ,
55
+ variables : { } ,
56
+ query : 'query {\n getAnimalName \n}\n' ,
57
+ } )
58
+ . expect ( 200 , {
59
+ data : {
60
+ getAnimalName : 'cat' ,
61
+ } ,
93
62
} ) ;
63
+ } ) ;
64
+
65
+ afterEach ( async ( ) => {
66
+ await app . close ( ) ;
67
+ } ) ;
68
+ } ) ;
69
+
70
+ describe ( 'useFactory' , ( ) => {
71
+ beforeEach ( async ( ) => {
72
+ const module = await Test . createTestingModule ( {
73
+ imports : [ ApplicationModule , CatsModule . register ( 'useFactory' ) ] ,
74
+ } ) . compile ( ) ;
94
75
95
- afterEach ( async ( ) => {
96
- await app . close ( ) ;
76
+ app = module . createNestApplication ( ) ;
77
+ await app . init ( ) ;
78
+ } ) ;
79
+
80
+ it ( 'should return the cats result' , async ( ) => {
81
+ return request ( app . getHttpServer ( ) )
82
+ . post ( '/graphql' )
83
+ . send ( {
84
+ operationName : null ,
85
+ variables : { } ,
86
+ query : 'query {\n getAnimalName \n}\n' ,
87
+ } )
88
+ . expect ( 200 , {
89
+ data : {
90
+ getAnimalName : 'cat' ,
91
+ } ,
97
92
} ) ;
98
93
} ) ;
94
+
95
+ afterEach ( async ( ) => {
96
+ await app . close ( ) ;
97
+ } ) ;
98
+ } ) ;
99
99
} ) ;
0 commit comments