@@ -15,6 +15,11 @@ import type {B2CInstance} from '@salesforce/b2c-tooling-sdk';
1515import type { DeployResult , DeployOptions , CodeVersion } from '@salesforce/b2c-tooling-sdk/operations/code' ;
1616import type { WebDavClient , OcapiClient } from '@salesforce/b2c-tooling-sdk/clients' ;
1717
18+ /** Tool output: DeployResult plus postInstructions reminder. */
19+ interface CartridgeDeployOutput extends DeployResult {
20+ postInstructions ?: string ;
21+ }
22+
1823/**
1924 * Helper to extract text from a ToolResult.
2025 * Throws if the first content item is not a text type.
@@ -117,6 +122,9 @@ describe('tools/cartridges', () => {
117122 expect ( desc ) . to . include ( 'Finds and deploys cartridges' ) ;
118123 expect ( desc ) . to . include ( 'B2C Commerce' ) ;
119124 expect ( desc ) . to . include ( 'WebDAV' ) ;
125+ expect ( desc ) . to . include ( 'Sites → Manage Sites' ) ;
126+ expect ( desc ) . to . include ( 'Settings tab' ) ;
127+ expect ( desc ) . to . include ( 'Cartridges' ) ;
120128 } ) ;
121129
122130 it ( 'should be in CARTRIDGES toolset' , ( ) => {
@@ -166,9 +174,12 @@ describe('tools/cartridges', () => {
166174 expect ( options . include ) . to . be . undefined ;
167175 expect ( options . exclude ) . to . be . undefined ;
168176 expect ( options . reload ) . to . be . undefined ;
169- const jsonResult = getResultJson < DeployResult > ( result ) ;
177+ const jsonResult = getResultJson < CartridgeDeployOutput > ( result ) ;
170178 expect ( jsonResult . codeVersion ) . to . equal ( 'v1' ) ;
171179 expect ( jsonResult . cartridges ) . to . have . lengthOf ( 1 ) ;
180+ expect ( jsonResult . postInstructions ) . to . be . a ( 'string' ) ;
181+ expect ( jsonResult . postInstructions ) . to . include ( 'Sites → Manage Sites' ) ;
182+ expect ( jsonResult . postInstructions ) . to . include ( 'Cartridges field' ) ;
172183 } ) ;
173184
174185 it ( 'should call findAndDeployCartridges with custom directory' , async ( ) => {
@@ -196,8 +207,9 @@ describe('tools/cartridges', () => {
196207 expect ( findAndDeployCartridgesStub . calledOnce ) . to . be . true ;
197208 const [ , dir ] = findAndDeployCartridgesStub . firstCall . args as [ B2CInstance , string , DeployOptions ] ;
198209 expect ( dir ) . to . equal ( expectedResolvedPath ) ;
199- const jsonResult = getResultJson < DeployResult > ( result ) ;
210+ const jsonResult = getResultJson < CartridgeDeployOutput > ( result ) ;
200211 expect ( jsonResult . codeVersion ) . to . equal ( 'v2' ) ;
212+ expect ( jsonResult . postInstructions ) . to . include ( "site's cartridge path" ) ;
201213 } ) ;
202214
203215 it ( 'should pass cartridges array as include option' , async ( ) => {
@@ -313,7 +325,7 @@ describe('tools/cartridges', () => {
313325 expect ( options . reload ) . to . equal ( reload ) ;
314326 } ) ;
315327
316- it ( 'should return DeployResult as JSON' , async ( ) => {
328+ it ( 'should return DeployResult with postInstructions as JSON' , async ( ) => {
317329 const mockResult : DeployResult = {
318330 cartridges : [
319331 { name : 'app_storefront_base' , src : '/path/to/app' , dest : 'app_storefront_base' } ,
@@ -334,12 +346,17 @@ describe('tools/cartridges', () => {
334346 const result = await tool . handler ( { } ) ;
335347
336348 expect ( result . isError ) . to . be . undefined ;
337- const jsonResult = getResultJson < DeployResult > ( result ) ;
349+ const jsonResult = getResultJson < CartridgeDeployOutput > ( result ) ;
338350 expect ( jsonResult . codeVersion ) . to . equal ( 'v1.2.3' ) ;
339351 expect ( jsonResult . cartridges ) . to . have . lengthOf ( 2 ) ;
340352 expect ( jsonResult . reloaded ) . to . be . true ;
341353 expect ( jsonResult . cartridges [ 0 ] . name ) . to . equal ( 'app_storefront_base' ) ;
342354 expect ( jsonResult . cartridges [ 1 ] . name ) . to . equal ( 'app_core' ) ;
355+ expect ( jsonResult . postInstructions ) . to . be . a ( 'string' ) ;
356+ expect ( jsonResult . postInstructions ) . to . include ( 'Business Manager' ) ;
357+ expect ( jsonResult . postInstructions ) . to . include ( 'Sites → Manage Sites' ) ;
358+ expect ( jsonResult . postInstructions ) . to . include ( 'Settings tab' ) ;
359+ expect ( jsonResult . postInstructions ) . to . include ( 'Cartridges field' ) ;
343360 } ) ;
344361
345362 it ( 'should resolve relative directory paths relative to project directory' , async ( ) => {
@@ -485,8 +502,9 @@ describe('tools/cartridges', () => {
485502 expect ( getActiveCodeVersionStub . calledWith ( mockInstance ) ) . to . be . true ;
486503 expect ( mockInstance . config . codeVersion ) . to . equal ( 'v2' ) ;
487504 expect ( findAndDeployCartridgesStub . calledOnce ) . to . be . true ;
488- const jsonResult = getResultJson < DeployResult > ( result ) ;
505+ const jsonResult = getResultJson < CartridgeDeployOutput > ( result ) ;
489506 expect ( jsonResult . codeVersion ) . to . equal ( 'v2' ) ;
507+ expect ( jsonResult . postInstructions ) . to . be . a ( 'string' ) ;
490508 } ) ;
491509
492510 it ( 'should use existing codeVersion when already specified' , async ( ) => {
0 commit comments