chore: 将已合并的商务工作台同步回主工作区
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { overviewCards, escapeChartText } from './dashboard-metrics.js'
|
||||
|
||||
test('overview preserves exact money, eight cards, and unavailable event data', () => {
|
||||
const cards = overviewCards({ available: true, settings: { days: 15, amount: 500 }, cards: {
|
||||
todayPay: { value: '9007199254740993.01', changeRate: null },
|
||||
todayRegister: { value: '0.00', changeRate: '0' },
|
||||
todayActive: { value: '5998.00', changeRate: '2.1' },
|
||||
lockedPromote: { value: null, compareLabel: '事件数据未接入' }
|
||||
} })
|
||||
assert.equal(cards.length, 8)
|
||||
assert.equal(cards.find(c => c.key === 'todayPay').value, '¥9,007,199,254,740,993.01')
|
||||
assert.equal(cards.find(c => c.key === 'todayRegister').value, '0')
|
||||
assert.equal(cards.find(c => c.key === 'todayActive').value, '5,998')
|
||||
assert.equal(cards.find(c => c.key === 'lockedPromote').value, '未接入')
|
||||
assert.match(cards.find(c => c.key === 'effectivePromote').tip, /15 天内充值满 ¥500/)
|
||||
assert.ok(overviewCards(null).every(c => c.value === '—'))
|
||||
assert.ok(overviewCards({ available: false }).every(c => c.value === '未接入'))
|
||||
})
|
||||
|
||||
test('chart HTML tooltips escape provider-controlled names', () => {
|
||||
assert.equal(escapeChartText('<img src=x onerror="alert(1)">&'), '<img src=x onerror="alert(1)">&')
|
||||
})
|
||||
Reference in New Issue
Block a user