#69 : Add unit tests

This commit is contained in:
Vadim
2021-09-13 21:54:07 +03:00
parent 1f7afc7b7c
commit a203637456
2 changed files with 6 additions and 1 deletions

View File

@@ -157,7 +157,7 @@ export function getPartialPageSize({
while(true) { while(true) {
const diff = particlesCountWithoutClones - particlesCount - overlap const diff = particlesCountWithoutClones - particlesCount - overlap
if (diff < particlesToShow) { if (diff < particlesToShow) {
return diff return Math.max(diff, 0) // show: 2; scroll: 3, n: 5 => -1
} }
particlesCount += particlesToShow + overlap particlesCount += particlesToShow + overlap
} }

View File

@@ -40,6 +40,11 @@ describe('getPartialPageSize', () => {
particlesToShow: 2, particlesToShow: 2,
particlesToScroll: 2, particlesToScroll: 2,
expected: 0, expected: 0,
}, {
particlesCountWithoutClones: 5,
particlesToShow: 2,
particlesToScroll: 3,
expected: 0,
}] }]
testCases.forEach(({ testCases.forEach(({