From b7ec75fc20fcf86721d7b5841fc6c74242b450ce Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Sat, 19 Sep 2026 00:02:22 -0700 Subject: [PATCH] test(desktop): keep the two invariant cases for the onboarding model pick Trim the salvaged suite to the two behaviours the fix guarantees: a cross-provider pick persists against (and re-labels the card with) the provider that serves the model, and a failed persist reverts model, provider and label together. The same-provider and model-only call shapes are exercised by the existing flow and add no invariant of their own. --- apps/desktop/src/store/onboarding.test.ts | 54 ----------------------- 1 file changed, 54 deletions(-) diff --git a/apps/desktop/src/store/onboarding.test.ts b/apps/desktop/src/store/onboarding.test.ts index d805dcdb8d..d3984efe65 100644 --- a/apps/desktop/src/store/onboarding.test.ts +++ b/apps/desktop/src/store/onboarding.test.ts @@ -929,60 +929,6 @@ describe('setOnboardingModel', () => { } }) - it('keeps the sign-in provider when the picked model belongs to it', async () => { - const calls: { body?: unknown; path: string }[] = [] - - const api = vi.fn(async ({ body, path }: { body?: unknown; path: string }) => { - calls.push({ body, path }) - - if (path === '/api/model/set') { - return { ok: true, provider: 'openai', model: 'gpt-5.2' } - } - - throw new Error(`unexpected api path: ${path}`) - }) - - installApiMock(api) - $desktopOnboarding.set(confirmingModelState()) - - await setOnboardingModel('gpt-5.2', 'openai', 'OpenAI OAuth (ChatGPT)') - - const assign = calls.find(c => c.path === '/api/model/set') - expect(assign?.body).toMatchObject({ provider: 'openai', model: 'gpt-5.2' }) - - const flow = $desktopOnboarding.get().flow - expect(flow.status).toBe('confirming_model') - - if (flow.status === 'confirming_model') { - expect(flow.providerSlug).toBe('openai') - expect(flow.label).toBe('OpenAI OAuth (ChatGPT)') - } - }) - - it('falls back to the flow provider when the caller passes no provider', async () => { - const calls: { body?: unknown; path: string }[] = [] - - const api = vi.fn(async ({ body, path }: { body?: unknown; path: string }) => { - calls.push({ body, path }) - - if (path === '/api/model/set') { - return { ok: true, provider: 'openai', model: 'gpt-5.2' } - } - - throw new Error(`unexpected api path: ${path}`) - }) - - installApiMock(api) - $desktopOnboarding.set(confirmingModelState()) - - // Legacy call shape (model only) must keep persisting under the sign-in - // provider rather than writing an empty provider. - await setOnboardingModel('gpt-5.2') - - const assign = calls.find(c => c.path === '/api/model/set') - expect(assign?.body).toMatchObject({ provider: 'openai', model: 'gpt-5.2' }) - }) - it('reverts the model, provider and label when persistence fails', async () => { installApiMock(async () => { throw new Error('backend down')