|
1 | | -import { checkPangram } from '../CheckPangram' |
| 1 | +import { checkPangramRegex, checkPangramSet } from '../CheckPangram' |
2 | 2 |
|
3 | | -describe('checkPangram', () => { |
| 3 | +describe('Testing checkPangramRegex function', () => { |
4 | 4 | it('"The quick brown fox jumps over the lazy dog" is a pangram', () => { |
5 | 5 | expect( |
6 | | - checkPangram('The quick brown fox jumps over the lazy dog') |
7 | | - ).toBeTruthy() |
| 6 | + checkPangramRegex('The quick brown fox jumps over the lazy dog') |
| 7 | + ).toBe(true) |
8 | 8 | }) |
9 | 9 |
|
10 | 10 | it('"Waltz, bad nymph, for quick jigs vex." is a pangram', () => { |
11 | | - expect(checkPangram('Waltz, bad nymph, for quick jigs vex.')).toBeTruthy() |
| 11 | + expect(checkPangramRegex('Waltz, bad nymph, for quick jigs vex.')).toBe(true) |
12 | 12 | }) |
13 | 13 |
|
14 | 14 | it('"Jived fox nymph grabs quick waltz." is a pangram', () => { |
15 | | - expect(checkPangram('Jived fox nymph grabs quick waltz.')).toBeTruthy() |
| 15 | + expect(checkPangramRegex('Jived fox nymph grabs quick waltz.')).toBe(true) |
16 | 16 | }) |
17 | 17 |
|
18 | 18 | it('"My name is Unknown" is NOT a pangram', () => { |
19 | | - expect(checkPangram('My name is Unknown')).toBeFalsy() |
| 19 | + expect(checkPangramRegex('My name is Unknown')).toBe(false) |
20 | 20 | }) |
21 | 21 |
|
22 | 22 | it('"The quick brown fox jumps over the la_y dog" is NOT a pangram', () => { |
23 | 23 | expect( |
24 | | - checkPangram('The quick brown fox jumps over the la_y dog') |
25 | | - ).toBeFalsy() |
| 24 | + checkPangramRegex('The quick brown fox jumps over the la_y dog') |
| 25 | + ).toBe(false) |
26 | 26 | }) |
27 | 27 |
|
28 | 28 | it('Throws an error if given param is not a string', () => { |
29 | 29 | expect(() => { |
30 | | - checkPangram(undefined) |
| 30 | + checkPangramRegex(undefined) |
| 31 | + }).toThrow('The given value is not a string') |
| 32 | + }) |
| 33 | +}) |
| 34 | + |
| 35 | +describe('Testing checkPangramSet function', () => { |
| 36 | + it('"The quick brown fox jumps over the lazy dog" is a pangram', () => { |
| 37 | + expect( |
| 38 | + checkPangramSet('The quick brown fox jumps over the lazy dog') |
| 39 | + ).toBe(true) |
| 40 | + }) |
| 41 | + |
| 42 | + it('"Waltz, bad nymph, for quick jigs vex." is a pangram', () => { |
| 43 | + expect(checkPangramSet('Waltz, bad nymph, for quick jigs vex.')).toBe(true) |
| 44 | + }) |
| 45 | + |
| 46 | + it('"Jived fox nymph grabs quick waltz." is a pangram', () => { |
| 47 | + expect(checkPangramSet('Jived fox nymph grabs quick waltz.')).toBe(true) |
| 48 | + }) |
| 49 | + |
| 50 | + it('"My name is Unknown" is NOT a pangram', () => { |
| 51 | + expect(checkPangramSet('My name is Unknown')).toBe(false) |
| 52 | + }) |
| 53 | + |
| 54 | + it('"The quick brown fox jumps over the la_y dog" is NOT a pangram', () => { |
| 55 | + expect( |
| 56 | + checkPangramSet('The quick brown fox jumps over the la_y dog') |
| 57 | + ).toBe(false) |
| 58 | + }) |
| 59 | + |
| 60 | + it('Throws an error if given param is not a string', () => { |
| 61 | + expect(() => { |
| 62 | + checkPangramSet(undefined) |
31 | 63 | }).toThrow('The given value is not a string') |
32 | 64 | }) |
33 | 65 | }) |
0 commit comments