Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9f24341

Browse files
Added test script for CreatePermutations and file name change
1 parent 3e5489d commit 9f24341

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)

AltStyle によって変換されたページ (->オリジナル) /