Files
clawpanel/tests/humanize-error.test.js
晴天 9d2dc8438e 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
2026-05-21 19:06:38 +08:00

18 lines
684 B
JavaScript

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\]/)
})