Add unit test for prepareOrder and fix bugs

This commit is contained in:
Chris Clark
2015-06-08 13:28:03 -07:00
parent 87b6c09de3
commit a114bf42c4
13 changed files with 99 additions and 56 deletions

View File

@@ -4,6 +4,8 @@ const setupAPI = require('./setup-api');
const address = require('./fixtures/addresses').ACCOUNT;
const paymentSpecification = require('./fixtures/payment-specification');
const paymentResponse = require('./fixtures/payment-response');
const orderSpecification = require('./fixtures/order-specification');
const orderResponse = require('./fixtures/order-response');
const balancesResponse = require('./fixtures/balances-response');
describe('RippleAPI', function() {
@@ -23,6 +25,19 @@ describe('RippleAPI', function() {
});
});
it('prepareOrder', function(done) {
const instructions = {maxLedgerVersionOffset: 100};
this.api.prepareOrder(address, orderSpecification, instructions,
(error, response) => {
if (error) {
done(error);
return;
}
assert.deepEqual(response, orderResponse);
done();
});
});
it('getBalances', function(done) {
this.api.getBalances(address, {}, (error, response) => {
if (error) {