continue fixing
This commit is contained in:
58
server/utils/vocabularyRisk.test.ts
Normal file
58
server/utils/vocabularyRisk.test.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import {
|
||||
DEFAULT_VOCABULARY_FULL_CORRECT_WORD_THRESHOLD,
|
||||
VOCABULARY_FULL_CORRECT_RISK_FLAG,
|
||||
analyzeVocabularyAttemptResultRisk
|
||||
} from './vocabularyRisk';
|
||||
|
||||
const defaultThreshold = DEFAULT_VOCABULARY_FULL_CORRECT_WORD_THRESHOLD;
|
||||
|
||||
assert.equal(defaultThreshold, 50);
|
||||
|
||||
assert.deepEqual(
|
||||
analyzeVocabularyAttemptResultRisk({
|
||||
testType: 'chinese-to-english',
|
||||
totalWords: defaultThreshold + 1,
|
||||
correctWords: defaultThreshold + 1
|
||||
}),
|
||||
[VOCABULARY_FULL_CORRECT_RISK_FLAG]
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
analyzeVocabularyAttemptResultRisk({
|
||||
testType: 'audio-to-english',
|
||||
totalWords: defaultThreshold,
|
||||
correctWords: defaultThreshold
|
||||
}),
|
||||
[]
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
analyzeVocabularyAttemptResultRisk({
|
||||
testType: 'chinese-to-english',
|
||||
totalWords: defaultThreshold + 1,
|
||||
correctWords: defaultThreshold
|
||||
}),
|
||||
[]
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
analyzeVocabularyAttemptResultRisk({
|
||||
testType: 'multiple-choice',
|
||||
totalWords: defaultThreshold + 1,
|
||||
correctWords: defaultThreshold + 1
|
||||
}),
|
||||
[]
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
analyzeVocabularyAttemptResultRisk({
|
||||
testType: 'audio-to-english',
|
||||
totalWords: 41,
|
||||
correctWords: 41,
|
||||
threshold: 40
|
||||
}),
|
||||
[VOCABULARY_FULL_CORRECT_RISK_FLAG]
|
||||
);
|
||||
|
||||
console.log('vocabularyRisk tests passed');
|
||||
Reference in New Issue
Block a user