1
0
forked from Yara724/api
Files
yara724-api/src/system-settings/system-settings.service.spec.ts
2026-05-16 16:23:01 +03:30

32 lines
844 B
TypeScript

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);
});
});