@@ -319,10 +319,18 @@ for (const posture of ['isolated', 'group'] as const) {
319319 await ok ( await h . stack . apiAs ( h . operator , 'DELETE' , `/meta/view/${ name } ` ) ) ;
320320
321321 const pkg = `com.em.${ p } .opctl` ;
322- await ok ( await h . stack . apiAs ( h . operator , 'POST' , '/packages' , { id : pkg , name : 'opctl' , version : '1.0.0' , type : 'app' } ) , 201 ) ;
322+ // As in the /packages case: the package declares the CRM package, whose
323+ // object the view binds, and the publish line reads the receipt, because
324+ // a refused publish also answers 200.
325+ await ok ( await h . stack . apiAs ( h . operator , 'POST' , '/packages' ,
326+ { id : pkg , name : 'opctl' , version : '1.0.0' , type : 'app' , dependencies : { [ CRM_PKG ] : '*' } } ) , 201 ) ;
323327 await ok ( await h . stack . apiAs ( h . operator , 'PATCH' , `/packages/${ pkg } ` , { description : 'by the operator' } ) ) ;
324328 await ok ( await h . stack . apiAs ( h . operator , 'PUT' , `/meta/view/crm_lead.em_${ p } _pkgv?package=${ pkg } &mode=draft` , view ( `crm_lead.em_${ p } _pkgv` , 'v1' ) ) ) ;
325- await ok ( await h . stack . apiAs ( h . operator , 'POST' , `/packages/${ pkg } /publish-drafts` , { } ) ) ;
329+ const published = await h . stack . apiAs ( h . operator , 'POST' , `/packages/${ pkg } /publish-drafts` , { } ) ;
330+ await ok ( published ) ;
331+ const receipt = ( ( await published . json ( ) ) as { data ?: Record < string , unknown > } ) . data ;
332+ expect ( { success : receipt ?. success , outcome : receipt ?. outcome , publishedCount : receipt ?. publishedCount } , JSON . stringify ( receipt ?. failed ) )
333+ . toEqual ( { success : true , outcome : 'published' , publishedCount : 1 } ) ;
326334 await ok ( await h . stack . apiAs ( h . operator , 'POST' , `/packages/${ pkg } /duplicate` , { targetPackageId : `com.em.${ p } .opctl.copy` } ) ) ;
327335 await ok ( await h . stack . apiAs ( h . operator , 'DELETE' , `/packages/${ pkg } ` ) ) ;
328336
@@ -358,9 +366,16 @@ describe('[ADR-0131 D12 items 7–8 · D11] single (CONTROL): the refusal is ine
358366 await ok ( await h . stack . apiAs ( h . tokA , 'PUT' , '/meta/view/crm_lead.em_sin_view' , view ( 'crm_lead.em_sin_view' , 'View by A' ) ) ) ;
359367 await ok ( await h . stack . apiAs ( h . tokA , 'PUT' , '/meta/flow/em_sin_flow' , flow ( 'em_sin_flow' , 'Flow by A' ) ) ) ;
360368 expect ( await readAsB ( h , 'view' , 'crm_lead.em_sin_view' ) ) . toEqual ( { status : 200 , label : 'View by A' } ) ;
361- await ok ( await h . stack . apiAs ( h . tokA , 'POST' , '/packages' , { id : 'com.em.sin.a' , name : 'a' , version : '1.0.0' , type : 'app' } ) , 201 ) ;
369+ // As in the walled /packages case: the package declares the CRM package, and
370+ // the publish line reads the receipt.
371+ await ok ( await h . stack . apiAs ( h . tokA , 'POST' , '/packages' ,
372+ { id : 'com.em.sin.a' , name : 'a' , version : '1.0.0' , type : 'app' , dependencies : { [ CRM_PKG ] : '*' } } ) , 201 ) ;
362373 await ok ( await h . stack . apiAs ( h . tokA , 'PUT' , '/meta/view/crm_lead.em_sin_pv?package=com.em.sin.a&mode=draft' , view ( 'crm_lead.em_sin_pv' , 'v1' ) ) ) ;
363- await ok ( await h . stack . apiAs ( h . tokA , 'POST' , '/packages/com.em.sin.a/publish-drafts' , { } ) ) ;
374+ const published = await h . stack . apiAs ( h . tokA , 'POST' , '/packages/com.em.sin.a/publish-drafts' , { } ) ;
375+ await ok ( published ) ;
376+ const receipt = ( ( await published . json ( ) ) as { data ?: Record < string , unknown > } ) . data ;
377+ expect ( { success : receipt ?. success , outcome : receipt ?. outcome , publishedCount : receipt ?. publishedCount } , JSON . stringify ( receipt ?. failed ) )
378+ . toEqual ( { success : true , outcome : 'published' , publishedCount : 1 } ) ;
364379 await ok ( await h . stack . apiAs ( h . tokA , 'DELETE' , '/packages/com.em.sin.a' ) ) ;
365380 await ok ( await h . stack . apiAs ( h . tokA , 'POST' , INSTALL_LOCAL , packageBody ( 'com.em.sin.il' , '1.0.0' , [ object ( 'em_sin_ilobj' , 'v1' ) ] ) ) ) ;
366381 await ok ( await h . stack . apiAs ( h . tokA , 'DELETE' , `${ INSTALL_LOCAL } /com.em.sin.il` ) ) ;
0 commit comments