fix: resolve type errors across test suite

This commit is contained in:
2026-02-26 12:49:04 -06:00
parent 827b018f25
commit 51eb36f4a6
26 changed files with 2847 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import { describe, test, expect, mock } from "bun:test";
import { Eventra } from "@duxcore/eventra";
// We test the globalEvents module shape and the setupEventDebugger function.
// We import directly since the module has minimal side-effects.
import { events, setupEventDebugger } from "../../src/modules/globalEvents";
describe("globalEvents", () => {
test("events is an Eventra instance", () => {
expect(events).toBeDefined();
expect(typeof events.emit).toBe("function");
expect(typeof events.on).toBe("function");
});
test("setupEventDebugger registers a catch-all listener", () => {
// Calling setupEventDebugger should not throw
expect(() => setupEventDebugger()).not.toThrow();
});
test("can emit and receive events", () => {
let received = false;
events.on("api:started", () => {
received = true;
});
events.emit("api:started");
expect(received).toBe(true);
});
});