/ opencodehub / tests / unit / env-validation.test.ts
Swadhin Biswas test(qa): add e2e, integration, unit, and load coverage · 3/6/2026
1c29e63
30 lines · 785 Bytes
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
import { beforeEach, describe, expect, it, vi } from "vitest";

vi.mock("@/lib/logger", () => ({
  logger: {
    info: vi.fn(),
    warn: vi.fn(),
    error: vi.fn(),
    debug: vi.fn(),
  },
}));

describe("env-validation", () => {
  beforeEach(() => {
    vi.clearAllMocks();
  });

  it("validates environment without crashing", async () => {
    const { validateEnvironment } = await import("@/lib/env-validation");
    // Pass false to avoid process.exit on error
    const result = validateEnvironment(false);
    expect(typeof result).toBe("boolean");
  });

  it("returns boolean result", async () => {
    const { validateEnvironment } = await import("@/lib/env-validation");
    const result = validateEnvironment(false);
    expect(typeof result).toBe("boolean");
  });
});