|
8 | 8 |
|
9 | 9 | jest.mock('../resolveToValue');
|
10 | 10 |
|
11 |
| -import { statement } from '../../../tests/utils'; |
| 11 | +import { statement, noopImporter } from '../../../tests/utils'; |
12 | 12 | import resolveToValue from '../resolveToValue';
|
13 | 13 | import resolveExportDeclaration from '../resolveExportDeclaration';
|
14 | 14 |
|
15 | 15 | describe('resolveExportDeclaration', () => {
|
16 | 16 | const returnValue = {};
|
17 |
| - const ignoreImports = () => null; |
18 | 17 |
|
19 | 18 | beforeEach(() => {
|
20 | 19 | resolveToValue.mockReturnValue(returnValue);
|
21 | 20 | });
|
22 | 21 |
|
23 | 22 | it('resolves default exports', () => {
|
24 | 23 | const exp = statement('export default 42;');
|
25 |
| - const resolved = resolveExportDeclaration(exp, ignoreImports); |
| 24 | + const resolved = resolveExportDeclaration(exp, noopImporter); |
26 | 25 |
|
27 | 26 | expect(resolved).toEqual([returnValue]);
|
28 |
| - expect(resolveToValue).toBeCalledWith( |
29 |
| - exp.get('declaration'), |
30 |
| - ignoreImports, |
31 |
| - ); |
| 27 | + expect(resolveToValue).toBeCalledWith(exp.get('declaration'), noopImporter); |
32 | 28 | });
|
33 | 29 |
|
34 | 30 | it('resolves named exports', () => {
|
35 | 31 | let exp = statement('export var foo = 42, bar = 21;');
|
36 |
| - let resolved = resolveExportDeclaration(exp, ignoreImports); |
| 32 | + let resolved = resolveExportDeclaration(exp, noopImporter); |
37 | 33 |
|
38 | 34 | const declarations = exp.get('declaration', 'declarations');
|
39 | 35 | expect(resolved).toEqual([returnValue, returnValue]);
|
40 |
| - expect(resolveToValue).toBeCalledWith(declarations.get(0), ignoreImports); |
41 |
| - expect(resolveToValue).toBeCalledWith(declarations.get(1), ignoreImports); |
| 36 | + expect(resolveToValue).toBeCalledWith(declarations.get(0), noopImporter); |
| 37 | + expect(resolveToValue).toBeCalledWith(declarations.get(1), noopImporter); |
42 | 38 |
|
43 | 39 | exp = statement('export function foo(){}');
|
44 |
| - resolved = resolveExportDeclaration(exp, ignoreImports); |
| 40 | + resolved = resolveExportDeclaration(exp, noopImporter); |
45 | 41 |
|
46 | 42 | expect(resolved).toEqual([returnValue]);
|
47 |
| - expect(resolveToValue).toBeCalledWith( |
48 |
| - exp.get('declaration'), |
49 |
| - ignoreImports, |
50 |
| - ); |
| 43 | + expect(resolveToValue).toBeCalledWith(exp.get('declaration'), noopImporter); |
51 | 44 |
|
52 | 45 | exp = statement('export class Foo {}');
|
53 |
| - resolved = resolveExportDeclaration(exp, ignoreImports); |
| 46 | + resolved = resolveExportDeclaration(exp, noopImporter); |
54 | 47 |
|
55 | 48 | expect(resolved).toEqual([returnValue]);
|
56 |
| - expect(resolveToValue).toBeCalledWith( |
57 |
| - exp.get('declaration'), |
58 |
| - ignoreImports, |
59 |
| - ); |
| 49 | + expect(resolveToValue).toBeCalledWith(exp.get('declaration'), noopImporter); |
60 | 50 | });
|
61 | 51 |
|
62 | 52 | it('resolves named exports', () => {
|
63 | 53 | const exp = statement('export {foo, bar, baz}; var foo, bar, baz;');
|
64 |
| - const resolved = resolveExportDeclaration(exp, ignoreImports); |
| 54 | + const resolved = resolveExportDeclaration(exp, noopImporter); |
65 | 55 |
|
66 | 56 | const specifiers = exp.get('specifiers');
|
67 | 57 | expect(resolved).toEqual([returnValue, returnValue, returnValue]);
|
68 | 58 | expect(resolveToValue).toBeCalledWith(
|
69 | 59 | specifiers.get(0, 'local'),
|
70 |
| - ignoreImports, |
| 60 | + noopImporter, |
71 | 61 | );
|
72 | 62 | expect(resolveToValue).toBeCalledWith(
|
73 | 63 | specifiers.get(1, 'local'),
|
74 |
| - ignoreImports, |
| 64 | + noopImporter, |
75 | 65 | );
|
76 | 66 | expect(resolveToValue).toBeCalledWith(
|
77 | 67 | specifiers.get(2, 'local'),
|
78 |
| - ignoreImports, |
| 68 | + noopImporter, |
79 | 69 | );
|
80 | 70 | });
|
81 | 71 | });
|
0 commit comments