feat: mail telegram and cron check
This commit is contained in:
1 parent
6e1d0a7568
commit
8b33242db1
6 files changed
+180
No files matched your search
@@ -0,0 +1,17 @@
|
||||
// tests/notify.test.ts
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
describe("notify message", () => {
|
||||
it("baut Erinnerungstext mit Restbetrag", async () => {
|
||||
const { buildReminderText } = await import("../lib/notify-text");
|
||||
expect(buildReminderText({ name: "Therme", restCents: 2550, ablaufdatum: "01.12.2026" })).toContain("25,50");
|
||||
});
|
||||
it("sendTelegram ruft Bot-API mit chat_id", async () => {
|
||||
const fetchMock = vi.fn().mockResolvedValue({ ok: true, json: async () => ({ ok: true }) });
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
const { sendTelegram } = await import("../lib/telegram");
|
||||
process.env.TELEGRAM_BOT_TOKEN = "test-token";
|
||||
await sendTelegram("123", "hallo");
|
||||
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining("test-token"), expect.anything());
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user