Skip to content

Commit

Permalink
better console logging
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey-wu committed Aug 13, 2022
1 parent 6f07e19 commit c4e3bc8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/quizbowl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,18 @@ const tests = [
['accept', answerline9, 'chimpanzee'],
];

let successful = 0, total = 0;
console.log('TESTING quizbowl.checkAnswer()');
tests.forEach(test => {
const expected = test[0];
const answerline = test[1];
const givenAnswer = test[2];
const result = quizbowl.checkAnswer(answerline, givenAnswer);

console.assert(expected === result, `expected "${expected}" but got "${result}" for given answer "${givenAnswer}"`);
})

total++;
if (expected === result) successful++;
});

console.log(`${successful}/${total} tests successful`);

0 comments on commit c4e3bc8

Please sign in to comment.