feat: initial commit - Table Expiration Watcher

- Monitor de tabelas de planos de saúde prestes a vencer/vencidas
- Stack: Bun + Hono + SQLite + Zod + date-fns
- Alertas via Telegram e WhatsApp (AstraCalls MCP)
- UI de configuração estilo Apple/Planium em /configs
- Scheduler periódico com intervalo configurável
- Testes unitários e de integração (30 testes passando)

Co-Authored-By: Coder <coder@agent.local>
Co-Authored-By: Review <review@agent.local>
Co-Authored-By: Testing <testing@agent.local>
This commit is contained in:
Andre RDS
2026-11-25 09:43:00 -03:00
co-authored by Coder Review Testing
commit 6e8e640738
29 changed files with 3218 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
import { test, expect, describe } from "bun:test";
import { AstraCallsClient } from "../../src/infrastructure/astracalls/astracalls-client.ts";
describe("AstraCallsClient", () => {
test("sendText: envia mensagem com bearer token", async () => {
let capturedHeaders: any = null;
const mockFetch = async (url: string, options: any) => {
capturedHeaders = options.headers;
return new Response(JSON.stringify({
jsonrpc: "2.0", id: 1,
result: { content: [{ type: "text", text: JSON.stringify({ messageId: "ok" }) }] }
}), { status: 200, headers: { "content-type": "application/json" } });
};
const c = new AstraCallsClient({
mcpUrl: "https://astra.test/mcp",
bearerToken: "my-secret-token",
}, mockFetch);
await c.sendText("5527999998888", "teste");
expect(capturedHeaders?.Authorization).toBe("Bearer my-secret-token");
});
test("sendText: timeout de 15s respeitado", async () => {
const mockFetch = async (url: string, options: any) => {
expect(options.signal).toBeDefined();
return new Response(JSON.stringify({
jsonrpc: "2.0", id: 1,
result: { content: [{ type: "text", text: JSON.stringify({ messageId: "ok" }) }] }
}), { status: 200, headers: { "content-type": "application/json" } });
};
const c = new AstraCallsClient({ mcpUrl: "https://astra.test/mcp" }, mockFetch);
await c.sendText("5527999998888", "teste");
});
});