mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-30 04:40:18 +08:00
fix: apply pending correctness fixes
Cherry-pick the still-relevant fixes from recent draft PRs without pulling in stale release/docs changes: - serialize dashboard data loads to avoid concurrent config self-heal writes - preserve valid per-model default blocks during dashboard model self-heal - pass structured humanizeError results directly to toast for model import scan failures - align frontend kernel isLatest with suffix-aware recommended version ordering Verification: - node --test tests/*.test.js - npm run build
This commit is contained in:
17
tests/humanize-error.test.js
Normal file
17
tests/humanize-error.test.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
|
||||
import { humanizeError, humanizeErrorText } from '../src/lib/humanize-error.js'
|
||||
|
||||
test('humanizeError must not be coerced with String() or template literals', () => {
|
||||
const h = humanizeError(new Error('ECONNREFUSED 127.0.0.1:443'), 'Import scan failed')
|
||||
assert.equal(typeof h, 'object')
|
||||
assert.equal(String(h), '[object Object]')
|
||||
assert.ok(h.message)
|
||||
})
|
||||
|
||||
test('humanizeErrorText is safe for plain-string contexts', () => {
|
||||
const line = humanizeErrorText(new Error('ENOENT no such file'), 'Import scan failed')
|
||||
assert.match(line, /Import scan failed/)
|
||||
assert.doesNotMatch(line, /\[object Object\]/)
|
||||
})
|
||||
Reference in New Issue
Block a user