parity.js api.parity.chainStatus should handle { blockGap: null } (#4327)
* Add tests for null blockGap values * Handle null blockGap values
This commit is contained in:
parent
1940809dd4
commit
076c8b9de7
@ -79,7 +79,9 @@ export function outChainStatus (status) {
|
||||
Object.keys(status).forEach((key) => {
|
||||
switch (key) {
|
||||
case 'blockGap':
|
||||
status[key] = status[key].map(outNumber);
|
||||
status[key] = status[key]
|
||||
? status[key].map(outNumber)
|
||||
: status[key];
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
@ -135,6 +135,14 @@ describe('api/format/output', () => {
|
||||
blockGap: [new BigNumber(0x1234), new BigNumber(0x5678)]
|
||||
});
|
||||
});
|
||||
|
||||
it('handles null blockGap values', () => {
|
||||
const status = {
|
||||
blockGap: null
|
||||
};
|
||||
|
||||
expect(outChainStatus(status)).to.deep.equal(status);
|
||||
});
|
||||
});
|
||||
|
||||
describe('outDate', () => {
|
||||
|
@ -19,6 +19,14 @@ import { createHttpApi } from '../../../../test/e2e/ethapi';
|
||||
describe('ethapi.parity', () => {
|
||||
const ethapi = createHttpApi();
|
||||
|
||||
describe('chainStatus', () => {
|
||||
it('returns and translates the status', () => {
|
||||
return ethapi.parity.chainStatus().then((value) => {
|
||||
expect(value).to.be.ok;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('gasFloorTarget', () => {
|
||||
it('returns and translates the target', () => {
|
||||
return ethapi.parity.gasFloorTarget().then((value) => {
|
||||
|
Loading…
Reference in New Issue
Block a user