fix: stop partial replies for whatsapp/telegram surfaces

This commit is contained in:
Peter Steinberger
2025-12-09 01:40:51 +01:00
parent e44ed2681f
commit 5bfecc6152
6 changed files with 107 additions and 88 deletions

View File

@@ -5,8 +5,8 @@ import {
detectRuntime,
isAtLeast,
parseSemver,
runtimeSatisfies,
type RuntimeDetails,
runtimeSatisfies,
} from "./runtime-guard.js";
describe("runtime-guard", () => {
@@ -17,9 +17,24 @@ describe("runtime-guard", () => {
});
it("compares versions correctly", () => {
expect(isAtLeast({ major: 22, minor: 0, patch: 0 }, { major: 22, minor: 0, patch: 0 })).toBe(true);
expect(isAtLeast({ major: 22, minor: 1, patch: 0 }, { major: 22, minor: 0, patch: 0 })).toBe(true);
expect(isAtLeast({ major: 21, minor: 9, patch: 0 }, { major: 22, minor: 0, patch: 0 })).toBe(false);
expect(
isAtLeast(
{ major: 22, minor: 0, patch: 0 },
{ major: 22, minor: 0, patch: 0 },
),
).toBe(true);
expect(
isAtLeast(
{ major: 22, minor: 1, patch: 0 },
{ major: 22, minor: 0, patch: 0 },
),
).toBe(true);
expect(
isAtLeast(
{ major: 21, minor: 9, patch: 0 },
{ major: 22, minor: 0, patch: 0 },
),
).toBe(false);
});
it("validates runtime thresholds", () => {
@@ -49,7 +64,9 @@ describe("runtime-guard", () => {
pathEnv: "/usr/bin",
};
expect(() => assertSupportedRuntime(runtime, details)).toThrow("exit");
expect(runtime.error).toHaveBeenCalledWith(expect.stringContaining("requires Node"));
expect(runtime.error).toHaveBeenCalledWith(
expect.stringContaining("requires Node"),
);
});
it("returns silently when runtime meets requirements", () => {
@@ -68,4 +85,3 @@ describe("runtime-guard", () => {
expect(runtime.exit).not.toHaveBeenCalled();
});
});