import { SystemSettingsService } from "./system-settings.service"; describe("SystemSettingsService", () => { const db = { findGlobal: jest.fn(), upsertGlobal: jest.fn(), }; let service: SystemSettingsService; beforeEach(() => { jest.clearAllMocks(); service = new SystemSettingsService(db as any); }); it("defaults to mock when DB field is false", async () => { db.findGlobal.mockResolvedValue({ key: "global", externalApis: { sandHubUseLiveApi: false }, }); await expect(service.isSandHubLiveEnabled()).resolves.toBe(false); }); it("uses live mode when DB field is true", async () => { db.findGlobal.mockResolvedValue({ key: "global", externalApis: { sandHubUseLiveApi: true }, }); await expect(service.isSandHubLiveEnabled()).resolves.toBe(true); }); });