@@ -231,7 +231,12 @@ describe("nostr inbound gateway path", () => {
231231
232232 it ( "strips internal tool-trace banners before inbound DM replies" , async ( ) => {
233233 const toolTraceText = "Done.\n⚠️ 🛠️ `search repos (agent)` failed" ;
234- const { harness, cleanup } = await startGatewayHarness ( {
234+ mocks . dispatchInboundDirectDm . mockImplementationOnce (
235+ async ( params : Parameters < typeof DispatchInboundDirectDm > [ 0 ] ) => {
236+ await params . deliver ( { text : toolTraceText } ) ;
237+ } ,
238+ ) ;
239+ const { cleanup } = await startGatewayHarness ( {
235240 account : buildResolvedNostrAccount ( {
236241 publicKey : "bot-pubkey" ,
237242 config : { dmPolicy : "allowlist" , allowFrom : [ "nostr:sender-pubkey" ] } ,
@@ -242,12 +247,6 @@ describe("nostr inbound gateway path", () => {
242247 } as never ,
243248 } ) ;
244249
245- harness . dispatchReplyWithBufferedBlockDispatcher . mockImplementation (
246- async ( { dispatcherOptions } ) => {
247- await dispatcherOptions . deliver ( { text : toolTraceText } ) ;
248- } ,
249- ) ;
250-
251250 const options = mockCallArg ( mocks . startNostrBus ) as {
252251 onMessage : (
253252 senderPubkey : string ,
@@ -285,7 +284,12 @@ describe("nostr inbound gateway path", () => {
285284
286285 it ( "drops inbound DM replies that contain only internal tool-trace banners" , async ( ) => {
287286 const toolTraceOnlyText = "⚠️ 🛠️ `search repos (agent)` failed" ;
288- const { harness, cleanup } = await startGatewayHarness ( {
287+ mocks . dispatchInboundDirectDm . mockImplementationOnce (
288+ async ( params : Parameters < typeof DispatchInboundDirectDm > [ 0 ] ) => {
289+ await params . deliver ( { text : toolTraceOnlyText } ) ;
290+ } ,
291+ ) ;
292+ const { cleanup } = await startGatewayHarness ( {
289293 account : buildResolvedNostrAccount ( {
290294 publicKey : "bot-pubkey" ,
291295 config : { dmPolicy : "allowlist" , allowFrom : [ "nostr:sender-pubkey" ] } ,
@@ -296,12 +300,6 @@ describe("nostr inbound gateway path", () => {
296300 } as never ,
297301 } ) ;
298302
299- harness . dispatchReplyWithBufferedBlockDispatcher . mockImplementation (
300- async ( { dispatcherOptions } ) => {
301- await dispatcherOptions . deliver ( { text : toolTraceOnlyText } ) ;
302- } ,
303- ) ;
304-
305303 const options = mockCallArg ( mocks . startNostrBus ) as {
306304 onMessage : (
307305 senderPubkey : string ,
0 commit comments