boldsign
Version:
NodeJS client for boldsign
41 lines • 2.04 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const planApi_1 = require("../../api/planApi");
const config_1 = __importDefault(require("../config"));
describe('PlanApiTest', () => {
let planApi;
beforeAll(() => {
const apiKey = config_1.default.apiKey;
const baseUrl = config_1.default.baseUrl;
if (!apiKey || !baseUrl) {
throw new Error("Environment variables 'API_KEY' or 'HOST_URL' are not set.");
}
planApi = new planApi_1.PlanApi(baseUrl);
planApi.setApiKey(apiKey);
});
test('should retrieve API credits count with balance greater than or equal to 0', () => __awaiter(void 0, void 0, void 0, function* () {
try {
const response = yield planApi.apiCreditsCount();
console.log("API Credits Count:", response.balanceCredits);
expect(response).toBeDefined();
expect(response.balanceCredits).toBeGreaterThanOrEqual(0);
}
catch (error) {
console.log("Error occurred while calling the API:", error.message);
expect(error.message).toBeUndefined();
}
}), 20000);
});
//# sourceMappingURL=planApiTest.spec.js.map