Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

935 B
Raw Blame
import { describe, expect, it } from "vitest";
import { normalizeTelegramUpdate, verifyTelegramSecret } from "./telegram";

describe("telegram channel adapter", () => {
  it("validates the configured webhook secret with constant-time semantics", () => {
    const values = { webhookSecret: "secret_123" };
    expect(verifyTelegramSecret(values, "secret_123")).toBe(true);
    expect(verifyTelegramSecret(values, "secret_124")).toBe(false);
    expect(verifyTelegramSecret({}, "secret_123")).toBe(false);
  });

  it("normalizes message updates without changing provider payload semantics", () => {
    const event = normalizeTelegramUpdate({
      update_id: 42,
      message: { text: "hello", chat: { id: -100123 }, from: { id: 7 } },
    });
    expect(event).toMatchObject({
      provider: "telegram",
      eventId: "42",
      kind: "message",
      target: "-100123",
      sender: "7",
      text: "hello",
    });
  });
});