@@ -4,7 +4,10 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
44import { createRoot , type Root } from 'react-dom/client'
55import { afterEach , beforeEach , expect , it , vi } from 'vitest'
66import type { useSpeechToText } from '@/hooks/use-speech-to-text'
7- import { useMothershipEffortStore } from '@/stores/mothership-effort/store'
7+ import {
8+ useMothershipEffortStore ,
9+ useMothershipPlanEffortStore ,
10+ } from '@/stores/mothership-effort/store'
811
912const mocks = vi . hoisted ( ( ) => ( {
1013 live : false ,
@@ -95,6 +98,7 @@ let queryClient: QueryClient
9598
9699beforeEach ( ( ) => {
97100 mocks . advanced = false
101+ useMothershipPlanEffortStore . getState ( ) . reset ( )
98102 useMothershipEffortStore . setState ( {
99103 effort : 'high' ,
100104 modelSelection : { model : 'gpt-6-astra' , fastMode : false } ,
@@ -189,7 +193,7 @@ afterEach(async () => {
189193async function render (
190194 isInitialView : boolean ,
191195 initialValue = 'Summarize' ,
192- requestMode : 'agent' | 'assistant' = 'assistant' ,
196+ requestMode : 'agent' | 'assistant' | 'plan' = 'assistant' ,
193197 controls : Pick <
194198 ComponentProps < typeof Composer > ,
195199 'isSending' | 'showModeSelector' | 'onModeChange' | 'restoredContexts' | 'onSendQueuedHead'
@@ -366,3 +370,22 @@ it.each([
366370 expect ( input . value ) . toBe ( '' )
367371 }
368372)
373+
374+ it ( 'renders and restores separate Plan and Build model preferences when changing modes' , async ( ) => {
375+ mocks . plan = true
376+ mocks . advanced = true
377+ await render ( false , '' , 'plan' )
378+ expect ( container . textContent ) . toContain ( 'Opus 5.5' )
379+ expect ( container . textContent ) . toContain ( 'Medium' )
380+ await act ( async ( ) => {
381+ useMothershipPlanEffortStore . getState ( ) . setModel ( 'gpt-6-astra' )
382+ useMothershipPlanEffortStore . getState ( ) . setEffort ( 'xhigh' )
383+ } )
384+ expect ( container . textContent ) . toContain ( 'GPT-6 Astra' )
385+ expect ( container . textContent ) . toContain ( 'Extra High' )
386+ await render ( false , '' , 'agent' )
387+ expect ( container . textContent ) . toContain ( 'GPT-6 Astra' )
388+ expect ( container . textContent ) . not . toContain ( 'Extra High' )
389+ await render ( false , '' , 'plan' )
390+ expect ( container . textContent ) . toContain ( 'Extra High' )
391+ } )
0 commit comments