Testing Grid Path Calculations in javascript-algorithms
This test suite validates the uniquePaths algorithm implementation which calculates the number of possible unique paths through a grid matrix. The tests verify path calculations for various grid dimensions, ensuring the algorithm correctly handles both small and large matrices.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
trekhleb/javascript-algorithms
src/algorithms/uncategorized/unique-paths/__test__/uniquePaths.test.js
import uniquePaths from '../uniquePaths';
describe('uniquePaths', () => {
it('should find the number of unique paths on board', () => {
expect(uniquePaths(3, 2)).toBe(3);
expect(uniquePaths(7, 3)).toBe(28);
expect(uniquePaths(3, 7)).toBe(28);
expect(uniquePaths(10, 10)).toBe(48620);
expect(uniquePaths(100, 1)).toBe(1);
expect(uniquePaths(1, 100)).toBe(1);
});
});