Skip to content

Commit ac26902

Browse files
committed
add tests for getAccumulatedValueOfIndex
1 parent 86e2dd7 commit ac26902

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { expect } from '@open-wc/testing';
2+
import { getAccumulatedValueOfIndex } from './math.js';
3+
4+
describe('getAccumulatedValueOfIndex', () => {
5+
it('should return the accumulated value of an array up to a certain index', () => {
6+
expect(getAccumulatedValueOfIndex(0, [1, 2, 3, 4, 5])).to.equal(0);
7+
expect(getAccumulatedValueOfIndex(1, [1, 2, 3, 4, 5])).to.equal(1);
8+
expect(getAccumulatedValueOfIndex(2, [1, 2, 3, 4, 5])).to.equal(3);
9+
expect(getAccumulatedValueOfIndex(3, [1, 2, 3, 4, 5])).to.equal(6);
10+
expect(getAccumulatedValueOfIndex(4, [1, 2, 3, 4, 5])).to.equal(10);
11+
expect(getAccumulatedValueOfIndex(5, [1, 2, 3, 4, 5])).to.equal(15);
12+
});
13+
});

0 commit comments

Comments
 (0)