fix: 修复score有时计算不准确的问题

This commit is contained in:
chenjinsong
2023-09-06 11:30:38 +08:00
parent 99dd82d25b
commit b83b51e792
7 changed files with 50 additions and 21 deletions

11
test/utils/tools.test.js Normal file
View File

@@ -0,0 +1,11 @@
import { computeScore } from '@/utils/tools'
import { zeroData, undefinedData } from './mockData/score'
describe('computeScore测试', () => {
test('含0', () => {
expect(computeScore(zeroData)).toEqual(6)
})
test('含undefined', () => {
expect(computeScore(undefinedData)).toEqual('-')
})
})