@@ -18,7 +18,7 @@ test.afterEach(() => {
18
18
console . error = orignalConsoleError ;
19
19
} ) ;
20
20
21
- test ( 'In case of error during type inference the error information should be retained' , t => {
21
+ test ( 'In case of error during shape type inference the error information should be retained' , t => {
22
22
react2dts . generateFromSource ( null , `
23
23
import React from 'react';
24
24
@@ -32,3 +32,48 @@ test('In case of error during type inference the error information should be ret
32
32
const idx = args . indexOf ( 'Line 6: someShape: React.PropTypes.shape(shape)' ) ;
33
33
t . is ( idx , 1 ) ;
34
34
} ) ;
35
+
36
+ test ( 'In case of error during enum type inference the error information should be retained' , t => {
37
+ react2dts . generateFromSource ( null , `
38
+ import React from 'react';
39
+
40
+ export class Component extends React.Component {
41
+ static propTypes = {
42
+ list: React.PropTypes.oneOf(list)
43
+ };
44
+ }
45
+ ` ) ;
46
+ const args = t . context . args . reduce ( ( akku : any [ ] , args : any [ ] ) => [ ...akku , ...args ] , [ ] ) ;
47
+ const idx = args . indexOf ( 'Line 6: list: React.PropTypes.oneOf(list)' ) ;
48
+ t . is ( idx , 1 ) ;
49
+ } ) ;
50
+
51
+ test ( 'In case of error during enum value creation inference the error information should be retained' , t => {
52
+ react2dts . generateFromSource ( null , `
53
+ import React from 'react';
54
+
55
+ export class Component extends React.Component {
56
+ static propTypes = {
57
+ list: React.PropTypes.oneOf(Object.keys(object))
58
+ };
59
+ }
60
+ ` ) ;
61
+ const args = t . context . args . reduce ( ( akku : any [ ] , args : any [ ] ) => [ ...akku , ...args ] , [ ] ) ;
62
+ const idx = args . indexOf ( 'Line 6: list: React.PropTypes.oneOf(Object.keys(object))' ) ;
63
+ t . is ( idx , 1 ) ;
64
+ } ) ;
65
+
66
+ test ( 'In case of error during shape type inference the error information should be retained' , t => {
67
+ react2dts . generateFromSource ( null , `
68
+ import React from 'react';
69
+
70
+ export class Component extends React.Component {
71
+ static propTypes = {
72
+ shape: React.PropTypes.shape(some.shape)
73
+ };
74
+ }
75
+ ` ) ;
76
+ const args = t . context . args . reduce ( ( akku : any [ ] , args : any [ ] ) => [ ...akku , ...args ] , [ ] ) ;
77
+ const idx = args . indexOf ( 'Line 6: shape: React.PropTypes.shape(some.shape)' ) ;
78
+ t . is ( idx , 1 ) ;
79
+ } ) ;
0 commit comments