From f55fdc6ae588f75158c3bb2cb2aa37a758156272 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 9 May 2026 00:43:21 +0100 Subject: [PATCH] test: simplify host hook context joining --- .../contracts/host-hooks.contract.test.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/plugins/contracts/host-hooks.contract.test.ts b/src/plugins/contracts/host-hooks.contract.test.ts index 4b5cbdb21f3..04b6458220c 100644 --- a/src/plugins/contracts/host-hooks.contract.test.ts +++ b/src/plugins/contracts/host-hooks.contract.test.ts @@ -60,6 +60,16 @@ function requireFirstCommandRegistration( return registration; } +function joinContextFragments(...fragments: Array): string { + const present: string[] = []; + for (const fragment of fragments) { + if (fragment) { + present.push(fragment); + } + } + return present.join("\n\n"); +} + describe("host-hook fixture plugin contract", () => { afterEach(() => { setActivePluginRegistry(createEmptyPluginRegistry()); @@ -960,9 +970,11 @@ describe("host-hook fixture plugin contract", () => { ); expect( - [queuedContext.prependContext, queuedContext.appendContext, hookContext?.prependContext] - .filter(Boolean) - .join("\n\n"), + joinContextFragments( + queuedContext.prependContext, + queuedContext.appendContext, + hookContext?.prependContext, + ), ).toContain("approval workflow resumed"); expect(hookContext?.prependContext).toBe("fixture turn context"); });