Skip to content

Commit 7d0bb40

Browse files
authored
Merge pull request #601 from thivagar-manickam/master
Added test script for CreatePermutations and file name change
2 parents 3e5489d + 9f24341 commit 7d0bb40

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

String/createPurmutations.js renamed to String/CreatePermutations.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,4 @@ const createPermutations = (str) => {
3333
}
3434
return perms
3535
}
36-
37-
console.log(createPermutations('abc')) // should print ["abc", "acb", "bac", "bca", "cab", "cba"]
36+
export { createPermutations }
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { createPermutations } from '../CreatePermutations'
2+
3+
describe('createPermutations', () => {
4+
it('expects to generate 6 different combinations', () => {
5+
const text = 'abc'
6+
const SUT = createPermutations(text)
7+
expect(SUT).toStrictEqual(['abc', 'acb', 'bac', 'bca', 'cab', 'cba'])
8+
})
9+
it('expects to generate 2 different combinations', () => {
10+
const text = '12'
11+
const SUT = createPermutations(text)
12+
expect(SUT).toStrictEqual(['12', '21'])
13+
})
14+
})

0 commit comments

Comments
 (0)