1
0
forked from Yara724/api

Toggle External API

This commit is contained in:
SepehrYahyaee
2026-05-16 16:23:01 +03:30
parent f2848a6179
commit 094816ce8f
11 changed files with 358 additions and 14 deletions

View File

@@ -0,0 +1,31 @@
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);
});
});