|
1 |
| -import { checkVowels } from '../CheckVowels' |
| 1 | +import { countVowels } from '../CountVowels' |
2 | 2 |
|
3 |
| -describe('Test the checkVowels function', () => { |
| 3 | +describe('CountVowels', () => { |
4 | 4 | it('expect throws on use wrong param', () => {
|
5 |
| - expect(() => checkVowels(0)).toThrow() |
| 5 | + expect(() => countVowels(0)).toThrow() |
6 | 6 | })
|
7 | 7 |
|
8 | 8 | it('count the vowels in a string', () => {
|
9 | 9 | const value = 'Mad World'
|
10 |
| - const countVowels = checkVowels(value) |
11 |
| - expect(countVowels).toBe(2) |
| 10 | + const count = countVowels(value) |
| 11 | + expect(count).toBe(2) |
12 | 12 | })
|
13 | 13 |
|
14 | 14 | it('should return 0 when input is a string with no vowels', () => {
|
15 | 15 | const value = 'bcdfgh'
|
16 |
| - const countVowels = checkVowels(value) |
17 |
| - expect(countVowels).toBe(0) |
| 16 | + const count = countVowels(value) |
| 17 | + expect(count).toBe(0) |
18 | 18 | })
|
19 | 19 |
|
20 | 20 | it('should return 1 when input is a string of length 1 that is a vowel', () => {
|
21 | 21 | const value = 'a'
|
22 |
| - const countVowels = checkVowels(value) |
23 |
| - expect(countVowels).toBe(1) |
| 22 | + const count = countVowels(value) |
| 23 | + expect(count).toBe(1) |
24 | 24 | })
|
25 | 25 |
|
26 | 26 | it('should return the correct result when input is in all uppercase letters', () => {
|
27 | 27 | const value = 'ABCDE'
|
28 |
| - const countVowels = checkVowels(value) |
29 |
| - expect(countVowels).toBe(2) |
| 28 | + const count = countVowels(value) |
| 29 | + expect(count).toBe(2) |
30 | 30 | })
|
31 | 31 |
|
32 | 32 | it('should return the correct result when input is in all lowercase letters', () => {
|
33 | 33 | const value = 'abcdefghi'
|
34 |
| - const countVowels = checkVowels(value) |
35 |
| - expect(countVowels).toBe(3) |
| 34 | + const count = countVowels(value) |
| 35 | + expect(count).toBe(3) |
36 | 36 | })
|
37 | 37 |
|
38 | 38 | it('should return the correct result when input string contains spaces', () => {
|
39 | 39 | const value = 'abc def ghi'
|
40 |
| - const countVowels = checkVowels(value) |
41 |
| - expect(countVowels).toBe(3) |
| 40 | + const count = countVowels(value) |
| 41 | + expect(count).toBe(3) |
42 | 42 | })
|
43 | 43 |
|
44 | 44 | it('should return the correct result when input contains number characters', () => {
|
45 | 45 | const value = 'a1b2c3'
|
46 |
| - const countVowels = checkVowels(value) |
47 |
| - expect(countVowels).toBe(1) |
| 46 | + const count = countVowels(value) |
| 47 | + expect(count).toBe(1) |
48 | 48 | })
|
49 | 49 |
|
50 | 50 | it('should return the correct result when input contains punctuation characters', () => {
|
51 | 51 | const value = 'a!b.ce)'
|
52 |
| - const countVowels = checkVowels(value) |
53 |
| - expect(countVowels).toBe(2) |
| 52 | + const count = countVowels(value) |
| 53 | + expect(count).toBe(2) |
54 | 54 | })
|
55 | 55 |
|
56 | 56 | it('should return 0 when the input is an empty string', () => {
|
57 | 57 | const value = ''
|
58 |
| - const countVowels = checkVowels(value) |
59 |
| - expect(countVowels).toBe(0) |
| 58 | + const count = countVowels(value) |
| 59 | + expect(count).toBe(0) |
60 | 60 | })
|
61 | 61 |
|
62 | 62 | it('should count multiple occurrences of the same vowel in the input', () => {
|
63 | 63 | const value = 'aaaaa'
|
64 |
| - const countVowels = checkVowels(value) |
65 |
| - expect(countVowels).toBe(5) |
| 64 | + const count = countVowels(value) |
| 65 | + expect(count).toBe(5) |
66 | 66 | })
|
67 | 67 | })
|
0 commit comments