hermes-agent/apps/desktop/src/lib/update-copy.test.ts
yoniebans 9c264555b0 fix(desktop): name the update target in the overlay; honest no-changelog copy
The updates overlay showed generic 'New update available / improvements and
fixes' with no indication of whether it was updating the client or the backend.
In remote mode it now reads 'Backend update available' and names the connected
backend, and when there's no commit changelog (e.g. pip/non-git backend) it
degrades to honest 'release notes aren't available for this install type' copy
instead of filler.

Copy selection extracted to a pure resolveUpdateCopy() helper (unit-tested);
threads target ('client'|'backend') from connection.mode through the overlay.
2026-06-08 08:58:26 -07:00

38 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { describe, expect, it } from 'vitest'
import { resolveUpdateCopy } from './update-copy'
const copy = {
availableTitle: 'New update available',
availableBody: 'A new version of Hermes is ready to install.',
availableTitleBackend: 'Backend update available',
availableBodyBackend: 'A newer version of the connected Hermes backend is ready to install.',
availableBodyNoChangelog: 'A newer version is ready. Release notes arent available for this install type.'
}
describe('resolveUpdateCopy', () => {
it('client target with commits: client title + client body', () => {
const r = resolveUpdateCopy({ target: 'client', shownItems: 5, copy })
expect(r.title).toBe('New update available')
expect(r.body).toBe('A new version of Hermes is ready to install.')
})
it('backend target with commits: names the backend in title and body', () => {
const r = resolveUpdateCopy({ target: 'backend', shownItems: 5, copy })
expect(r.title).toBe('Backend update available')
expect(r.body).toContain('backend')
})
it('no changelog (pip/non-git backend): degrades honestly, still names backend target in title', () => {
const r = resolveUpdateCopy({ target: 'backend', shownItems: 0, copy })
expect(r.title).toBe('Backend update available')
// Body must NOT pretend there are notes — it states they're unavailable.
expect(r.body).toBe(copy.availableBodyNoChangelog)
})
it('no changelog on client: same honest degrade', () => {
const r = resolveUpdateCopy({ target: 'client', shownItems: 0, copy })
expect(r.title).toBe('New update available')
expect(r.body).toBe(copy.availableBodyNoChangelog)
})
})