@@ -666,8 +666,10 @@ describe("Slack live QA runtime helpers", () => {
666666 ? [
667667 {
668668 channelId : "C123456789" ,
669- text :
670- testCase . commentaryStyle === "lane" ? `💬 ${ commentaryMarker } ` : commentaryMarker ,
669+ text : testCase . commentaryStyle === "lane" ? "Working…" : commentaryMarker ,
670+ ...( testCase . commentaryStyle === "lane"
671+ ? { blockText : [ "Update" , commentaryMarker ] }
672+ : { } ) ,
671673 ts : testCase . commentaryTs ,
672674 } ,
673675 ]
@@ -1030,9 +1032,7 @@ describe("Slack live QA runtime helpers", () => {
10301032 } ,
10311033 } ) ,
10321034 ) ;
1033- expect ( run && "matchText" in run ? run . matchText : "" ) . toMatch (
1034- / ^ S L A C K _ Q A _ T A B L E _ D O N E _ [ A - Z 0 - 9 ] + $ / u,
1035- ) ;
1035+ expect ( run && "matchText" in run ? run . matchText : "" ) . toBe ( summaryText ) ;
10361036 } ) ;
10371037
10381038 it ( "verifies the SUT-owned native table and exact accessible top-level text" , async ( ) => {
@@ -1153,17 +1153,8 @@ describe("Slack live QA runtime helpers", () => {
11531153
11541154 it ( "proves the public Slack send path stores one complete formatting-disabled fallback" , async ( ) => {
11551155 const probe = testing . buildSlackInvalidBlocksTableProbe ( ) ;
1156- const invalidBlocksError = Object . assign ( new Error ( "An API error occurred: invalid_blocks" ) , {
1157- code : "slack_webapi_platform_error" ,
1158- data : { error : "invalid_blocks" , ok : false } ,
1159- } ) ;
1160- let apiAttempt = 0 ;
11611156 let storedPayload : Record < string , unknown > | undefined ;
11621157 const postMessage = vi . fn ( async ( payload : Record < string , unknown > ) => {
1163- apiAttempt += 1 ;
1164- if ( apiAttempt === 1 ) {
1165- throw invalidBlocksError ;
1166- }
11671158 storedPayload = payload ;
11681159 return { channel : "C123456789" , ok : true , ts : "2.000000" } ;
11691160 } ) ;
@@ -1201,18 +1192,11 @@ describe("Slack live QA runtime helpers", () => {
12011192 timeoutMs : 0 ,
12021193 } ) ;
12031194
1204- expect ( postMessage ) . toHaveBeenCalledTimes ( 2 ) ;
1205- const [ nativeRequest ] = postMessage . mock . calls [ 0 ] ?? [ ] ;
1206- const [ fallbackRequest ] = postMessage . mock . calls [ 1 ] ?? [ ] ;
1207- const nativeBlocks = nativeRequest ?. blocks as Array < { rows ?: unknown [ ] ; type ?: string } > ;
1208- expect ( nativeRequest ) . toMatchObject ( { mrkdwn : false } ) ;
1209- expect ( nativeBlocks ) . toHaveLength ( 1 ) ;
1210- expect ( nativeBlocks [ 0 ] ) . toMatchObject ( { type : "data_table" } ) ;
1211- expect ( nativeBlocks [ 0 ] ?. rows ) . toHaveLength ( 102 ) ;
1195+ expect ( postMessage ) . toHaveBeenCalledTimes ( 1 ) ;
1196+ const [ fallbackRequest ] = postMessage . mock . calls [ 0 ] ?? [ ] ;
12121197 expect ( fallbackRequest ) . not . toHaveProperty ( "blocks" ) ;
12131198 expect ( fallbackRequest ) . toMatchObject ( { mrkdwn : false } ) ;
12141199 const fallbackText = typeof fallbackRequest ?. text === "string" ? fallbackRequest . text : "" ;
1215- expect ( fallbackText ) . toBe ( nativeRequest ?. text ) ;
12161200 expect ( fallbackText . split ( "\n" ) ) . toContain ( probe . firstRowText ) ;
12171201 expect ( fallbackText . split ( "\n" ) ) . toContain ( probe . finalRowText ) ;
12181202 expect ( result . message ) . toMatchObject ( {
@@ -1226,7 +1210,7 @@ describe("Slack live QA runtime helpers", () => {
12261210 expect ( sutWriteClient . chat . postMessage ) . toBe ( postMessage ) ;
12271211 } ) ;
12281212
1229- it ( "fails with sanitized evidence when Slack returns a different first API code " , async ( ) => {
1213+ it ( "reports the real Slack error when the fallback request fails " , async ( ) => {
12301214 const postMessage = vi . fn ( async ( ) => {
12311215 throw Object . assign ( new Error ( "do not persist this raw platform detail" ) , {
12321216 data : { error : "invalid_arguments" , ok : false } ,
@@ -1254,13 +1238,11 @@ describe("Slack live QA runtime helpers", () => {
12541238 sutWriteClient : sutWriteClient as never ,
12551239 timeoutMs : 0 ,
12561240 } ) ,
1257- ) . rejects . toThrow (
1258- "expected first Slack API failure code invalid_blocks; observed invalid_arguments" ,
1259- ) ;
1241+ ) . rejects . toThrow ( "Slack fallback failed after invalid_blocks; observed invalid_arguments" ) ;
12601242 expect ( sutWriteClient . chat . postMessage ) . toBe ( postMessage ) ;
12611243 } ) ;
12621244
1263- it ( "does not expose an untrusted Slack API error value" , async ( ) => {
1245+ it ( "does not expose an untrusted Slack fallback error value" , async ( ) => {
12641246 const postMessage = vi . fn ( async ( ) => {
12651247 throw Object . assign ( new Error ( "private platform detail" ) , {
12661248 data : { error : "unsafe private detail" , ok : false } ,
@@ -1288,7 +1270,9 @@ describe("Slack live QA runtime helpers", () => {
12881270 sutWriteClient : sutWriteClient as never ,
12891271 timeoutMs : 0 ,
12901272 } ) ,
1291- ) . rejects . toThrow ( "expected first Slack API failure code invalid_blocks; observed none" ) ;
1273+ ) . rejects . toThrow (
1274+ "Slack fallback failed after invalid_blocks; observed no fallback API failure code" ,
1275+ ) ;
12921276 expect ( sutWriteClient . chat . postMessage ) . toBe ( postMessage ) ;
12931277 } ) ;
12941278
0 commit comments