forked from TheAlgorithms/JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCheckPangram.test.js
65 lines (53 loc) · 2.07 KB
/
CheckPangram.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { checkPangramRegex, checkPangramSet } from '../CheckPangram'
describe('Testing checkPangramRegex function', () => {
it('"The quick brown fox jumps over the lazy dog" is a pangram', () => {
expect(
checkPangramRegex('The quick brown fox jumps over the lazy dog')
).toBe(true)
})
it('"Waltz, bad nymph, for quick jigs vex." is a pangram', () => {
expect(checkPangramRegex('Waltz, bad nymph, for quick jigs vex.')).toBe(true)
})
it('"Jived fox nymph grabs quick waltz." is a pangram', () => {
expect(checkPangramRegex('Jived fox nymph grabs quick waltz.')).toBe(true)
})
it('"My name is Unknown" is NOT a pangram', () => {
expect(checkPangramRegex('My name is Unknown')).toBe(false)
})
it('"The quick brown fox jumps over the la_y dog" is NOT a pangram', () => {
expect(
checkPangramRegex('The quick brown fox jumps over the la_y dog')
).toBe(false)
})
it('Throws an error if given param is not a string', () => {
expect(() => {
checkPangramRegex(undefined)
}).toThrow('The given value is not a string')
})
})
describe('Testing checkPangramSet function', () => {
it('"The quick brown fox jumps over the lazy dog" is a pangram', () => {
expect(
checkPangramSet('The quick brown fox jumps over the lazy dog')
).toBe(true)
})
it('"Waltz, bad nymph, for quick jigs vex." is a pangram', () => {
expect(checkPangramSet('Waltz, bad nymph, for quick jigs vex.')).toBe(true)
})
it('"Jived fox nymph grabs quick waltz." is a pangram', () => {
expect(checkPangramSet('Jived fox nymph grabs quick waltz.')).toBe(true)
})
it('"My name is Unknown" is NOT a pangram', () => {
expect(checkPangramSet('My name is Unknown')).toBe(false)
})
it('"The quick brown fox jumps over the la_y dog" is NOT a pangram', () => {
expect(
checkPangramSet('The quick brown fox jumps over the la_y dog')
).toBe(false)
})
it('Throws an error if given param is not a string', () => {
expect(() => {
checkPangramSet(undefined)
}).toThrow('The given value is not a string')
})
})