Skip to content

Commit a8b1110

Browse files
committed
🚨 test: refractor justask test to use multiple it for each testcase
1 parent 14e5449 commit a8b1110

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

‎src/events/just-ask.test.ts‎

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@ import { describe, it } from 'node:test';
33
import { isAskingToAsk } from './just-ask.js';
44

55
describe('justAsk Regex', () => {
6-
it("should detect 'just ask' variations", () => {
7-
const testCases = [
8-
{ input: 'Anyone knows js?', expected: true },
9-
{ input: 'Somebody can help with Python?', expected: true },
10-
{ input: 'No one has experience with js?', expected: true },
11-
{ input: 'Everybody tried React?', expected: true },
12-
{ input: 'People familiar with Kubernetes?', expected: true },
6+
const testCases = [
7+
{ input: 'Anyone knows js?', expected: true },
8+
{ input: 'Somebody can help with Python?', expected: true },
9+
{ input: 'No one has experience with js?', expected: true },
10+
{ input: 'Everybody tried React?', expected: true },
11+
{ input: 'People familiar with Kubernetes?', expected: true },
1312

14-
{ input: 'I know js well.', expected: false },
15-
{ input: 'This is a question without the pattern.', expected: false },
16-
];
17-
18-
for (const { input, expected } of testCases) {
13+
{ input: 'I know js well.', expected: false },
14+
{ input: 'This is a question without the pattern.', expected: false },
15+
];
16+
testCases.forEach(({ input, expected }) => {
17+
it(`should return ${expected} for input: "${input}"`, () => {
1918
const result = isAskingToAsk(input);
20-
assert.strictEqual(result, expected, `Failed for input: "${input}"`);
21-
}
19+
assert.strictEqual(result, expected);
20+
});
2221
});
2322
});

0 commit comments

Comments
 (0)