@@ -15,7 +15,10 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
1515import { createRoot , type Root } from 'react-dom/client'
1616import { afterEach , beforeEach , expect , it , vi } from 'vitest'
1717import type { useSpeechToText } from '@/hooks/use-speech-to-text'
18- import { useMothershipEffortStore } from '@/stores/mothership-effort/store'
18+ import {
19+ useMothershipEffortStore ,
20+ useMothershipPlanEffortStore ,
21+ } from '@/stores/mothership-effort/store'
1922
2023const mocks = vi . hoisted ( ( ) => ( {
2124 plan : false ,
@@ -103,6 +106,7 @@ let queryClient: QueryClient
103106beforeEach ( ( ) => {
104107 mocks . advanced = false
105108 useMothershipEffortStore . getState ( ) . reset ( )
109+ useMothershipPlanEffortStore . getState ( ) . reset ( )
106110 mocks . plan = false
107111 vi . clearAllMocks ( )
108112 mocks . workspaces = [
@@ -191,7 +195,7 @@ afterEach(async () => {
191195async function render (
192196 isInitialView : boolean ,
193197 initialValue = 'Summarize' ,
194- requestMode : 'agent' | 'assistant' = 'assistant' ,
198+ requestMode : 'agent' | 'assistant' | 'plan' = 'assistant' ,
195199 controls : Pick <
196200 ComponentProps < typeof Composer > ,
197201 'isSending' | 'showModeSelector' | 'onModeChange' | 'restoredContexts' | 'onSendQueuedHead'
@@ -476,3 +480,22 @@ it.each([
476480 expect ( input . value ) . toBe ( '' )
477481 }
478482)
483+
484+ it ( 'renders and restores separate Plan and Build model preferences when changing modes' , async ( ) => {
485+ mocks . plan = true
486+ mocks . advanced = true
487+ await render ( false , '' , 'plan' )
488+ expect ( container . textContent ) . toContain ( 'Opus 5.5' )
489+ expect ( container . textContent ) . toContain ( 'Medium' )
490+ await act ( async ( ) => {
491+ useMothershipPlanEffortStore . getState ( ) . setModel ( 'gpt-6-astra' )
492+ useMothershipPlanEffortStore . getState ( ) . setEffort ( 'xhigh' )
493+ } )
494+ expect ( container . textContent ) . toContain ( 'GPT-6 Astra' )
495+ expect ( container . textContent ) . toContain ( 'Extra High' )
496+ await render ( false , '' , 'agent' )
497+ expect ( container . textContent ) . toContain ( 'GPT-6 Astra' )
498+ expect ( container . textContent ) . not . toContain ( 'Extra High' )
499+ await render ( false , '' , 'plan' )
500+ expect ( container . textContent ) . toContain ( 'Extra High' )
501+ } )
0 commit comments