@@ -46,14 +46,12 @@ import { ORG_1_ID, BRAND_1_ID } from '../seed-ids.js';
4646 * decommissions, `DELETE markets` removes a slice.
4747 * - The sub-workspace ROUND-TRIP (read-back): a created+published market lists in
4848 * `GET markets` as `live`, resolves via `GET markets/:slice`, and a prompt
49- * attaches to that slice and lists back (with text dedup). This needs the PE
50- * mock round-trip fix (adobe/spacecat-shared#1745, PR #1746): the project
51- * read-view must echo the ISO language code so the transport's `langOf` can
52- * derive the slice, and `publish` must flip `publish_status` -> `live`. The
53- * published image <= 1.3.1 does NOT, so that block is guarded by a one-shot
54- * capability probe — it SKIPS against the old image (suite stays green) and
55- * auto-activates once the client (hence the pinned mock tag) is bumped to the
56- * released round-trip mock. Verified to PASS against a local build of #1746.
49+ * attaches to that slice and lists back (with text dedup). This relies on the PE
50+ * mock round-trip fix (adobe/spacecat-shared#1745, PR #1746, shipped in PE
51+ * >= 1.3.2 / UM >= 1.3.1): the project read-view echoes the ISO language code so
52+ * the transport's `langOf` derives the slice, and `publish` flips
53+ * `publish_status` -> `live`. Pinned by the bumped client deps, so it runs
54+ * unconditionally.
5755 */
5856export default function serenityTests ( getHttpClient , resetData , resetMocks = async ( ) => { } ) {
5957 // Seed the baseline org/brand rows the catalog + brand-resolution tests read.
@@ -250,7 +248,7 @@ export default function serenityTests(getHttpClient, resetData, resetMocks = asy
250248 // OPERATIONS return their real 2xx. The full round-trip (a created market then
251249 // appearing in GET markets / GET markets/:slice, and a prompt created against
252250 // that slice) is asserted in the separate "sub-workspace round-trip" describe
253- // below, which is capability-gated on the PE mock round-trip fix (#1745/#1746).
251+ // below, enabled by the PE mock round-trip fix (#1745/#1746, PE >= 1.3.2 ).
254252 beforeEach ( async ( ) => {
255253 await resetData ( ) ;
256254 await resetMocks ( ) ;
@@ -303,53 +301,22 @@ export default function serenityTests(getHttpClient, resetData, resetMocks = asy
303301 } ) ;
304302 } ) ;
305303
306- describe ( 'Serenity API — sub-workspace round-trip (live mock, requires #1745 fix)' , ( ) => {
307- // The read-back assertions below require the PE mock to ROUND-TRIP a created+
308- // published market (adobe/spacecat-shared#1745, fixed by PR #1746): its project
309- // read-view must echo the ISO language code (so the transport's `langOf` derives
310- // the slice's languageCode) and `publish` must flip `publish_status` -> `live`.
311- // The currently-published mock image (<= 1.3.1) does NOT, so a created market is
312- // dropped from `GET markets` and never resolves. Rather than fail against the old
313- // image, a one-shot capability probe in `before()` skips these when the booted
314- // mock cannot round-trip — the suite stays green on the published image and these
315- // auto-activate the moment the client (hence the pinned mock image) is bumped to
316- // the released round-trip mock. Verified to PASS against a local build of the
317- // #1746 (feat/1745) mock.
304+ describe ( 'Serenity API — sub-workspace round-trip (live mock)' , ( ) => {
305+ // Read-back: a created+published market lists in `GET markets` as `live`,
306+ // resolves via `GET markets/:slice`, and a prompt attaches to that slice and
307+ // lists back (with text dedup). This is the contract the PE mock round-trip fix
308+ // guarantees (adobe/spacecat-shared#1745, PR #1746): the project read-view echoes
309+ // the ISO language code (so the transport's `langOf` derives the slice) and
310+ // `publish` flips `publish_status` -> `live`. Pinned by the bumped client deps
311+ // (PE >= 1.3.2 / UM >= 1.3.1, which select the round-trip mock image), so these
312+ // run unconditionally — a regression in the mock or transport fails loudly here.
318313 const base = `/v2/orgs/${ ORG_1_ID } /brands/${ BRAND_1_ID } /serenity` ;
319314 const US_GEO = 2840 ; // US resolves to Google geoTargetId 2840.
320315 const createUsMarket = ( ) => getHttpClient ( ) . admin . post ( `${ base } /markets` , {
321316 market : 'US' , languageCode : 'en' , brandDomain : 'example.com' , brandNames : [ 'Test Brand' ] ,
322317 } ) ;
323318
324- let roundTripSupported = false ;
325- before ( async ( ) => {
326- await resetData ( ) ;
327- await resetMocks ( ) ;
328- // Probe the booted mock: create+publish a market, then see if it lists back.
329- const created = await createUsMarket ( ) ;
330- if ( created . status === 201 ) {
331- const list = await getHttpClient ( ) . admin . get ( `${ base } /markets` ) ;
332- roundTripSupported = Array . isArray ( list . body ?. items )
333- && list . body . items . some ( ( m ) => m . geoTargetId === US_GEO && m . languageCode === 'en' ) ;
334- }
335- if ( ! roundTripSupported ) {
336- // eslint-disable-next-line no-console
337- console . warn (
338- '[serenity IT] booted PE mock does not round-trip a created market — '
339- + 'skipping read-back assertions (requires the adobe/spacecat-shared#1745 fix, PR #1746). '
340- + 'Bump @adobe/spacecat-shared-project-engine-client to the released round-trip mock to enable.' ,
341- ) ;
342- }
343- // Leave a clean store whether or not the probe found support (the skip path
344- // below does NOT reset, so clean up the probe's mutation here).
345- await resetData ( ) ;
346- await resetMocks ( ) ;
347- } ) ;
348-
349- beforeEach ( async function gate ( ) {
350- if ( ! roundTripSupported ) {
351- this . skip ( ) ;
352- }
319+ beforeEach ( async ( ) => {
353320 await resetData ( ) ;
354321 await resetMocks ( ) ;
355322 } ) ;
0 commit comments