Skip to content

Commit 4fe3689

Browse files
committed
add tests
1 parent 81579e4 commit 4fe3689

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { expect } from '@open-wc/testing';
2+
import { calculateExtrapolatedValue } from './math.js';
3+
4+
describe('calculateExtrapolatedValue', () => {
5+
it('should return NaN if the increase factor is less than 0', () => {
6+
expect(calculateExtrapolatedValue(1, -1)).to.be.NaN;
7+
});
8+
9+
it('should return NaN if the increase factor is equal to 1', () => {
10+
expect(calculateExtrapolatedValue(1, 1)).to.be.NaN;
11+
});
12+
13+
it('should return the extrapolated value', () => {
14+
expect(calculateExtrapolatedValue(1, 0)).to.equal(1);
15+
expect(calculateExtrapolatedValue(1, 0.3)).to.equal(1.4285714285714286);
16+
expect(calculateExtrapolatedValue(2, 0.5)).to.equal(4);
17+
expect(calculateExtrapolatedValue(3, 0.6)).to.equal(7.5);
18+
expect(calculateExtrapolatedValue(100, 0.2)).to.equal(125);
19+
expect(calculateExtrapolatedValue(500, 0.99)).to.equal(49999.999999999956);
20+
});
21+
});

0 commit comments

Comments
 (0)