alepha
Version:
Easy-to-use modern TypeScript framework for building many kind of applications.
23 lines (17 loc) • 550 B
text/typescript
import { Alepha } from "alepha";
import { describe, it } from "vitest";
describe("alepha.events.emit", () => {
it("should handle errors with catch option", async ({ expect }) => {
const alepha = Alepha.create();
alepha.events.on("echo", () => {
throw new Error("Error in echo");
});
await alepha.start();
await expect(() => alepha.events.emit("echo", {})).rejects.toThrowError(
"Error in echo",
);
expect(await alepha.events.emit("echo", {}, { catch: true })).toEqual(
undefined,
);
});
});