forked from Lilly-Protocol/lily-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice-info.test.ts
More file actions
39 lines (31 loc) · 1.15 KB
/
Copy pathservice-info.test.ts
File metadata and controls
39 lines (31 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import request from "supertest";
import { afterEach, describe, expect, it, vi } from "vitest";
describe("service build metadata", () => {
afterEach(() => {
vi.resetModules();
vi.unstubAllEnvs();
});
it("always exposes the package version and omits absent commit metadata", async () => {
vi.stubEnv("BUILD_COMMIT", "");
const { buildInfo } = await import("../src/config/build-info");
expect(buildInfo).toEqual({ version: "1.0.0" });
});
it("exposes a configured build commit when available", async () => {
vi.stubEnv("BUILD_COMMIT", "abc123def456");
const { buildInfo } = await import("../src/config/build-info");
expect(buildInfo).toEqual({
version: "1.0.0",
commit: "abc123def456",
});
});
it("includes version and optional commit metadata in the health response", async () => {
vi.stubEnv("BUILD_COMMIT", "abc123def456");
const { createApp } = await import("../src/app");
const response = await request(createApp()).get("/api/v1/health");
expect(response.status).toBe(200);
expect(response.body.data).toMatchObject({
version: "1.0.0",
commit: "abc123def456",
});
});
});