-
Notifications
You must be signed in to change notification settings - Fork 0
/
converter.test.js
54 lines (50 loc) · 2.26 KB
/
converter.test.js
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 converter from './converter';
describe('converter', () => {
test('is a function', () => {
expect(typeof converter).toEqual('function');
});
test('correctly names 0', () => {
expect(converter('0')).toEqual('zero');
expect(converter('00000000')).toEqual('zero');
});
test('correctly names negative numbers', () => {
expect(converter('-2')).toEqual('minus two');
expect(converter('-10')).toEqual('minus ten');
expect(converter('-305')).toEqual('minus three hundred and five');
expect(converter('-985478')).toEqual(
'minus nine hundred and eighty-five thousand four hundred and seventy-eight'
);
expect(converter('-63204019')).toEqual(
'minus sixty-three million two hundred and four thousand and nineteen'
);
expect(converter('-1023024870')).toEqual(
'minus one billion twenty-three million twenty-four thousand eight hundred and seventy'
);
expect(converter('-500000365201254')).toEqual(
'minus five hundred trillion three hundred and sixty-five million two hundred and one thousand two hundred and fifty-four'
);
expect(converter('-66000320487965001')).toEqual(
'minus sixty-six quadrillion three hundred and twenty billion four hundred and eighty-seven million nine hundred and sixty-five thousand and one'
);
});
test('correctly names positive numbers', () => {
expect(converter('2')).toEqual('two');
expect(converter('10')).toEqual('ten');
expect(converter('305')).toEqual('three hundred and five');
expect(converter('985478')).toEqual(
'nine hundred and eighty-five thousand four hundred and seventy-eight'
);
expect(converter('63204019')).toEqual(
'sixty-three million two hundred and four thousand and nineteen'
);
expect(converter('1023024870')).toEqual(
'one billion twenty-three million twenty-four thousand eight hundred and seventy'
);
expect(converter('500000365201254')).toEqual(
'five hundred trillion three hundred and sixty-five million two hundred and one thousand two hundred and fifty-four'
);
expect(converter('66000320487965001')).toEqual(
'sixty-six quadrillion three hundred and twenty billion four hundred and eighty-seven million nine hundred and sixty-five thousand and one'
);
});
});