boldsign
Version:
NodeJS client for boldsign
26 lines (25 loc) • 919 B
text/typescript
import { PlanApi } from '../../api/planApi';
import config from '../config';
describe('PlanApiTest', () => {
let planApi:PlanApi;
beforeAll(() => {
const apiKey = config.apiKey;
const baseUrl = config.baseUrl;
if (!apiKey || !baseUrl) {
throw new Error("Environment variables 'API_KEY' or 'HOST_URL' are not set.");
}
planApi = new PlanApi(baseUrl);
planApi.setApiKey(apiKey);
});
test('should retrieve API credits count with balance greater than or equal to 0', async () => {
try {
const response = await planApi.apiCreditsCount();
console.log("API Credits Count:", response.balanceCredits);
expect(response).toBeDefined();
expect(response.balanceCredits).toBeGreaterThanOrEqual(0);
} catch (error:any) {
console.log("Error occurred while calling the API:", error.message);
expect(error.message).toBeUndefined();
}
},20000);
});