mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 00:40:44 +00:00
test: clarify boolean membership assertions
This commit is contained in:
@@ -495,7 +495,12 @@ describe("Discord model picker rendering", () => {
|
||||
throw new Error("models view did not render a provider select");
|
||||
}
|
||||
expect(providerSelect.options?.length).toBe(2);
|
||||
expect(providerSelect.options?.find((option) => option.value === "openai")?.default).toBe(true);
|
||||
expect(providerSelect.options).toContainEqual(
|
||||
expect.objectContaining({
|
||||
value: "openai",
|
||||
default: true,
|
||||
}),
|
||||
);
|
||||
const parsedProviderState = parseDiscordModelPickerCustomId(providerSelect.custom_id ?? "");
|
||||
expect(parsedProviderState?.action).toBe("provider");
|
||||
|
||||
@@ -506,7 +511,12 @@ describe("Discord model picker rendering", () => {
|
||||
throw new Error("models view did not render a model select");
|
||||
}
|
||||
expect(modelSelect.options?.length).toBe(3);
|
||||
expect(modelSelect.options?.find((option) => option.value === "o3")?.default).toBe(true);
|
||||
expect(modelSelect.options).toContainEqual(
|
||||
expect.objectContaining({
|
||||
value: "o3",
|
||||
default: true,
|
||||
}),
|
||||
);
|
||||
|
||||
const parsedModelSelectState = parseDiscordModelPickerCustomId(modelSelect.custom_id ?? "");
|
||||
expect(parsedModelSelectState?.action).toBe("model");
|
||||
@@ -577,7 +587,12 @@ describe("Discord model picker rendering", () => {
|
||||
expect(runtimeSelect.options?.find((option) => option.value === "pi")?.label).toBe(
|
||||
"OpenClaw Pi Default",
|
||||
);
|
||||
expect(runtimeSelect.options?.find((option) => option.value === "codex")?.default).toBe(true);
|
||||
expect(runtimeSelect.options).toContainEqual(
|
||||
expect.objectContaining({
|
||||
value: "codex",
|
||||
default: true,
|
||||
}),
|
||||
);
|
||||
|
||||
const submitButton = rows[3]?.components?.at(-1);
|
||||
const submitState = requireValue(
|
||||
|
||||
@@ -37,7 +37,12 @@ describe("QQBot framework slash commands", () => {
|
||||
expect.arrayContaining(["bot-approve", "bot-clear-storage", "bot-logs", "bot-streaming"]),
|
||||
);
|
||||
for (const commandName of ["bot-approve", "bot-clear-storage", "bot-logs", "bot-streaming"]) {
|
||||
expect(commands.find((command) => command.name === commandName)?.c2cOnly).toBe(true);
|
||||
expect(commands).toContainEqual(
|
||||
expect.objectContaining({
|
||||
name: commandName,
|
||||
c2cOnly: true,
|
||||
}),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -60,7 +65,12 @@ describe("QQBot framework slash commands", () => {
|
||||
const commands = registry.getFrameworkCommands();
|
||||
|
||||
expect(commands.map((command) => command.name)).toEqual(["private-admin", "shared-admin"]);
|
||||
expect(commands.find((command) => command.name === "private-admin")?.c2cOnly).toBe(true);
|
||||
expect(commands).toContainEqual(
|
||||
expect.objectContaining({
|
||||
name: "private-admin",
|
||||
c2cOnly: true,
|
||||
}),
|
||||
);
|
||||
expect(commands.find((command) => command.name === "shared-admin")?.c2cOnly).toBeUndefined();
|
||||
});
|
||||
|
||||
|
||||
@@ -157,8 +157,18 @@ describe("buildWorkspaceSkillStatus", () => {
|
||||
expect(report.agentId).toBe("specialist");
|
||||
expect(report.agentSkillFilter).toEqual(["alpha"]);
|
||||
expect(report.skills.find((skill) => skill.name === "alpha")?.blockedByAgentFilter).toBe(false);
|
||||
expect(report.skills.find((skill) => skill.name === "alpha")?.modelVisible).toBe(true);
|
||||
expect(report.skills.find((skill) => skill.name === "beta")?.blockedByAgentFilter).toBe(true);
|
||||
expect(report.skills).toContainEqual(
|
||||
expect.objectContaining({
|
||||
name: "alpha",
|
||||
modelVisible: true,
|
||||
}),
|
||||
);
|
||||
expect(report.skills).toContainEqual(
|
||||
expect.objectContaining({
|
||||
name: "beta",
|
||||
blockedByAgentFilter: true,
|
||||
}),
|
||||
);
|
||||
expect(report.skills.find((skill) => skill.name === "beta")?.modelVisible).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ describe("inter-session lastRoute preservation (fixes #54441)", () => {
|
||||
isInterSession: true,
|
||||
});
|
||||
// No external route existed — falls through to normal resolution (webchat or undefined).
|
||||
expect(result === "webchat" || result === undefined).toBe(true);
|
||||
expect(["webchat", undefined]).toContain(result);
|
||||
});
|
||||
|
||||
it("inter-session on session with no persisted lastTo preserves session route", () => {
|
||||
@@ -73,7 +73,7 @@ describe("inter-session lastRoute preservation (fixes #54441)", () => {
|
||||
isInterSession: true,
|
||||
});
|
||||
// No external route — falls through to normal resolution
|
||||
expect(result === "session:somekey" || result === undefined).toBe(true);
|
||||
expect(["session:somekey", undefined]).toContain(result);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user