-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.ts
More file actions
110 lines (85 loc) · 2.61 KB
/
index.test.ts
File metadata and controls
110 lines (85 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { join } from 'path';
import parse from '../src';
import { IMaterializeOptions } from '../src/types';
import { getFromFixtures } from './helpers';
const multiExportedComptPath = getFromFixtures('multiple-exported-component');
const singleExportedComptPath = getFromFixtures('single-exported-component');
const tsComponent = getFromFixtures('ts-component');
const tsComponent2 = getFromFixtures('ts-component2');
const dtsComponent = getFromFixtures('dts-component');
const transpiledComponent = getFromFixtures('transpiled-component');
const withoutDisplayName = getFromFixtures('without-display-name');
test('materialize single exported component by local', async done => {
const options: IMaterializeOptions = {
entry: singleExportedComptPath,
accesser: 'local',
};
const actual = await parse(options);
expect(actual).toMatchSnapshot();
done();
});
test('materialize multiple exported component by local', async done => {
const options: IMaterializeOptions = {
entry: multiExportedComptPath,
accesser: 'local',
};
const actual = await parse(options);
expect(actual).toMatchSnapshot();
done();
});
test('ts component by local', async done => {
const options: IMaterializeOptions = {
entry: tsComponent,
accesser: 'local',
};
const actual = await parse(options);
expect(actual).toMatchSnapshot();
done();
});
test('ts component 2 by local', async done => {
const options: IMaterializeOptions = {
entry: tsComponent2,
accesser: 'local',
};
const actual = await parse(options);
expect(actual).toMatchSnapshot();
done();
});
test('rax component by local', async done => {
const options: IMaterializeOptions = {
entry: 'src/index.tsx',
root: getFromFixtures('rax-component'),
accesser: 'local',
};
const actual = await parse(options);
expect(actual).toMatchSnapshot();
done();
});
test('d.ts component by local', async done => {
const options: IMaterializeOptions = {
entry: join(dtsComponent, 'src/index.jsx'),
root: dtsComponent,
accesser: 'local',
};
const actual = await parse(options);
expect(actual).toMatchSnapshot();
done();
});
test('transpiled component by local', async done => {
const options: IMaterializeOptions = {
entry: transpiledComponent,
accesser: 'local',
};
const actual = await parse(options);
expect(actual).toMatchSnapshot();
done();
});
test('without display name by local', async done => {
const options: IMaterializeOptions = {
entry: withoutDisplayName,
accesser: 'local',
};
const actual = await parse(options);
expect(actual).toMatchSnapshot();
done();
});