59 lines
1.3 KiB
TypeScript
59 lines
1.3 KiB
TypeScript
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');
|