-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdebug.js
More file actions
31 lines (28 loc) · 1.34 KB
/
debug.js
File metadata and controls
31 lines (28 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const keywords = ['error', 'wrong', 'incorrect', 'failed', 'didn\'t work', 'not working', 'bug', 'broken', 'issue', 'problem', 'mistake', 'fix', 'crash', 'exception'];
const directIndicators = ['that', 'your', 'the code', 'previous', 'last'];
const testPhrases = [
'That\'s wrong',
'This is incorrect',
'The code failed',
'Your code didn\'t work',
'There\'s a bug in that',
'Your solution is broken',
'There\'s an issue with your code',
'That\'s a mistake',
'Please fix that',
'Your code crashes when I run it'
];
console.log('Testing keyword and indicator detection:');
testPhrases.forEach(phrase => {
const lower = phrase.toLowerCase();
const hasKeyword = keywords.some(k => lower.includes(k));
const hasIndicator = directIndicators.some(i => lower.includes(i));
console.log(`"${phrase}": keyword=${hasKeyword}, indicator=${hasIndicator}, both=${hasKeyword && hasIndicator}`);
});
// Test the specific failing case
const failingCase = 'That validation is too simple and will accept invalid emails like "a@" or "@b"';
const lower = failingCase.toLowerCase();
const hasKeyword = keywords.some(k => lower.includes(k));
const hasIndicator = directIndicators.some(i => lower.includes(i));
console.log(`\nFailing test case: "${failingCase}"`);
console.log(`keyword=${hasKeyword}, indicator=${hasIndicator}, both=${hasKeyword && hasIndicator}`);