-
Notifications
You must be signed in to change notification settings - Fork 0
/
anagrams.test.js
29 lines (28 loc) · 1.1 KB
/
anagrams.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { checkAnagrams } = require('./anagrams.js')
it('works', () => {
expect(checkAnagrams('hello', 'olleh')).toBeTruthy()
expect(checkAnagrams('null', 'llun')).toBeTruthy()
expect(checkAnagrams('anagram', 'nag a ram')).toBeTruthy()
expect(checkAnagrams('anagram', 'nag a ram')).toBeTruthy()
expect(checkAnagrams('1333', '3331')).toBeTruthy()
expect(checkAnagrams('r', 'r')).toBeTruthy()
expect(checkAnagrams('vv', 'vv')).toBeTruthy()
expect(checkAnagrams('vvr', 'rvv')).toBeTruthy()
expect(checkAnagrams('debit card', 'bad credit')).toBeTruthy()
expect(checkAnagrams('school master', 'the classroom')).toBeTruthy()
expect(checkAnagrams('vvr', 'vrr')).toBeFalsy()
expect(checkAnagrams('hello', 'ollehs')).toBeFalsy()
expect(checkAnagrams('goodbye', 'bye')).toBeFalsy()
expect(() => {
checkAnagrams(undefined, null)
}).toThrow()
expect(() => {
checkAnagrams(' ', '')
}).toThrow()
expect(() => {
checkAnagrams(1333, 3331)
}).toThrow()
expect(() => {
checkAnagrams(['anagram'], ['nag a ram'])
}).toThrow()
})