mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-07 02:05:08 +08:00
Fix GeneratePermutations so that it actually returns the permutations instead of logging them + add Jest test.
This commit is contained in:
14
Backtracking/tests/GeneratePermutations.test.js
Normal file
14
Backtracking/tests/GeneratePermutations.test.js
Normal file
@ -0,0 +1,14 @@
|
||||
import { permutations } from '../GeneratePermutations'
|
||||
|
||||
describe('Permutations', () => {
|
||||
it('Permutations of [1, 2, 3]', () => {
|
||||
expect(permutations([1, 2, 3])).toEqual([
|
||||
[ 1, 2, 3 ],
|
||||
[ 1, 3, 2 ],
|
||||
[ 2, 1, 3 ],
|
||||
[ 2, 3, 1 ],
|
||||
[ 3, 1, 2 ],
|
||||
[ 3, 2, 1 ]
|
||||
])
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user