Merged via squash. Prepared head SHA: f2433790941841ade0efe6292ff4909b2edd6f18 Co-authored-by: huntharo <5617868+huntharo@users.noreply.github.com> Co-authored-by: huntharo <5617868+huntharo@users.noreply.github.com> Reviewed-by: @huntharo
19 lines
722 B
TypeScript
19 lines
722 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { buildTelegramExecApprovalButtons } from "./approval-buttons.js";
|
|
|
|
describe("telegram approval buttons", () => {
|
|
it("builds allow-once/allow-always/deny buttons", () => {
|
|
expect(buildTelegramExecApprovalButtons("fbd8daf7")).toEqual([
|
|
[
|
|
{ text: "Allow Once", callback_data: "/approve fbd8daf7 allow-once" },
|
|
{ text: "Allow Always", callback_data: "/approve fbd8daf7 allow-always" },
|
|
],
|
|
[{ text: "Deny", callback_data: "/approve fbd8daf7 deny" }],
|
|
]);
|
|
});
|
|
|
|
it("skips buttons when callback_data exceeds Telegram limit", () => {
|
|
expect(buildTelegramExecApprovalButtons(`a${"b".repeat(60)}`)).toBeUndefined();
|
|
});
|
|
});
|