fix: resolve type errors across test suite
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user