1
1
import { parse , makeMockImporter } from '../../../tests/utils' ;
2
2
import Documentation from '../../Documentation' ;
3
- import flowTypeHandler from '../flowTypeHandler ' ;
3
+ import codeTypeHandler from '../codeTypeHandler ' ;
4
4
import type DocumentationMock from '../../__mocks__/Documentation' ;
5
5
import type {
6
6
ArrowFunctionExpression ,
@@ -18,7 +18,7 @@ jest.mock('../../utils/getFlowType', () => ({
18
18
__esModule : true ,
19
19
} ) ) ;
20
20
21
- describe ( 'flowTypeHandler ' , ( ) => {
21
+ describe ( 'codeTypeHandler ' , ( ) => {
22
22
let documentation : Documentation & DocumentationMock ;
23
23
24
24
beforeEach ( ( ) => {
@@ -61,7 +61,7 @@ describe('flowTypeHandler', () => {
61
61
` ;
62
62
const definition = getSrc ( flowTypesSrc ) ;
63
63
64
- flowTypeHandler ( documentation , definition ) ;
64
+ codeTypeHandler ( documentation , definition ) ;
65
65
66
66
expect ( documentation . descriptors ) . toEqual ( {
67
67
foo : {
@@ -91,7 +91,7 @@ describe('flowTypeHandler', () => {
91
91
` ;
92
92
const definition = getSrc ( flowTypesSrc ) ;
93
93
94
- flowTypeHandler ( documentation , definition ) ;
94
+ codeTypeHandler ( documentation , definition ) ;
95
95
96
96
expect ( documentation . descriptors ) . toEqual ( {
97
97
foo : {
@@ -116,7 +116,7 @@ describe('flowTypeHandler', () => {
116
116
` ;
117
117
const definition = getSrc ( flowTypesSrc ) ;
118
118
119
- flowTypeHandler ( documentation , definition ) ;
119
+ codeTypeHandler ( documentation , definition ) ;
120
120
121
121
expect ( documentation . descriptors ) . toMatchSnapshot ( ) ;
122
122
} ) ;
@@ -130,7 +130,7 @@ describe('flowTypeHandler', () => {
130
130
` ;
131
131
const definition = getSrc ( flowTypesSrc ) ;
132
132
133
- flowTypeHandler ( documentation , definition ) ;
133
+ codeTypeHandler ( documentation , definition ) ;
134
134
135
135
expect ( documentation . descriptors ) . toEqual ( {
136
136
foo : {
@@ -154,7 +154,7 @@ describe('flowTypeHandler', () => {
154
154
` ;
155
155
const definition = getSrc ( flowTypesSrc ) ;
156
156
157
- flowTypeHandler ( documentation , definition ) ;
157
+ codeTypeHandler ( documentation , definition ) ;
158
158
159
159
expect ( documentation . descriptors ) . toEqual ( {
160
160
foo : {
@@ -176,7 +176,7 @@ describe('flowTypeHandler', () => {
176
176
177
177
const definition = getSrc ( flowTypesSrc ) ;
178
178
179
- flowTypeHandler ( documentation , definition ) ;
179
+ codeTypeHandler ( documentation , definition ) ;
180
180
181
181
expect ( documentation . descriptors ) . toEqual ( {
182
182
foo : {
@@ -246,22 +246,22 @@ describe('flowTypeHandler', () => {
246
246
it ( 'ObjectExpression' , ( ) => {
247
247
const definition = parse . expression < ObjectExpression > ( '{fooBar: 42}' ) ;
248
248
249
- expect ( ( ) => flowTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
249
+ expect ( ( ) => codeTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
250
250
} ) ;
251
251
252
252
it ( 'ClassDeclaration' , ( ) => {
253
253
const definition = parse . statement < ClassDeclaration > (
254
254
'class Foo extends Component {}' ,
255
255
) ;
256
256
257
- expect ( ( ) => flowTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
257
+ expect ( ( ) => codeTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
258
258
} ) ;
259
259
260
260
it ( 'ArrowFunctionExpression' , ( ) => {
261
261
const definition =
262
262
parse . statement < ArrowFunctionExpression > ( '() => <div />' ) ;
263
263
264
- expect ( ( ) => flowTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
264
+ expect ( ( ) => codeTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
265
265
} ) ;
266
266
} ) ;
267
267
@@ -275,7 +275,7 @@ describe('flowTypeHandler', () => {
275
275
)
276
276
. get ( 'expression' ) as NodePath < ArrowFunctionExpression > ;
277
277
278
- flowTypeHandler ( documentation , definition ) ;
278
+ codeTypeHandler ( documentation , definition ) ;
279
279
280
280
expect ( documentation . descriptors ) . toEqual ( {
281
281
foo : {
@@ -295,7 +295,7 @@ describe('flowTypeHandler', () => {
295
295
)
296
296
. get ( 'expression' ) as NodePath < ArrowFunctionExpression > ;
297
297
298
- expect ( ( ) => flowTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
298
+ expect ( ( ) => codeTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
299
299
expect ( documentation . descriptors ) . toMatchSnapshot ( ) ;
300
300
} ) ;
301
301
@@ -310,7 +310,7 @@ describe('flowTypeHandler', () => {
310
310
)
311
311
. get ( 'expression' ) as NodePath < ArrowFunctionExpression > ;
312
312
313
- expect ( ( ) => flowTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
313
+ expect ( ( ) => codeTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
314
314
expect ( documentation . descriptors ) . toEqual ( { } ) ;
315
315
} ) ;
316
316
@@ -326,7 +326,7 @@ describe('flowTypeHandler', () => {
326
326
)
327
327
. get ( 'expression' ) as NodePath < ArrowFunctionExpression > ;
328
328
329
- expect ( ( ) => flowTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
329
+ expect ( ( ) => codeTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
330
330
expect ( documentation . descriptors ) . toEqual ( { } ) ;
331
331
} ) ;
332
332
@@ -341,7 +341,7 @@ describe('flowTypeHandler', () => {
341
341
)
342
342
. get ( 'expression' ) as NodePath < ArrowFunctionExpression > ;
343
343
344
- expect ( ( ) => flowTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
344
+ expect ( ( ) => codeTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
345
345
expect ( documentation . descriptors ) . toMatchSnapshot ( ) ;
346
346
} ) ;
347
347
@@ -355,7 +355,7 @@ describe('flowTypeHandler', () => {
355
355
)
356
356
. get ( 'expression' ) as NodePath < ArrowFunctionExpression > ;
357
357
358
- expect ( ( ) => flowTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
358
+ expect ( ( ) => codeTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
359
359
expect ( documentation . descriptors ) . toEqual ( { } ) ;
360
360
} ) ;
361
361
@@ -370,7 +370,7 @@ describe('flowTypeHandler', () => {
370
370
)
371
371
. get ( 'expression' ) as NodePath < ArrowFunctionExpression > ;
372
372
373
- expect ( ( ) => flowTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
373
+ expect ( ( ) => codeTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
374
374
expect ( documentation . descriptors ) . toMatchSnapshot ( ) ;
375
375
} ) ;
376
376
@@ -384,7 +384,7 @@ describe('flowTypeHandler', () => {
384
384
)
385
385
. get ( 'expression' ) as NodePath < ArrowFunctionExpression > ;
386
386
387
- expect ( ( ) => flowTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
387
+ expect ( ( ) => codeTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
388
388
expect ( documentation . descriptors ) . toEqual ( { } ) ;
389
389
} ) ;
390
390
@@ -398,7 +398,7 @@ describe('flowTypeHandler', () => {
398
398
)
399
399
. get ( 'expression' ) as NodePath < ArrowFunctionExpression > ;
400
400
401
- expect ( ( ) => flowTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
401
+ expect ( ( ) => codeTypeHandler ( documentation , definition ) ) . not . toThrow ( ) ;
402
402
expect ( documentation . descriptors ) . toEqual ( { } ) ;
403
403
} ) ;
404
404
} ) ;
@@ -410,7 +410,7 @@ describe('flowTypeHandler', () => {
410
410
type Props = { foo: string };
411
411
React.forwardRef((props: Props, ref) => <div ref={ref}>{props.foo}</div>);
412
412
` ;
413
- flowTypeHandler ( documentation , parse . expressionLast < CallExpression > ( src ) ) ;
413
+ codeTypeHandler ( documentation , parse . expressionLast < CallExpression > ( src ) ) ;
414
414
expect ( documentation . descriptors ) . toEqual ( {
415
415
foo : {
416
416
flowType : { } ,
@@ -427,7 +427,7 @@ describe('flowTypeHandler', () => {
427
427
const ComponentImpl = (props: Props, ref) => <div ref={ref}>{props.foo}</div>;
428
428
React.forwardRef(ComponentImpl);
429
429
` ;
430
- flowTypeHandler ( documentation , parse . expressionLast < CallExpression > ( src ) ) ;
430
+ codeTypeHandler ( documentation , parse . expressionLast < CallExpression > ( src ) ) ;
431
431
expect ( documentation . descriptors ) . toEqual ( {
432
432
foo : {
433
433
flowType : { } ,
@@ -444,7 +444,7 @@ describe('flowTypeHandler', () => {
444
444
let Component = (props: Props, ref) => <div ref={ref}>{props.foo}</div>;
445
445
Component = React.forwardRef(Component);
446
446
` ;
447
- flowTypeHandler (
447
+ codeTypeHandler (
448
448
documentation ,
449
449
parse . expressionLast ( src ) . get ( 'right' ) as NodePath < CallExpression > ,
450
450
) ;
0 commit comments