8
8
*
9
9
*/
10
10
11
- /*global jest, describe, beforeEach, it, expect*/
11
+ /*global jest, describe, it, expect*/
12
12
13
- jest . unmock ( '../getMemberValuePath' ) ;
13
+ jest . mock ( '../getPropertyValuePath' ) ;
14
+ jest . mock ( '../getClassMemberValuePath' ) ;
14
15
15
- describe ( 'getMemberValuePath' , ( ) => {
16
- var getMemberValuePath ;
17
- var expression , statement ;
16
+ import { expression , statement } from '../../../tests/utils' ;
18
17
19
- beforeEach ( ( ) => {
20
- ( { expression, statement} = require ( '../../../tests/utils' ) ) ;
21
- getMemberValuePath = require ( '../getMemberValuePath' ) . default ;
22
- } ) ;
18
+ import getPropertyValuePath from '../getPropertyValuePath' ;
19
+ import getClassMemberValuePath from '../getClassMemberValuePath' ;
20
+ import getMemberValuePath from '../getMemberValuePath' ;
21
+
22
+ describe ( 'getMemberValuePath' , ( ) => {
23
23
24
24
it ( 'handles ObjectExpresisons' , ( ) => {
25
- var getPropertyValuePath = require ( '../getPropertyValuePath' ) . default ;
26
25
var path = expression ( '{}' ) ;
27
26
28
27
getMemberValuePath ( path , 'foo' ) ;
29
28
expect ( getPropertyValuePath ) . toBeCalledWith ( path , 'foo' ) ;
30
29
} ) ;
31
30
32
31
it ( 'handles ClassDeclarations' , ( ) => {
33
- var getClassMemberValuePath = require ( '../getClassMemberValuePath' ) . default ;
34
32
var path = statement ( 'class Foo {}' ) ;
35
33
36
34
getMemberValuePath ( path , 'foo' ) ;
37
35
expect ( getClassMemberValuePath ) . toBeCalledWith ( path , 'foo' ) ;
38
36
} ) ;
39
37
40
38
it ( 'handles ClassExpressions' , ( ) => {
41
- var getClassMemberValuePath = require ( '../getClassMemberValuePath' ) . default ;
42
39
var path = expression ( 'class {}' ) ;
43
40
44
41
getMemberValuePath ( path , 'foo' ) ;
45
42
expect ( getClassMemberValuePath ) . toBeCalledWith ( path , 'foo' ) ;
46
43
} ) ;
47
44
48
45
it ( 'tries synonyms' , ( ) => {
49
- var getPropertyValuePath = require ( '../getPropertyValuePath' ) . default ;
50
- var getClassMemberValuePath = require ( '../getClassMemberValuePath' ) . default ;
51
46
var path = expression ( '{}' ) ;
52
47
53
48
getMemberValuePath ( path , 'defaultProps' ) ;
@@ -62,8 +57,6 @@ describe('getMemberValuePath', () => {
62
57
} ) ;
63
58
64
59
it ( 'returns the result of getPropertyValuePath and getClassMemberValuePath' , ( ) => {
65
- var getPropertyValuePath = require ( '../getPropertyValuePath' ) . default ;
66
- var getClassMemberValuePath = require ( '../getClassMemberValuePath' ) . default ;
67
60
getPropertyValuePath . mockReturnValue ( 42 ) ;
68
61
getClassMemberValuePath . mockReturnValue ( 21 ) ;
69
62
var path = expression ( '{}' ) ;
@@ -74,4 +67,5 @@ describe('getMemberValuePath', () => {
74
67
75
68
expect ( getMemberValuePath ( path , 'defaultProps' ) ) . toBe ( 21 ) ;
76
69
} ) ;
70
+
77
71
} ) ;
0 commit comments