6
6
*
7
7
*/
8
8
9
- import { statement } from '../../../tests/utils' ;
9
+ import { statement , noopImporter } from '../../../tests/utils' ;
10
10
import getMethodDocumentation from '../getMethodDocumentation' ;
11
11
12
12
describe ( 'getMethodDocumentation' , ( ) => {
@@ -18,7 +18,7 @@ describe('getMethodDocumentation', () => {
18
18
}
19
19
` ) ;
20
20
const method = def . get ( 'body' , 'body' , 0 ) ;
21
- expect ( getMethodDocumentation ( method ) ) . toEqual ( {
21
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual ( {
22
22
name : 'hello' ,
23
23
docblock : null ,
24
24
modifiers : [ ] ,
@@ -34,7 +34,7 @@ describe('getMethodDocumentation', () => {
34
34
}
35
35
` ) ;
36
36
const method = def . get ( 'body' , 'body' , 0 ) ;
37
- expect ( getMethodDocumentation ( method ) ) . toEqual ( {
37
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual ( {
38
38
name : 'hello' ,
39
39
docblock : null ,
40
40
modifiers : [ ] ,
@@ -50,7 +50,7 @@ describe('getMethodDocumentation', () => {
50
50
}
51
51
` ) ;
52
52
const method = def . get ( 'body' , 'body' , 0 ) ;
53
- expect ( getMethodDocumentation ( method ) ) . toMatchSnapshot ( ) ;
53
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toMatchSnapshot ( ) ;
54
54
} ) ;
55
55
56
56
it ( 'ignores complex computed method name' , ( ) => {
@@ -60,7 +60,7 @@ describe('getMethodDocumentation', () => {
60
60
}
61
61
` ) ;
62
62
const method = def . get ( 'body' , 'body' , 0 ) ;
63
- expect ( getMethodDocumentation ( method ) ) . toMatchSnapshot ( ) ;
63
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toMatchSnapshot ( ) ;
64
64
} ) ;
65
65
} ) ;
66
66
@@ -75,7 +75,7 @@ describe('getMethodDocumentation', () => {
75
75
}
76
76
` ) ;
77
77
const method = def . get ( 'body' , 'body' , 0 ) ;
78
- expect ( getMethodDocumentation ( method ) ) . toEqual ( {
78
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual ( {
79
79
name : 'foo' ,
80
80
docblock : "Don't use this!" ,
81
81
modifiers : [ ] ,
@@ -94,7 +94,7 @@ describe('getMethodDocumentation', () => {
94
94
}
95
95
` ) ;
96
96
const method = def . get ( 'body' , 'body' , 0 ) ;
97
- expect ( getMethodDocumentation ( method ) ) . toEqual ( {
97
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual ( {
98
98
name : 'foo' ,
99
99
docblock : "Don't use this!" ,
100
100
modifiers : [ ] ,
@@ -122,7 +122,7 @@ describe('getMethodDocumentation', () => {
122
122
}
123
123
` ) ;
124
124
const method = def . get ( 'body' , 'body' , 0 ) ;
125
- expect ( getMethodDocumentation ( method ) ) . toEqual (
125
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual (
126
126
methodParametersDoc ( [
127
127
{
128
128
name : 'bar' ,
@@ -139,7 +139,7 @@ describe('getMethodDocumentation', () => {
139
139
}
140
140
` ) ;
141
141
const method = def . get ( 'body' , 'body' , 0 ) ;
142
- expect ( getMethodDocumentation ( method ) ) . toEqual (
142
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual (
143
143
methodParametersDoc ( [
144
144
{
145
145
name : 'bar' ,
@@ -167,7 +167,9 @@ describe('getMethodDocumentation', () => {
167
167
}
168
168
` ) ;
169
169
const method = def . get ( 'body' , 'body' , 0 ) ;
170
- expect ( getMethodDocumentation ( method ) ) . toEqual ( methodModifiersDoc ( [ ] ) ) ;
170
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual (
171
+ methodModifiersDoc ( [ ] ) ,
172
+ ) ;
171
173
} ) ;
172
174
173
175
it ( 'detects static functions' , ( ) => {
@@ -177,7 +179,7 @@ describe('getMethodDocumentation', () => {
177
179
}
178
180
` ) ;
179
181
const method = def . get ( 'body' , 'body' , 0 ) ;
180
- expect ( getMethodDocumentation ( method ) ) . toEqual (
182
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual (
181
183
methodModifiersDoc ( [ 'static' ] ) ,
182
184
) ;
183
185
} ) ;
@@ -189,7 +191,7 @@ describe('getMethodDocumentation', () => {
189
191
}
190
192
` ) ;
191
193
const method = def . get ( 'body' , 'body' , 0 ) ;
192
- expect ( getMethodDocumentation ( method ) ) . toEqual (
194
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual (
193
195
methodModifiersDoc ( [ 'generator' ] ) ,
194
196
) ;
195
197
} ) ;
@@ -201,7 +203,7 @@ describe('getMethodDocumentation', () => {
201
203
}
202
204
` ) ;
203
205
const method = def . get ( 'body' , 'body' , 0 ) ;
204
- expect ( getMethodDocumentation ( method ) ) . toEqual (
206
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual (
205
207
methodModifiersDoc ( [ 'async' ] ) ,
206
208
) ;
207
209
} ) ;
@@ -213,7 +215,7 @@ describe('getMethodDocumentation', () => {
213
215
}
214
216
` ) ;
215
217
const method = def . get ( 'body' , 'body' , 0 ) ;
216
- expect ( getMethodDocumentation ( method ) ) . toEqual (
218
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual (
217
219
methodModifiersDoc ( [ 'static' , 'async' ] ) ,
218
220
) ;
219
221
} ) ;
@@ -237,7 +239,9 @@ describe('getMethodDocumentation', () => {
237
239
}
238
240
` ) ;
239
241
const method = def . get ( 'body' , 'body' , 0 ) ;
240
- expect ( getMethodDocumentation ( method ) ) . toEqual ( methodReturnDoc ( null ) ) ;
242
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual (
243
+ methodReturnDoc ( null ) ,
244
+ ) ;
241
245
} ) ;
242
246
243
247
it ( 'extracts flow types' , ( ) => {
@@ -247,7 +251,7 @@ describe('getMethodDocumentation', () => {
247
251
}
248
252
` ) ;
249
253
const method = def . get ( 'body' , 'body' , 0 ) ;
250
- expect ( getMethodDocumentation ( method ) ) . toEqual (
254
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual (
251
255
methodReturnDoc ( {
252
256
type : { name : 'number' } ,
253
257
} ) ,
@@ -261,7 +265,7 @@ describe('getMethodDocumentation', () => {
261
265
}
262
266
` ) ;
263
267
const method = def . get ( 'body' , 'body' , 0 ) ;
264
- expect ( getMethodDocumentation ( method ) ) . toEqual (
268
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toEqual (
265
269
methodReturnDoc ( {
266
270
type : { name : 'number' } ,
267
271
} ) ,
@@ -280,7 +284,7 @@ describe('getMethodDocumentation', () => {
280
284
{ parserOptions : { plugins : [ 'typescript' ] } } ,
281
285
) ;
282
286
const method = def . get ( 'body' , 'body' , 0 ) ;
283
- expect ( getMethodDocumentation ( method ) ) . toMatchSnapshot ( ) ;
287
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toMatchSnapshot ( ) ;
284
288
} ) ;
285
289
286
290
it . skip ( 'ignores private methods' , ( ) => {
@@ -293,7 +297,7 @@ describe('getMethodDocumentation', () => {
293
297
{ parserOptions : { plugins : [ 'classPrivateMethods' ] } } ,
294
298
) ;
295
299
const method = def . get ( 'body' , 'body' , 0 ) ;
296
- expect ( getMethodDocumentation ( method ) ) . toMatchSnapshot ( ) ;
300
+ expect ( getMethodDocumentation ( method , noopImporter ) ) . toMatchSnapshot ( ) ;
297
301
} ) ;
298
302
} ) ;
299
303
} ) ;
0 commit comments