Import the client, server, skills, tests, and build scripts as the starting point for the rebuild, then trim the surfaces this project does not ship: Electron desktop packaging, the marketing website, and the ESP32 firmware tree. CI keeps the web build, e2e, lockfile, release, and Docker workflows. Rename the package and CLI entry points to hermes-ui, drop the prepare hook so npm ci no longer triggers a build, and drop the removed tsconfig and nodemon references. Rewrite AGENTS.md, ARCHITECTURE.md, DEVELOPMENT.md, and the READMEs so the documented package map and hard rules match this repository. reference_code/ is ignored: it is a read-only snapshot, not an input to the build.
26 lines
1018 B
TypeScript
26 lines
1018 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { responseErrorMessage } from '@/utils/http-error'
|
|
|
|
describe('responseErrorMessage', () => {
|
|
it('uses JSON error fields when available', async () => {
|
|
const response = new Response(JSON.stringify({ error: 'Profile access denied' }), {
|
|
status: 403,
|
|
headers: { 'content-type': 'application/json' },
|
|
})
|
|
|
|
await expect(responseErrorMessage(response, 'Upload failed')).resolves.toBe('Upload failed: 403 - Profile access denied')
|
|
})
|
|
|
|
it('falls back to text response bodies', async () => {
|
|
const response = new Response('Forbidden by policy', { status: 403 })
|
|
|
|
await expect(responseErrorMessage(response, 'Upload failed')).resolves.toBe('Upload failed: 403 - Forbidden by policy')
|
|
})
|
|
|
|
it('keeps the original status-only fallback when no body exists', async () => {
|
|
const response = new Response('', { status: 500 })
|
|
|
|
await expect(responseErrorMessage(response, 'Upload failed')).resolves.toBe('Upload failed: 500')
|
|
})
|
|
})
|