@@ -308,6 +308,60 @@ describe('describePlan', () => {
308308 } )
309309 } )
310310
311+ it ( 'an inherited or unpriced figure names the card last when it differs from the device' , ( ) => {
312+ const card = 'mps Apple M5 Pro (MPS)'
313+ const inherited = {
314+ ...base . estimate ,
315+ device : 'mps' ,
316+ basis : 'inherited' as const ,
317+ inherited_from : 'templates/text-to-image' ,
318+ priced_for : card ,
319+ }
320+ const [ , firm ] = describePlan ( { ...base , estimate : inherited } )
321+ expect ( firm ) . toEqual ( {
322+ text : `~42 min, inherited from templates/text-to-image - for ${ card } ` ,
323+ tone : 'plain' ,
324+ } )
325+ const [ , thin ] = describePlan ( {
326+ ...base ,
327+ estimate : { ...inherited , low_confidence : true } ,
328+ } )
329+ expect ( thin ) . toEqual ( {
330+ text : `~42 min, inherited from templates/text-to-image, low confidence - for ${ card } ` ,
331+ tone : 'warn' ,
332+ } )
333+ const unknown = {
334+ ...inherited ,
335+ minutes : null ,
336+ basis : 'unknown' as const ,
337+ measured_on : null ,
338+ cached_minutes : null ,
339+ }
340+ const [ , withheld ] = describePlan ( {
341+ ...base ,
342+ estimate : { ...unknown , withheld : 'frames differ' } ,
343+ } )
344+ expect ( withheld ) . toEqual ( {
345+ text : `no figure - withheld (not priced from templates/text-to-image) - for ${ card } ` ,
346+ tone : 'warn' ,
347+ } )
348+ const [ , reason ] = describePlan ( {
349+ ...base ,
350+ estimate : { ...unknown , inherited_from : undefined , unpriced_reason : 'no run here' } ,
351+ } )
352+ expect ( reason . text ) . toBe ( `no figure - no run here - for ${ card } ` )
353+ const [ , bare ] = describePlan ( {
354+ ...base ,
355+ estimate : { ...unknown , inherited_from : undefined } ,
356+ } )
357+ expect ( bare . text ) . toBe ( `no measured cost - for ${ card } ` )
358+ const [ , same ] = describePlan ( {
359+ ...base ,
360+ estimate : { ...inherited , priced_for : 'mps' } ,
361+ } )
362+ expect ( same . text ) . toBe ( '~42 min, inherited from templates/text-to-image' )
363+ } )
364+
311365 it ( 'an unpriced reason replaces the bare no measured cost' , ( ) => {
312366 const [ , figure ] = describePlan ( {
313367 ...base ,
0 commit comments