Gateway tests: cover chat stop parsing variants

This commit is contained in:
Vincent Koc
2026-02-24 00:50:12 -05:00
parent 60c874bedd
commit 56042559c8

View File

@@ -1,6 +1,7 @@
import { describe, expect, it, vi } from "vitest";
import {
abortChatRunById,
isChatStopCommandText,
type ChatAbortOps,
type ChatAbortControllerEntry,
} from "./chat-abort.js";
@@ -42,6 +43,20 @@ function createOps(params: {
};
}
describe("isChatStopCommandText", () => {
it("matches slash and standalone multilingual stop forms", () => {
expect(isChatStopCommandText(" /STOP!!! ")).toBe(true);
expect(isChatStopCommandText("stop please")).toBe(true);
expect(isChatStopCommandText("停止")).toBe(true);
expect(isChatStopCommandText("やめて")).toBe(true);
expect(isChatStopCommandText("توقف")).toBe(true);
expect(isChatStopCommandText("stopp")).toBe(true);
expect(isChatStopCommandText("pare")).toBe(true);
expect(isChatStopCommandText("/status")).toBe(false);
expect(isChatStopCommandText("keep going")).toBe(false);
});
});
describe("abortChatRunById", () => {
it("broadcasts aborted payload with partial message when buffered text exists", () => {
const runId = "run-1";