/
util.test.ts
45 lines (40 loc) · 974 Bytes
/
util.test.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
import * as util from '../src/util';
describe('isDefinitionFile', () => {
describe('returns false for non-definition files', () => {
const invalid = [
'test.js',
'test.jsx',
'README.md',
'test.d.js',
'test.ts.js',
'test.ts.map',
'test.ts-js',
'test.ts',
'ts',
'test.tsx',
'test.TS',
'test.TSX',
// yes, it's not a definition file if it's a `.d.tsx`!
'test.d.tsx',
'test.D.TSX',
];
invalid.forEach(f => {
it(f, () => {
expect(util.isDefinitionFile(f)).toBe(false);
});
});
});
describe('returns true for definition files', () => {
const valid = ['test.d.ts', 'test.D.TS'];
valid.forEach(f => {
it(f, () => {
expect(util.isDefinitionFile(f)).toBe(true);
});
});
});
});
describe('upperCaseFirst', () => {
it('upper cases first', () => {
expect(util.upperCaseFirst('hello')).toBe('Hello');
});
});