test: clarify telegram command assertions

This commit is contained in:
Peter Steinberger
2026-05-08 11:57:18 +01:00
parent 2a8565ea67
commit 7dc6a79905
4 changed files with 7 additions and 7 deletions

View File

@@ -23,7 +23,7 @@ function warningLines(): string[] {
}
function expectNoMissingDefaultWarning() {
expect(warningLines().every((line) => !line.includes("accounts.default is missing"))).toBe(true);
expect(warningLines().filter((line) => line.includes("accounts.default is missing"))).toEqual([]);
}
function resolveAccountWithEnv(

View File

@@ -69,8 +69,8 @@ describe("bot-native-command-menu", () => {
0,
);
expect(totalText).toBeLessThanOrEqual(TELEGRAM_TOTAL_COMMAND_TEXT_BUDGET);
expect(result.commandsToRegister.every((command) => command.description.length <= 56)).toBe(
true,
expect(result.commandsToRegister.filter((command) => command.description.length > 56)).toEqual(
[],
);
});

View File

@@ -82,7 +82,7 @@ describe("registerTelegramNativeCommands skill allowlist integration", () => {
const registeredCommands = await waitForRegisteredCommands(setMyCommands);
expect(registeredCommands.some((entry) => entry.command === "alpha_skill")).toBe(true);
expect(registeredCommands.some((entry) => entry.command === "beta_skill")).toBe(false);
expect(registeredCommands.map((entry) => entry.command)).toContain("alpha_skill");
expect(registeredCommands.map((entry) => entry.command)).not.toContain("beta_skill");
});
});

View File

@@ -116,7 +116,7 @@ describe("markdownToTelegramHtml", () => {
it("splits long multiline html text without breaking balanced tags", () => {
const chunks = splitTelegramHtmlChunks(`<b>${"A\n".repeat(2500)}</b>`, 4000);
expect(chunks.length).toBeGreaterThan(1);
expect(chunks.every((chunk) => chunk.length <= 4000)).toBe(true);
expect(chunks.filter((chunk) => chunk.length > 4000)).toEqual([]);
expect(chunks[0]).toMatch(/^<b>[\s\S]*<\/b>$/);
expect(chunks[1]).toMatch(/^<b>[\s\S]*<\/b>$/);
});
@@ -128,7 +128,7 @@ describe("markdownToTelegramHtml", () => {
it("treats malformed leading ampersands as plain text when chunking html", () => {
const chunks = splitTelegramHtmlChunks(`&${"A".repeat(5000)}`, 4000);
expect(chunks.length).toBeGreaterThan(1);
expect(chunks.every((chunk) => chunk.length <= 4000)).toBe(true);
expect(chunks.filter((chunk) => chunk.length > 4000)).toEqual([]);
});
it("fails loudly when tag overhead leaves no room for text", () => {