test: tighten discord model picker render assertions

This commit is contained in:
Shakker
2026-05-10 21:06:47 +01:00
parent 264c8e286e
commit ec9e2da658

View File

@@ -393,7 +393,7 @@ describe("Discord model picker rendering", () => {
});
expect(providerButtons).toHaveLength(Object.keys(entries).length);
const customIds = allButtons.map((component) => component.custom_id ?? "");
expect(customIds).not.toEqual(expect.arrayContaining([expect.stringContaining(";a=nav;")]));
expect(customIds.every((customId) => !customId.includes(";a=nav;"))).toBe(true);
});
it("does not render navigation buttons even when provider count exceeds one page", () => {
@@ -419,7 +419,7 @@ describe("Discord model picker rendering", () => {
const allButtons = rows.flatMap((row) => row.components ?? []);
const customIds = allButtons.map((component) => component.custom_id ?? "");
expect(customIds).not.toEqual(expect.arrayContaining([expect.stringContaining(";a=nav;")]));
expect(customIds.every((customId) => !customId.includes(";a=nav;"))).toBe(true);
});
it("supports classic fallback rendering with content + action rows", () => {
@@ -495,12 +495,10 @@ 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).toContainEqual(
expect.objectContaining({
value: "openai",
default: true,
}),
const openaiProviderOption = providerSelect.options?.find(
(option) => option.value === "openai",
);
expect(openaiProviderOption?.default).toBe(true);
const parsedProviderState = parseDiscordModelPickerCustomId(providerSelect.custom_id ?? "");
expect(parsedProviderState?.action).toBe("provider");
@@ -511,12 +509,8 @@ 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).toContainEqual(
expect.objectContaining({
value: "o3",
default: true,
}),
);
const o3ModelOption = modelSelect.options?.find((option) => option.value === "o3");
expect(o3ModelOption?.default).toBe(true);
const parsedModelSelectState = parseDiscordModelPickerCustomId(modelSelect.custom_id ?? "");
expect(parsedModelSelectState?.action).toBe("model");
@@ -587,12 +581,8 @@ describe("Discord model picker rendering", () => {
expect(runtimeSelect.options?.find((option) => option.value === "pi")?.label).toBe(
"OpenClaw Pi Default",
);
expect(runtimeSelect.options).toContainEqual(
expect.objectContaining({
value: "codex",
default: true,
}),
);
const codexRuntimeOption = runtimeSelect.options?.find((option) => option.value === "codex");
expect(codexRuntimeOption?.default).toBe(true);
const submitButton = rows[3]?.components?.at(-1);
const submitState = requireValue(