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