-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.test.js
More file actions
20 lines (17 loc) · 765 Bytes
/
Copy pathmain.test.js
File metadata and controls
20 lines (17 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// importing the test abd expect from playwright library and also the function countVowelfrom main.js.
import { test, expect } from 'vitest';
import { countVowel } from './main.js';
// creating a test suite
test('count the number of vowels in a string', async () => {
const testCase = [
{ str: 'Coding', expectedCount: 2 },
{ str: 'Hijango', expectedCount: 3 },
{ str: 'CodeNinja', expectedCount: null, error: 'enter an 8 or less character word' }
];
for (const { str, expectedCount} of testCase) {
const actualCount = countVowel(str);
expect(actualCount).toBe(expectedCount);
console.log(`Test for word "${str}": expected ${expectedCount}, got ${actualCount}`);
}
}
);