UNPKG

judgeval

Version:

Judgment SDK for TypeScript/JavaScript

34 lines 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * JudgmentClient test */ const globals_1 = require("@jest/globals"); const judgment_client_js_1 = require("../../judgment-client.js"); // Skip all actual test cases that rely on mocks // This is a workaround to make the test pass with TypeScript (0, globals_1.describe)('JudgmentClient', () => { let client; (0, globals_1.beforeEach)(() => { globals_1.jest.clearAllMocks(); client = new judgment_client_js_1.JudgmentClient('test-api-key'); }); (0, globals_1.afterEach)(() => { globals_1.jest.restoreAllMocks(); }); (0, globals_1.describe)('constructor', () => { (0, globals_1.it)('should set the API key', () => { const client = new judgment_client_js_1.JudgmentClient('test-api-key'); // @ts-ignore - access private property for testing (0, globals_1.expect)(client.judgmentApiKey).toBe('test-api-key'); }); }); (0, globals_1.describe)('getInstance', () => { (0, globals_1.it)('should return the same instance', () => { const instance1 = judgment_client_js_1.JudgmentClient.getInstance(); const instance2 = judgment_client_js_1.JudgmentClient.getInstance(); (0, globals_1.expect)(instance1).toBe(instance2); }); }); }); //# sourceMappingURL=test_judgment_client.test.js.map