-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspace-age.spec.js
56 lines (46 loc) · 1.48 KB
/
space-age.spec.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
55
import SpaceAge from './space-age';
describe('Space Age', () => {
test('age in seconds', () => {
const age = new SpaceAge(1000000);
expect(age.seconds).toEqual(1000000);
});
test('age in earth years', () => {
const age = new SpaceAge(1000000000);
expect(age.onEarth()).toEqual(31.69);
});
test('age in mercury years', () => {
const age = new SpaceAge(2134835688);
expect(age.onEarth()).toEqual(67.65);
expect(age.onMercury()).toEqual(280.88);
});
test('age in venus years', () => {
const age = new SpaceAge(189839836);
expect(age.onEarth()).toEqual(6.02);
expect(age.onVenus()).toEqual(9.78);
});
test('age in mars years', () => {
const age = new SpaceAge(2329871239);
expect(age.onEarth()).toEqual(73.83);
expect(age.onMars()).toEqual(39.25);
});
test('age in jupiter years', () => {
const age = new SpaceAge(901876382);
expect(age.onEarth()).toEqual(28.58);
expect(age.onJupiter()).toEqual(2.41);
});
test('age in saturn years', () => {
const age = new SpaceAge(3000000000);
expect(age.onEarth()).toEqual(95.06);
expect(age.onSaturn()).toEqual(3.23);
});
test('age in uranus years', () => {
const age = new SpaceAge(3210123456);
expect(age.onEarth()).toEqual(101.72);
expect(age.onUranus()).toEqual(1.21);
});
test('age in neptune year', () => {
const age = new SpaceAge(8210123456);
expect(age.onEarth()).toEqual(260.16);
expect(age.onNeptune()).toEqual(1.58);
});
});