import { getConfig } from "../../src/config";

describe("getConfig()", () => {
  afterEach(() => {
    delete process.env.TEST_VAR;
  });

  it("returns default value if env var is missing", () => {
    expect(getConfig("TEST_VAR", "default")).toBe("default");
  });

  it("throws error if env var is missing and no default provided", () => {
    expect(() => getConfig("TEST_VAR")).toThrow(
      "Configuration error: Missing environment variable TEST_VAR"
    );
  });
});
