7dec81568e
Drop two PrimaryProfilePin cases that only restate the constructor defaults and blank-string normalisation, and the wiring-routing test that froze POOL_LIMITS_SETTINGS_ROUTE to a literal string — a snapshot of the constant, not a behaviour contract. The two kept pin tests cover the bug (a live primary keeps answering for its booted profile after the stored preference moves; teardown releases the pin), and the notifications tests cover the toast action end-to-end.
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import assert from 'node:assert/strict'
|
|
|
|
import { test } from 'vitest'
|
|
|
|
import { PrimaryProfilePin } from './primary-profile-pin'
|
|
|
|
test('a live primary keeps answering for its booted profile after the preference moves', () => {
|
|
const pin = new PrimaryProfilePin()
|
|
let preference: null | string = 'default'
|
|
|
|
// startHermes() boots the primary as the preference at that moment.
|
|
assert.equal(pin.pin(preference), 'default')
|
|
assert.equal(pin.resolve(() => preference), 'default')
|
|
|
|
// hermes:profile:remember rewrites active-profile.json without re-homing.
|
|
preference = 'claude'
|
|
|
|
// Routing must still see the running primary as "default": otherwise a
|
|
// request for "default" falls through to the pool and a second backend is
|
|
// spawned for the same HERMES_HOME.
|
|
assert.equal(pin.resolve(() => preference), 'default')
|
|
})
|
|
|
|
test('teardown releases the pin so the next start follows the preference', () => {
|
|
const pin = new PrimaryProfilePin()
|
|
pin.pin('default')
|
|
pin.clear()
|
|
|
|
assert.equal(pin.booted, null)
|
|
assert.equal(pin.resolve(() => 'claude'), 'claude')
|
|
})
|