@@ -22,8 +22,15 @@ vi.mock('@/journeys/lib/get-link-data', () => ({
2222
2323const mockGetLinkData = vi . mocked ( getLinkData )
2424
25+ const mockRenderContent = vi . fn ( async ( content : string , _context ?: unknown , _options ?: unknown ) => {
26+ void _context
27+ void _options
28+ return content
29+ } )
30+
2531vi . mock ( '@/content-render/index' , ( ) => ( {
26- renderContent : async ( content : string ) => content ,
32+ renderContent : ( content : string , context ?: unknown , options ?: unknown ) =>
33+ mockRenderContent ( content , context , options ) ,
2734} ) )
2835
2936vi . mock ( '@/languages/lib/render-with-fallback' , ( ) => ( {
@@ -204,6 +211,7 @@ describe('journey-path-resolver', () => {
204211 id : 'getting_started' ,
205212 title : 'Getting started with {% data variables.product.company_short %}' ,
206213 description : 'Learn the {% data variables.product.company_short %} basics' ,
214+ timeCommitment : '{% data variables.product.company_short %} 2-4 hours' ,
207215 guides : [
208216 { href : '/enterprise-onboarding/setup' } ,
209217 { href : '/enterprise-onboarding/config' } ,
@@ -213,6 +221,7 @@ describe('journey-path-resolver', () => {
213221 id : 'advanced' ,
214222 title : 'Advanced configuration' ,
215223 description : 'Advanced topics for experts' ,
224+ timeCommitment : '4-6 hours' ,
216225 guides : [ { href : '/enterprise-onboarding/advanced-setup' } ] ,
217226 } ,
218227 ]
@@ -237,6 +246,27 @@ describe('journey-path-resolver', () => {
237246 )
238247 } )
239248
249+ test ( 'propagates timeCommitment and renders Liquid with textOnly like title/description' , async ( ) => {
250+ mockRenderContent . mockClear ( )
251+ const result = await resolveJourneyTracks ( mockJourneyTracks , mockContext )
252+
253+ // Liquid value passes through the (passthrough) renderer; plain string is unchanged
254+ expect ( result [ 0 ] . timeCommitment ) . toBe ( '{% data variables.product.company_short %} 2-4 hours' )
255+ expect ( result [ 1 ] . timeCommitment ) . toBe ( '4-6 hours' )
256+
257+ // The Liquid-bearing timeCommitment should be rendered with { textOnly: true },
258+ // matching how title/description are rendered.
259+ const timeCommitmentCall = mockRenderContent . mock . calls . find (
260+ ( [ content ] ) => content === '{% data variables.product.company_short %} 2-4 hours' ,
261+ )
262+ expect ( timeCommitmentCall ) . toBeDefined ( )
263+ expect ( timeCommitmentCall ?. [ 2 ] ) . toEqual ( { textOnly : true } )
264+
265+ // Plain (non-Liquid) timeCommitment should not be sent through renderContent
266+ const plainCall = mockRenderContent . mock . calls . find ( ( [ content ] ) => content === '4-6 hours' )
267+ expect ( plainCall ) . toBeUndefined ( )
268+ } )
269+
240270 test ( 'resolves guide links with proper versioning' , async ( ) => {
241271 const result = await resolveJourneyTracks ( mockJourneyTracks , mockContext )
242272
@@ -275,6 +305,7 @@ describe('journey-path-resolver', () => {
275305 const result = await resolveJourneyTracks ( trackWithoutDescription , mockContext )
276306
277307 expect ( result [ 0 ] . description ) . toBeUndefined ( )
308+ expect ( result [ 0 ] . timeCommitment ) . toBeUndefined ( )
278309 } )
279310 } )
280311
0 commit comments