You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
930 B
28 lines
930 B
import { describe, expect, it, beforeEach, afterEach } from "vitest";
|
|
import {
|
|
hostPublicDefaultCustomerId,
|
|
isHostPublicApiEnabled,
|
|
} from "@/lib/constants/host-public-api";
|
|
|
|
describe("host public api env", () => {
|
|
const prevEnabled = process.env.HOST_PUBLIC_API_ENABLED;
|
|
const prevCustomer = process.env.HOST_PUBLIC_DEFAULT_CUSTOMER_ID;
|
|
|
|
afterEach(() => {
|
|
process.env.HOST_PUBLIC_API_ENABLED = prevEnabled;
|
|
process.env.HOST_PUBLIC_DEFAULT_CUSTOMER_ID = prevCustomer;
|
|
});
|
|
|
|
it("is disabled by default", () => {
|
|
delete process.env.HOST_PUBLIC_API_ENABLED;
|
|
expect(isHostPublicApiEnabled()).toBe(false);
|
|
});
|
|
|
|
it("reads enabled flag and default customer", () => {
|
|
process.env.HOST_PUBLIC_API_ENABLED = "true";
|
|
process.env.HOST_PUBLIC_DEFAULT_CUSTOMER_ID = "CUST_MEIMEI";
|
|
expect(isHostPublicApiEnabled()).toBe(true);
|
|
expect(hostPublicDefaultCustomerId()).toBe("CUST_MEIMEI");
|
|
});
|
|
});
|