// Tests for logging.ts // Note: These tests verify the module structure and types. // Full integration tests would require a running logging service. import assert from "node:assert/strict"; import { describe, it } from "node:test"; // We can't easily test log() and getLogs() without mocking fetch, // but we can verify the module exports correctly and types work. describe("logging", () => { describe("module structure", () => { it("exports log function", async () => { const { log } = await import("./logging"); assert.equal(typeof log, "function"); }); it("exports getLogs function", async () => { const { getLogs } = await import("./logging"); assert.equal(typeof getLogs, "function"); }); }); describe("Message type", () => { // Type-level tests - if these compile, the types are correct it("accepts valid message sources", () => { type MessageSource = "logging" | "diagnostic" | "user"; const sources: MessageSource[] = ["logging", "diagnostic", "user"]; assert.equal(sources.length, 3); }); }); describe("FilterArgument type", () => { // Type-level tests it("accepts valid filter options", () => { type FilterArgument = { limit?: number; before?: number; after?: number; match?: (string | RegExp)[]; }; const filter: FilterArgument = { limit: 10, before: Date.now(), after: Date.now() - 3600000, match: ["error", /warning/i], }; assert.ok(filter.limit === 10); }); }); });