test(telegram): use model selection rejection seam

This commit is contained in:
Vincent Koc
2026-08-07 21:53:34 +08:00
committed by Peter Steinberger
parent daca53c985
commit cdd621eaee
@@ -43,7 +43,6 @@ const harness = await import("./bot.create-telegram-bot.test-harness.js");
const pluginStateTestRuntime = await import("openclaw/plugin-sdk/plugin-state-test-runtime");
const configMutation = await import("openclaw/plugin-sdk/config-mutation");
const modelSessionRuntime = await import("openclaw/plugin-sdk/model-session-runtime");
const sessionStoreRuntime = await import("openclaw/plugin-sdk/session-store-runtime");
const EYES_EMOJI = "\u{1F440}";
const tempStateDirs: string[] = [];
let previousStateDir: string | undefined;
@@ -5407,15 +5406,14 @@ describe("createTelegramBot", () => {
it("shows a permanent rejection when model selection is locked", async () => {
createTelegramBot({ token: "tok" });
const callbackHandler = getOnHandler("callback_query");
const patchSessionEntrySpy = vi
.spyOn(sessionStoreRuntime, "patchSessionEntry")
.mockImplementationOnce(async (params) => {
const getSessionEntrySpy = vi
.spyOn(telegramBotDepsForTest, "getSessionEntry")
.mockImplementationOnce(() => {
const entry = {
sessionId: "locked-session",
updatedAt: Date.now(),
modelSelectionLocked: true,
};
await params.update(entry, { existingEntry: entry });
return entry;
});
const ctx = makeCallbackRetryContext({
@@ -5427,7 +5425,7 @@ describe("createTelegramBot", () => {
try {
await expect(callbackHandler(ctx)).resolves.toBeUndefined();
} finally {
patchSessionEntrySpy.mockRestore();
getSessionEntrySpy.mockRestore();
}
expect(editMessageTextSpy).toHaveBeenCalledTimes(1);