test(desktop): fix a handful of broken tests

fix/verification-admin-route-recovery
ethernet 2026-07-09 12:25:56 -04:00
parent 56bec611e5
commit 999d63b517
5 changed files with 15 additions and 8 deletions

View File

@ -33,7 +33,8 @@ vi.mock('@/hermes', () => ({
saveMoaModels: (body: unknown) => saveMoaModels(body),
setEnvVar: (key: string, value: string) => setEnvVar(key, value),
getHermesConfigRecord: () => getHermesConfigRecord(),
saveHermesConfig: (config: unknown) => saveHermesConfig(config)
saveHermesConfig: (config: unknown) => saveHermesConfig(config),
setApiRequestProfile: () => {}
}))
vi.mock('@/store/onboarding', () => ({
@ -72,8 +73,13 @@ afterEach(() => {
async function renderModelSettings() {
const { ModelSettings } = await import('./model-settings')
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } })
return render(<ModelSettings />)
return render(
<QueryClientProvider client={client}>
<ModelSettings />
</QueryClientProvider>
)
}
describe('ModelSettings', () => {

View File

@ -153,7 +153,7 @@ describe('PaneShell composition', () => {
const rendered = render(
<PaneShell>
<Pane id="files" side="left" width="240px">
<Pane id="files" resizable side="left" width="240px">
files
</Pane>
<PaneMain>main</PaneMain>

View File

@ -24,7 +24,7 @@ describe('requestModelOptions', () => {
await expect(requestModelOptions({ gateway: gateway as never, sessionId: null })).resolves.toBe(gatewayPayload)
expect(gateway.request).toHaveBeenCalledWith('model.options', {})
expect(gateway.request).toHaveBeenCalledWith('model.options', { explicit_only: true })
expect(getGlobalModelOptions).not.toHaveBeenCalled()
})
@ -36,6 +36,7 @@ describe('requestModelOptions', () => {
await requestModelOptions({ gateway: gateway as never, refresh: true, sessionId: 'session-1' })
expect(gateway.request).toHaveBeenCalledWith('model.options', {
explicit_only: true,
refresh: true,
session_id: 'session-1'
})
@ -44,6 +45,6 @@ describe('requestModelOptions', () => {
it('falls back to REST when no gateway is connected', async () => {
await requestModelOptions({ refresh: true })
expect(getGlobalModelOptions).toHaveBeenCalledWith({ refresh: true })
expect(getGlobalModelOptions).toHaveBeenCalledWith({ explicitOnly: true, refresh: true })
})
})

View File

@ -284,7 +284,7 @@ describe('OAuth onboarding', () => {
return { ok: true, status: 'approved' }
}
if (path === '/api/model/options') {
if (path.startsWith('/api/model/options')) {
return {
providers: [
{
@ -357,7 +357,7 @@ describe('OAuth onboarding', () => {
expect(calls.some(c => c.path === '/api/model/set')).toBe(true)
const optionsIndex = calls.findIndex(c => c.path === '/api/model/options')
const optionsIndex = calls.findIndex(c => c.path.startsWith('/api/model/options'))
const recommendedIndex = calls.findIndex(c => c.path.startsWith('/api/model/recommended-default'))
const setIndex = calls.findIndex(c => c.path === '/api/model/set')

View File

@ -104,7 +104,7 @@ describe('panes store', () => {
const persisted = window.localStorage.getItem(STORAGE_KEY)
expect(persisted).not.toBeNull()
expect(JSON.parse(persisted ?? '{}')).toEqual({ files: { open: true } })
expect(JSON.parse(persisted ?? '{}')).toEqual({ files: { open: true, widthOverride: 300 } })
})
it('open flag is persisted across changes', () => {