Skip to content

Commit e240332

Browse files
authored
Create Fraction.test.js
1 parent a5f3c3f commit e240332

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Maths/test/Fraction.test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { fraction } from './../Fraction.js';
2+
3+
describe('Fraction', () => {
4+
it('should return [1, 2] for 0.5', () => {
5+
expect(fraction(0.5)).toEqual([1, 2]);
6+
});
7+
it('should return [1, 3] for 0.3333333333333333', () => {
8+
expect(fraction(0.3333333333333333)).toEqual([1, 3]);
9+
});
10+
it('should return [1, 4] for 0.25', () => {
11+
expect(fraction(0.25)).toEqual([1, 4]);
12+
});
13+
it('should return [139, 25] for 5.56', () => {
14+
expect(fraction(5.56)).toEqual([139, 25]);
15+
});
16+
it('should return [33, 100] for 0.33', () => {
17+
expect(fraction(0.33)).toEqual([33, 100]);
18+
});
19+
it('should return [5, 1] for 1', () => {
20+
expect(fraction(5)).toEqual([5, 1]);
21+
});
22+
it('should return [3333, 1000] for 3.333', () => {
23+
expect(fraction(3.33)).toEqual([333, 100]);
24+
});
25+
it('should return [1, 3] for 0.3333', () => {
26+
expect(fraction(0.3333, 3)).toEqual([1, 3]);
27+
});
28+
});

0 commit comments

Comments
 (0)