KeiSeiKit-1.0/_ts_packages/packages/telegram-adapter/test/client.test.ts
Parfii-bot 0be354a920 KeiSeiKit-public — clean state
Single-commit clean baseline after security scrub of niche-tells,
project codenames, internal jargon, and contributor-email leaks.

Contents:
- 100 Rust crates (_primitives/_rust/)
- 37 agent manifests (_manifests/) + generated specs (_generated/)
- 67 user-invocable skills (skills/)
- 33 hooks (hooks/)
- Composition blocks (_blocks/)
- Documentation (docs/, README.md)
- TS adapter packages (_ts_packages/)
- Assembler (_assembler/)
- Roles (_roles/)
- Templates (_templates/)
- Forgejo CI (.forgejo/)

Author: Denis Parfionovich <info@greendragon.info>

License: see LICENSE.
2026-05-01 12:09:03 +08:00

26 lines
929 B
TypeScript

import { describe, it, expect } from "vitest";
import { TelegramClient } from "../src/client.js";
describe("TelegramClient cache", () => {
it("rejects empty token at construction", () => {
expect(() => new TelegramClient({ token: "" })).toThrow(/TELEGRAM_BOT_TOKEN/);
});
it("listGroups is empty by default", () => {
const c = new TelegramClient({ token: "123:ABC" });
expect(c.listGroups()).toEqual([]);
});
it("listContacts is empty by default", () => {
const c = new TelegramClient({ token: "123:ABC" });
expect(c.listContacts()).toEqual([]);
});
it("_seedContact and _seedGroup populate caches", () => {
const c = new TelegramClient({ token: "123:ABC" });
c._seedContact({ userId: 99, firstName: "Alice" });
c._seedGroup({ chatId: -100, title: "Test", type: "supergroup" });
expect(c.listContacts()).toHaveLength(1);
expect(c.listGroups()).toHaveLength(1);
});
});