mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 00:30:43 +00:00
test: simplify host hook context joining
This commit is contained in:
@@ -60,6 +60,16 @@ function requireFirstCommandRegistration(
|
||||
return registration;
|
||||
}
|
||||
|
||||
function joinContextFragments(...fragments: Array<string | undefined>): 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");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user