alepha
Version:
Easy-to-use modern TypeScript framework for building many kind of applications.
23 lines (18 loc) • 649 B
text/typescript
import { Alepha } from "alepha";
import { ServerProvider } from "alepha/server";
import { describe, expect, it } from "vitest";
import { AlephaServerHealth } from "../index.ts";
const alepha = Alepha.create().with(AlephaServerHealth);
describe("ServerHealthProvider", () => {
it("should expose health endpoint with server status", async () => {
const srv = alepha.inject(ServerProvider);
const hostname = srv.hostname;
const ping = await fetch(`${hostname}/health`);
expect(await ping.json()).toEqual({
message: "OK",
uptime: expect.any(Number),
date: expect.any(String),
ready: true,
});
});
});