|
| 1 | +const { countVowelsItteratively, countVowelsItterativelyES6, countVowelsUsingRegex } = require('.'); |
| 2 | + |
| 3 | +describe('Count Vowels', () => { |
| 4 | + const apple = 'AppLe'; |
| 5 | + const education = 'education'; |
| 6 | + const myths = 'myths'; |
| 7 | + |
| 8 | + describe('Count by regular itteration', () => { |
| 9 | + it('Should return 2 for `Apple`', () => { |
| 10 | + expect(countVowelsItteratively(apple)).toEqual(2); |
| 11 | + }); |
| 12 | + |
| 13 | + it('Should return 5 for `Education`', () => { |
| 14 | + expect(countVowelsItteratively(education)).toEqual(5); |
| 15 | + }); |
| 16 | + |
| 17 | + it('Should return 0 for `Myths`', () => { |
| 18 | + expect(countVowelsItteratively(myths)).toEqual(0); |
| 19 | + }); |
| 20 | + }); |
| 21 | + |
| 22 | + describe('Count by ES6 itteration', () => { |
| 23 | + it('Should return 2 for `Apple`', () => { |
| 24 | + expect(countVowelsItterativelyES6(apple)).toEqual(2); |
| 25 | + }); |
| 26 | + |
| 27 | + it('Should return 5 for `Education`', () => { |
| 28 | + expect(countVowelsItterativelyES6(education)).toEqual(5); |
| 29 | + }); |
| 30 | + |
| 31 | + it('Should return 0 for `Myths`', () => { |
| 32 | + expect(countVowelsItterativelyES6(myths)).toEqual(0); |
| 33 | + }); |
| 34 | + }); |
| 35 | + |
| 36 | + describe('Count using REGEX', () => { |
| 37 | + it('Should return 2 for `Apple`', () => { |
| 38 | + expect(countVowelsUsingRegex(apple)).toEqual(2); |
| 39 | + }); |
| 40 | + |
| 41 | + it('Should return 5 for `Education`', () => { |
| 42 | + expect(countVowelsUsingRegex(education)).toEqual(5); |
| 43 | + }); |
| 44 | + |
| 45 | + it('Should return 0 for `Myths`', () => { |
| 46 | + expect(countVowelsUsingRegex(myths)).toEqual(0); |
| 47 | + }); |
| 48 | + }); |
| 49 | +}); |
0 commit comments