Skip to content

Commit e86d846

Browse files
phateddanez
authored andcommitted
Add noop importer to getMethodDocumentation tests
1 parent 26ad447 commit e86d846

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

src/utils/__tests__/getMethodDocumentation-test.js

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*/
88

9-
import { statement } from '../../../tests/utils';
9+
import { statement, noopImporter } from '../../../tests/utils';
1010
import getMethodDocumentation from '../getMethodDocumentation';
1111

1212
describe('getMethodDocumentation', () => {
@@ -18,7 +18,7 @@ describe('getMethodDocumentation', () => {
1818
}
1919
`);
2020
const method = def.get('body', 'body', 0);
21-
expect(getMethodDocumentation(method)).toEqual({
21+
expect(getMethodDocumentation(method, noopImporter)).toEqual({
2222
name: 'hello',
2323
docblock: null,
2424
modifiers: [],
@@ -34,7 +34,7 @@ describe('getMethodDocumentation', () => {
3434
}
3535
`);
3636
const method = def.get('body', 'body', 0);
37-
expect(getMethodDocumentation(method)).toEqual({
37+
expect(getMethodDocumentation(method, noopImporter)).toEqual({
3838
name: 'hello',
3939
docblock: null,
4040
modifiers: [],
@@ -50,7 +50,7 @@ describe('getMethodDocumentation', () => {
5050
}
5151
`);
5252
const method = def.get('body', 'body', 0);
53-
expect(getMethodDocumentation(method)).toMatchSnapshot();
53+
expect(getMethodDocumentation(method, noopImporter)).toMatchSnapshot();
5454
});
5555

5656
it('ignores complex computed method name', () => {
@@ -60,7 +60,7 @@ describe('getMethodDocumentation', () => {
6060
}
6161
`);
6262
const method = def.get('body', 'body', 0);
63-
expect(getMethodDocumentation(method)).toMatchSnapshot();
63+
expect(getMethodDocumentation(method, noopImporter)).toMatchSnapshot();
6464
});
6565
});
6666

@@ -75,7 +75,7 @@ describe('getMethodDocumentation', () => {
7575
}
7676
`);
7777
const method = def.get('body', 'body', 0);
78-
expect(getMethodDocumentation(method)).toEqual({
78+
expect(getMethodDocumentation(method, noopImporter)).toEqual({
7979
name: 'foo',
8080
docblock: "Don't use this!",
8181
modifiers: [],
@@ -94,7 +94,7 @@ describe('getMethodDocumentation', () => {
9494
}
9595
`);
9696
const method = def.get('body', 'body', 0);
97-
expect(getMethodDocumentation(method)).toEqual({
97+
expect(getMethodDocumentation(method, noopImporter)).toEqual({
9898
name: 'foo',
9999
docblock: "Don't use this!",
100100
modifiers: [],
@@ -122,7 +122,7 @@ describe('getMethodDocumentation', () => {
122122
}
123123
`);
124124
const method = def.get('body', 'body', 0);
125-
expect(getMethodDocumentation(method)).toEqual(
125+
expect(getMethodDocumentation(method, noopImporter)).toEqual(
126126
methodParametersDoc([
127127
{
128128
name: 'bar',
@@ -139,7 +139,7 @@ describe('getMethodDocumentation', () => {
139139
}
140140
`);
141141
const method = def.get('body', 'body', 0);
142-
expect(getMethodDocumentation(method)).toEqual(
142+
expect(getMethodDocumentation(method, noopImporter)).toEqual(
143143
methodParametersDoc([
144144
{
145145
name: 'bar',
@@ -167,7 +167,9 @@ describe('getMethodDocumentation', () => {
167167
}
168168
`);
169169
const method = def.get('body', 'body', 0);
170-
expect(getMethodDocumentation(method)).toEqual(methodModifiersDoc([]));
170+
expect(getMethodDocumentation(method, noopImporter)).toEqual(
171+
methodModifiersDoc([]),
172+
);
171173
});
172174

173175
it('detects static functions', () => {
@@ -177,7 +179,7 @@ describe('getMethodDocumentation', () => {
177179
}
178180
`);
179181
const method = def.get('body', 'body', 0);
180-
expect(getMethodDocumentation(method)).toEqual(
182+
expect(getMethodDocumentation(method, noopImporter)).toEqual(
181183
methodModifiersDoc(['static']),
182184
);
183185
});
@@ -189,7 +191,7 @@ describe('getMethodDocumentation', () => {
189191
}
190192
`);
191193
const method = def.get('body', 'body', 0);
192-
expect(getMethodDocumentation(method)).toEqual(
194+
expect(getMethodDocumentation(method, noopImporter)).toEqual(
193195
methodModifiersDoc(['generator']),
194196
);
195197
});
@@ -201,7 +203,7 @@ describe('getMethodDocumentation', () => {
201203
}
202204
`);
203205
const method = def.get('body', 'body', 0);
204-
expect(getMethodDocumentation(method)).toEqual(
206+
expect(getMethodDocumentation(method, noopImporter)).toEqual(
205207
methodModifiersDoc(['async']),
206208
);
207209
});
@@ -213,7 +215,7 @@ describe('getMethodDocumentation', () => {
213215
}
214216
`);
215217
const method = def.get('body', 'body', 0);
216-
expect(getMethodDocumentation(method)).toEqual(
218+
expect(getMethodDocumentation(method, noopImporter)).toEqual(
217219
methodModifiersDoc(['static', 'async']),
218220
);
219221
});
@@ -237,7 +239,9 @@ describe('getMethodDocumentation', () => {
237239
}
238240
`);
239241
const method = def.get('body', 'body', 0);
240-
expect(getMethodDocumentation(method)).toEqual(methodReturnDoc(null));
242+
expect(getMethodDocumentation(method, noopImporter)).toEqual(
243+
methodReturnDoc(null),
244+
);
241245
});
242246

243247
it('extracts flow types', () => {
@@ -247,7 +251,7 @@ describe('getMethodDocumentation', () => {
247251
}
248252
`);
249253
const method = def.get('body', 'body', 0);
250-
expect(getMethodDocumentation(method)).toEqual(
254+
expect(getMethodDocumentation(method, noopImporter)).toEqual(
251255
methodReturnDoc({
252256
type: { name: 'number' },
253257
}),
@@ -261,7 +265,7 @@ describe('getMethodDocumentation', () => {
261265
}
262266
`);
263267
const method = def.get('body', 'body', 0);
264-
expect(getMethodDocumentation(method)).toEqual(
268+
expect(getMethodDocumentation(method, noopImporter)).toEqual(
265269
methodReturnDoc({
266270
type: { name: 'number' },
267271
}),
@@ -280,7 +284,7 @@ describe('getMethodDocumentation', () => {
280284
{ parserOptions: { plugins: ['typescript'] } },
281285
);
282286
const method = def.get('body', 'body', 0);
283-
expect(getMethodDocumentation(method)).toMatchSnapshot();
287+
expect(getMethodDocumentation(method, noopImporter)).toMatchSnapshot();
284288
});
285289

286290
it.skip('ignores private methods', () => {
@@ -293,7 +297,7 @@ describe('getMethodDocumentation', () => {
293297
{ parserOptions: { plugins: ['classPrivateMethods'] } },
294298
);
295299
const method = def.get('body', 'body', 0);
296-
expect(getMethodDocumentation(method)).toMatchSnapshot();
300+
expect(getMethodDocumentation(method, noopImporter)).toMatchSnapshot();
297301
});
298302
});
299303
});

0 commit comments

Comments
 (0)