xek-sdk
Version:
SDK for katana blockchain
28 lines (24 loc) • 859 B
JavaScript
;
const assert = require ('assert');
const api = require ('../src/api');
const {API_TEST, DEFAULT_API} = require ('../src/constant');
describe ('API test', () => {
describe ('Test constructor', () => {
it ('constructor with parameter', () => {
const apiURI = API_TEST;
const API = new api (apiURI);
assert.deepEqual (API.api, apiURI, 'property api must be same with input');
});
it ('constructor without parameter', () => {
const API = new api ();
assert.deepEqual (API.api, DEFAULT_API, 'property api must be same with DEFAULT_API');
});
});
describe ('Test get block', () => {
it ('Get block', async () => {
const API = new api ();
let block = await API.getBlock (1);
assert.deepEqual (block.success, true, 'get block return success is true');
});
});
});