-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathexports.spec.ts
54 lines (49 loc) · 2.3 KB
/
exports.spec.ts
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
import { Run } from '../src/compiler';
import { expect } from 'chai';
import { describe, it } from 'mocha';
describe('Export', () => {
it('Class export', () => expect('false\r\n').to.equals(new Run().test([
'export class ZipCodeValidator { \
isAcceptable(s: string): boolean { \
return false; \
} \
} \
',
'import { ZipCodeValidator } from "./test0"; \
const myValidator = new ZipCodeValidator(); \
console.log(myValidator.isAcceptable("test")); \
'])));
it('Class export (import as)', () => expect('false\r\n').to.equals(new Run().test([
'export class ZipCodeValidator { \
isAcceptable(s: string): boolean { \
return false; \
} \
} \
',
'import { ZipCodeValidator as ZCV } from "./test0"; \
const myValidator = new ZCV(); \
console.log(myValidator.isAcceptable("test")); \
'])));
it('Class export (default)', () => expect('false\r\n').to.equals(new Run().test([
'export default class ZipCodeValidator { \
isAcceptable(s: string): boolean { \
return false; \
} \
} \
',
'import validator from "./test0"; \
const myValidator = new validator(); \
console.log(myValidator.isAcceptable("test")); \
'])));
it('Class export - alias', () => expect('false\r\n').to.equals(new Run().test([
'export class ZipCodeValidator { \
isAcceptable(s: string): boolean { \
return false; \
} \
} \
',
'import * as Test from "./test0"; \
const myValidator = new Test.ZipCodeValidator();\
console.log(myValidator.isAcceptable("test")); \
'])));
});