@@ -18,7 +18,11 @@ describe('FinalizationCommand', () => {
1818 let command : FinalizationCommand ;
1919
2020 beforeEach ( ( ) => {
21- command = new FinalizationCommand ( undefined , false , false , false ) ;
21+ command = new FinalizationCommand ( {
22+ logfile : undefined ,
23+ showAgentFollowUp : false ,
24+ showAiInstructions : false ,
25+ } ) ;
2226
2327 vi . mocked ( getProjectRoot ) . mockReturnValue ( '/test/project' ) ;
2428 vi . mocked ( logger . step ) . mockImplementation ( ( ) => { } ) ;
@@ -109,8 +113,12 @@ describe('FinalizationCommand', () => {
109113 } ) ;
110114
111115 describe ( 'agent mode' , ( ) => {
112- it ( 'should show agent-specific message when agent=true and ai prepare is supported' , async ( ) => {
113- const agentCommand = new FinalizationCommand ( undefined , true , true , false ) ;
116+ it ( 'should show agent-specific message when showAgentFollowUp=true' , async ( ) => {
117+ const agentCommand = new FinalizationCommand ( {
118+ logfile : undefined ,
119+ showAgentFollowUp : true ,
120+ showAiInstructions : false ,
121+ } ) ;
114122 vi . mocked ( find . up ) . mockReturnValue ( undefined ) ;
115123
116124 await agentCommand . execute ( { } ) ;
@@ -120,8 +128,13 @@ describe('FinalizationCommand', () => {
120128 ) ;
121129 expect ( logger . step ) . toHaveBeenCalledWith ( expect . stringContaining ( 'npx storybook ai prepare' ) ) ;
122130 } ) ;
123- it ( 'should show standard success message when agent=true and ai prepare is NOT supported' , async ( ) => {
124- const agentCommand = new FinalizationCommand ( undefined , true , false , true ) ;
131+
132+ it ( 'should show standard success message when showAgentFollowUp=false with AI instructions' , async ( ) => {
133+ const agentCommand = new FinalizationCommand ( {
134+ logfile : undefined ,
135+ showAgentFollowUp : false ,
136+ showAiInstructions : true ,
137+ } ) ;
125138 vi . mocked ( find . up ) . mockReturnValue ( undefined ) ;
126139
127140 await agentCommand . execute ( { } ) ;
@@ -134,8 +147,12 @@ describe('FinalizationCommand', () => {
134147 expect ( stepCalls . some ( ( msg ) => msg . includes ( 'is not entirely set up yet' ) ) ) . toBe ( false ) ;
135148 } ) ;
136149
137- it ( 'should show standard success message when agent=false' , async ( ) => {
138- const nonAgentCommand = new FinalizationCommand ( undefined , false , false , false ) ;
150+ it ( 'should show standard success message when showAgentFollowUp=false' , async ( ) => {
151+ const nonAgentCommand = new FinalizationCommand ( {
152+ logfile : undefined ,
153+ showAgentFollowUp : false ,
154+ showAiInstructions : false ,
155+ } ) ;
139156 vi . mocked ( find . up ) . mockReturnValue ( undefined ) ;
140157
141158 await nonAgentCommand . execute ( { } ) ;
@@ -151,7 +168,11 @@ describe('FinalizationCommand', () => {
151168
152169 describe ( 'AI instructions' , ( ) => {
153170 it ( 'should show AI instructions when showAiInstructions=true' , async ( ) => {
154- const aiCommand = new FinalizationCommand ( undefined , false , true , true ) ;
171+ const aiCommand = new FinalizationCommand ( {
172+ logfile : undefined ,
173+ showAgentFollowUp : false ,
174+ showAiInstructions : true ,
175+ } ) ;
155176 vi . mocked ( find . up ) . mockReturnValue ( undefined ) ;
156177
157178 await aiCommand . execute ( { } ) ;
@@ -163,7 +184,11 @@ describe('FinalizationCommand', () => {
163184 } ) ;
164185
165186 it ( 'should NOT show AI instructions when showAiInstructions=false' , async ( ) => {
166- const noAiCommand = new FinalizationCommand ( undefined , false , false , false ) ;
187+ const noAiCommand = new FinalizationCommand ( {
188+ logfile : undefined ,
189+ showAgentFollowUp : false ,
190+ showAiInstructions : false ,
191+ } ) ;
167192 vi . mocked ( find . up ) . mockReturnValue ( undefined ) ;
168193
169194 await noAiCommand . execute ( { } ) ;
@@ -173,7 +198,11 @@ describe('FinalizationCommand', () => {
173198 } ) ;
174199
175200 it ( 'should show both agent message and AI instructions when both are true' , async ( ) => {
176- const bothCommand = new FinalizationCommand ( undefined , true , true , true ) ;
201+ const bothCommand = new FinalizationCommand ( {
202+ logfile : undefined ,
203+ showAgentFollowUp : true ,
204+ showAiInstructions : true ,
205+ } ) ;
177206 vi . mocked ( find . up ) . mockReturnValue ( undefined ) ;
178207
179208 await bothCommand . execute ( { } ) ;
@@ -189,7 +218,11 @@ describe('FinalizationCommand', () => {
189218
190219 describe ( 'storybookCommand message' , ( ) => {
191220 it ( 'should print "To run Storybook, run" with the command' , async ( ) => {
192- const cmd = new FinalizationCommand ( undefined , false , false , false ) ;
221+ const cmd = new FinalizationCommand ( {
222+ logfile : undefined ,
223+ showAgentFollowUp : false ,
224+ showAiInstructions : false ,
225+ } ) ;
193226 vi . mocked ( find . up ) . mockReturnValue ( undefined ) ;
194227
195228 await cmd . execute ( { storybookCommand : 'npm run storybook' } ) ;
@@ -199,7 +232,11 @@ describe('FinalizationCommand', () => {
199232 } ) ;
200233
201234 it ( 'should not print storybook command message when storybookCommand is null' , async ( ) => {
202- const cmd = new FinalizationCommand ( undefined , false , false , false ) ;
235+ const cmd = new FinalizationCommand ( {
236+ logfile : undefined ,
237+ showAgentFollowUp : false ,
238+ showAiInstructions : false ,
239+ } ) ;
203240 vi . mocked ( find . up ) . mockReturnValue ( undefined ) ;
204241
205242 await cmd . execute ( { storybookCommand : null } ) ;
@@ -210,13 +247,12 @@ describe('FinalizationCommand', () => {
210247 } ) ;
211248
212249 describe ( 'executeFinalization helper' , ( ) => {
213- it ( 'should pass agent and showAiInstructions to FinalizationCommand ' , async ( ) => {
250+ it ( 'should show agent follow-up when showAgentFollowUp=true ' , async ( ) => {
214251 vi . mocked ( find . up ) . mockReturnValue ( undefined ) ;
215252
216253 await executeFinalization ( {
217- agent : true ,
254+ showAgentFollowUp : true ,
218255 showAiInstructions : false ,
219- isAiPrepareAvailable : true ,
220256 logfile : undefined ,
221257 } ) ;
222258
@@ -230,9 +266,8 @@ describe('FinalizationCommand', () => {
230266 vi . mocked ( find . up ) . mockReturnValue ( undefined ) ;
231267
232268 await executeFinalization ( {
233- agent : false ,
269+ showAgentFollowUp : false ,
234270 showAiInstructions : true ,
235- isAiPrepareAvailable : false ,
236271 logfile : undefined ,
237272 } ) ;
238273
@@ -245,9 +280,8 @@ describe('FinalizationCommand', () => {
245280 vi . mocked ( find . up ) . mockReturnValue ( undefined ) ;
246281
247282 await executeFinalization ( {
248- agent : false ,
283+ showAgentFollowUp : false ,
249284 showAiInstructions : false ,
250- isAiPrepareAvailable : false ,
251285 logfile : undefined ,
252286 storybookCommand : 'yarn storybook' ,
253287 } ) ;
0 commit comments