mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-16 23:52:40 -06:00
test(telegram): use model selection rejection seam
This commit is contained in:
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);
|
||||
|
||||
Reference in New Issue
Block a user