fix(navigation): align header wallet tiles with reference

This commit is contained in:
2026-10-11 14:55:23 +08:00
parent 60e4d67772
commit 7ed739615e
7 changed files with 70 additions and 7 deletions
@@ -2,6 +2,7 @@ const test = require('node:test')
const assert = require('node:assert/strict')
const fs = require('node:fs')
const path = require('node:path')
const vm = require('node:vm')
const root = path.resolve(__dirname, '..', '..')
@@ -421,6 +422,23 @@ test('asset purchases share the order center and refresh every wallet surface',
assert.match(sidebar, /data-aksrt-points-value/)
assert.match(header, /data-aksrt-wallet-value/)
assert.match(header, /data-aksrt-points-value/)
assert.match(header, /data-aksrt-wallet-value data-aksrt-count-format="cut-count"/)
assert.match(header, /data-aksrt-points-value data-aksrt-count-format="cut-count"/)
assert.match(creditsJs, /element\.dataset\.aksrtCountFormat === 'cut-count' \? formatCutCount\(/)
})
test('header wallet count formatting matches the server cut-count thresholds', () => {
const creditsJs = fs.readFileSync(path.join(root, 'assets', 'js', 'credits.js'), 'utf8')
const formatterSource = creditsJs.match(/function formatCutCount\(value\) \{[\s\S]*?\n\t\}/)
assert.ok(formatterSource, 'credits runtime must define the header cut-count formatter')
const formatCutCount = vm.runInNewContext('(' + formatterSource[0] + ')')
assert.equal(formatCutCount('0.00'), '0')
assert.equal(formatCutCount('9999'), '9999')
assert.equal(formatCutCount('10000'), '1W+')
assert.equal(formatCutCount('12345'), '1.2W+')
assert.equal(formatCutCount('1000000'), '100W+')
})
test('recharge completion always credits the ledger and expiry SQL is strict-mode safe', () => {