Skip to content

Commit aadc9ae

Browse files
author
Christoph Bühler
committed
add test for imports isNew()
1 parent 06fc66a commit aadc9ae

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

test/imports/Imports.spec.ts

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import { DefaultImport, ExternalModuleImport, NamedImport, NamespaceImport, StringImport } from '../../src/imports';
2+
3+
describe('Imports', () => {
4+
5+
describe('DefaultImport', () => {
6+
7+
it('should set isNew() when start is undefined', () => {
8+
const imp = new DefaultImport('lib', 'alias', undefined, 1337);
9+
expect(imp.isNew).toBeTruthy();
10+
});
11+
12+
it('should set isNew() when end is undefined', () => {
13+
const imp = new DefaultImport('lib', 'alias', 1337);
14+
expect(imp.isNew).toBeTruthy();
15+
});
16+
17+
it('should not set isNew() when start and end are defined', () => {
18+
const imp = new DefaultImport('lib', 'alias', 12, 1337);
19+
expect(imp.isNew).toBeFalsy();
20+
});
21+
22+
});
23+
24+
describe('ExternalModuleImport', () => {
25+
26+
it('should set isNew() when start is undefined', () => {
27+
const imp = new ExternalModuleImport('lib', 'alias', undefined, 1337);
28+
expect(imp.isNew).toBeTruthy();
29+
});
30+
31+
it('should set isNew() when end is undefined', () => {
32+
const imp = new ExternalModuleImport('lib', 'alias', 1337);
33+
expect(imp.isNew).toBeTruthy();
34+
});
35+
36+
it('should not set isNew() when start and end are defined', () => {
37+
const imp = new ExternalModuleImport('lib', 'alias', 12, 1337);
38+
expect(imp.isNew).toBeFalsy();
39+
});
40+
41+
});
42+
43+
describe('NamedImport', () => {
44+
45+
it('should set isNew() when start is undefined', () => {
46+
const imp = new NamedImport('lib', undefined, 1337);
47+
expect(imp.isNew).toBeTruthy();
48+
});
49+
50+
it('should set isNew() when end is undefined', () => {
51+
const imp = new NamedImport('lib', 1337);
52+
expect(imp.isNew).toBeTruthy();
53+
});
54+
55+
it('should not set isNew() when start and end are defined', () => {
56+
const imp = new NamedImport('lib', 12, 1337);
57+
expect(imp.isNew).toBeFalsy();
58+
});
59+
60+
});
61+
62+
describe('NamespaceImport', () => {
63+
64+
it('should set isNew() when start is undefined', () => {
65+
const imp = new NamespaceImport('lib', 'alias', undefined, 1337);
66+
expect(imp.isNew).toBeTruthy();
67+
});
68+
69+
it('should set isNew() when end is undefined', () => {
70+
const imp = new NamespaceImport('lib', 'alias', 1337);
71+
expect(imp.isNew).toBeTruthy();
72+
});
73+
74+
it('should not set isNew() when start and end are defined', () => {
75+
const imp = new NamespaceImport('lib', 'alias', 12, 1337);
76+
expect(imp.isNew).toBeFalsy();
77+
});
78+
79+
});
80+
81+
describe('StringImport', () => {
82+
83+
it('should set isNew() when start is undefined', () => {
84+
const imp = new StringImport('lib', undefined, 1337);
85+
expect(imp.isNew).toBeTruthy();
86+
});
87+
88+
it('should set isNew() when end is undefined', () => {
89+
const imp = new StringImport('lib', 1337);
90+
expect(imp.isNew).toBeTruthy();
91+
});
92+
93+
it('should not set isNew() when start and end are defined', () => {
94+
const imp = new StringImport('lib', 12, 1337);
95+
expect(imp.isNew).toBeFalsy();
96+
});
97+
98+
});
99+
100+
});

0 commit comments

Comments
 (0)