Add getPaymentChannel

This commit is contained in:
wilsonianb
2017-04-06 22:27:05 -07:00
parent c8f2967de0
commit 19eb88a00e
21 changed files with 445 additions and 2 deletions

View File

@@ -1113,6 +1113,45 @@ describe('RippleAPI', function() {
});
it('getPaymentChannel', function() {
const channelId =
'E30E709CF009A1F26E0E5C48F7AA1BFB79393764F15FB108BDC6E06D3CBD8415';
return this.api.getPaymentChannel(channelId).then(
_.partial(checkResult, responses.getPaymentChannel.normal,
'getPaymentChannel'));
});
it('getPaymentChannel - full', function() {
const channelId =
'D77CD4713AA08195E6B6D0E5BC023DA11B052EBFF0B5B22EDA8AE85345BCF661';
return this.api.getPaymentChannel(channelId).then(
_.partial(checkResult, responses.getPaymentChannel.full,
'getPaymentChannel'));
});
it('getPaymentChannel - not found', function() {
const channelId =
'DFA557EA3497585BFE83F0F97CC8E4530BBB99967736BB95225C7F0C13ACE708';
return this.api.getPaymentChannel(channelId).then(() => {
assert(false, 'Should throw entryNotFound');
}).catch(error => {
assert(error instanceof this.api.errors.RippledError);
assert(_.includes(error.message, 'entryNotFound'));
});
});
it('getPaymentChannel - wrong type', function() {
const channelId =
'8EF9CCB9D85458C8D020B3452848BBB42EAFDDDB69A93DD9D1223741A4CA562B';
return this.api.getPaymentChannel(channelId).then(() => {
assert(false, 'Should throw NotFoundError');
}).catch(error => {
assert(_.includes(error.message,
'Payment channel ledger entry not found'));
assert(error instanceof this.api.errors.NotFoundError);
});
});
it('getServerInfo', function() {
return this.api.getServerInfo().then(
_.partial(checkResult, responses.getServerInfo, 'getServerInfo'));