continue fixing

This commit is contained in:
2026-06-13 10:35:06 +08:00
parent 76c2f17229
commit b19c811048
8 changed files with 240 additions and 43 deletions

View 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');