Testing Grid Path Calculation Algorithm in javascript-algorithms
This test suite validates the btUniquePaths algorithm implementation for calculating unique paths on a grid board. It verifies the algorithm’s ability to determine the number of possible paths from the top-left to bottom-right corner of an m×n grid, moving only right and down.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
trekhleb/javascript-algorithms
src/algorithms/uncategorized/unique-paths/__test__/btUniquePaths.test.js
import btUniquePaths from '../btUniquePaths';
describe('btUniquePaths', () => {
it('should find the number of unique paths on board', () => {
expect(btUniquePaths(3, 2)).toBe(3);
expect(btUniquePaths(7, 3)).toBe(28);
expect(btUniquePaths(3, 7)).toBe(28);
expect(btUniquePaths(10, 10)).toBe(48620);
expect(btUniquePaths(100, 1)).toBe(1);
expect(btUniquePaths(1, 100)).toBe(1);
});
});