Add test cases mentioned in #308

This commit is contained in:
casca 2020-01-30 21:32:49 +01:00 committed by GitHub
parent 3b9a3580d8
commit f6408ffb57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,16 @@ import combinationSum from '../combinationSum';
describe('combinationSum', () => { describe('combinationSum', () => {
it('should find all combinations with specific sum', () => { it('should find all combinations with specific sum', () => {
expect(combinationSum([1], 100000)).toHaveLength(1);
expect(
combinationSum([1], 100000)[0]
.every(el => el === 1),
)
.toBe(true);
expect(combinationSum([0, 2], 6)).toEqual([[2, 2, 2]]);
expect(combinationSum([1], 4)).toEqual([ expect(combinationSum([1], 4)).toEqual([
[1, 1, 1, 1], [1, 1, 1, 1],
]); ]);