mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
Organize JSON schemas for documentation generation
This commit is contained in:
@@ -834,26 +834,32 @@ describe('RippleAPI', function() {
|
||||
minLedgerVersion: 20000,
|
||||
maxLedgerVersion: 10000
|
||||
};
|
||||
assert.throws(_.partial(validate.getTransactionsOptions, options),
|
||||
this.api.errors.ValidationError);
|
||||
assert.throws(_.partial(validate.getTransactionsOptions, options),
|
||||
const thunk = _.partial(validate.getTransactions,
|
||||
{address, options});
|
||||
assert.throws(thunk, this.api.errors.ValidationError);
|
||||
assert.throws(thunk,
|
||||
/minLedgerVersion must not be greater than maxLedgerVersion/);
|
||||
});
|
||||
|
||||
it('secret', function() {
|
||||
assert.doesNotThrow(_.partial(validate.secret,
|
||||
function validateSecret(secret) {
|
||||
validate.sign({txJSON: '', secret});
|
||||
}
|
||||
assert.doesNotThrow(_.partial(validateSecret,
|
||||
'shzjfakiK79YQdMjy4h8cGGfQSV6u'));
|
||||
assert.throws(_.partial(validate.secret, 1),
|
||||
/Invalid parameter/);
|
||||
assert.throws(_.partial(validate.secret, ''),
|
||||
assert.throws(_.partial(validateSecret,
|
||||
'shzjfakiK79YQdMjy4h8cGGfQSV6v'), this.api.errors.ValidationError);
|
||||
assert.throws(_.partial(validateSecret, 1),
|
||||
this.api.errors.ValidationError);
|
||||
assert.throws(_.partial(validate.secret, 's!!!'),
|
||||
assert.throws(_.partial(validateSecret, ''),
|
||||
this.api.errors.ValidationError);
|
||||
assert.throws(_.partial(validate.secret, 'passphrase'),
|
||||
assert.throws(_.partial(validateSecret, 's!!!'),
|
||||
this.api.errors.ValidationError);
|
||||
assert.throws(_.partial(validateSecret, 'passphrase'),
|
||||
this.api.errors.ValidationError);
|
||||
// 32 0s is a valid hex repr of seed bytes
|
||||
const hex = new Array(33).join('0');
|
||||
assert.throws(_.partial(validate.secret, hex),
|
||||
assert.throws(_.partial(validateSecret, hex),
|
||||
this.api.errors.ValidationError);
|
||||
});
|
||||
|
||||
|
||||
1
test/fixtures/responses/get-server-info.json
vendored
1
test/fixtures/responses/get-server-info.json
vendored
@@ -2,6 +2,7 @@
|
||||
"buildVersion": "0.24.0-rc1",
|
||||
"completeLedgers": "32570-6595042",
|
||||
"hostid": "ARTS",
|
||||
"ioLatencyMs": 1,
|
||||
"lastClose": {
|
||||
"convergeTimeS": 2.007,
|
||||
"proposers": 4
|
||||
|
||||
1
test/fixtures/rippled/server-info.json
vendored
1
test/fixtures/rippled/server-info.json
vendored
@@ -7,6 +7,7 @@
|
||||
"build_version": "0.24.0-rc1",
|
||||
"complete_ledgers": "32570-6595042",
|
||||
"hostid": "ARTS",
|
||||
"io_latency_ms": 1,
|
||||
"last_close": {
|
||||
"converge_time_s": 2.007,
|
||||
"proposers": 4
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
const _ = require('lodash');
|
||||
const assert = require('assert');
|
||||
const errors = require('../../src/common/errors');
|
||||
const validate = require('../../src/common').validate;
|
||||
const wallet = require('./wallet');
|
||||
const requests = require('../fixtures/requests');
|
||||
const RippleAPI = require('../../src').RippleAPI;
|
||||
const {isValidAddress} = require('ripple-address-codec');
|
||||
const {isValidSecret} = require('../../src/common');
|
||||
|
||||
|
||||
const TIMEOUT = 30000; // how long before each test case times out
|
||||
@@ -292,8 +293,8 @@ describe('integration tests', function() {
|
||||
it('generateWallet', function() {
|
||||
const newWallet = this.api.generateAddress();
|
||||
assert(newWallet && newWallet.address && newWallet.secret);
|
||||
validate.address(newWallet.address);
|
||||
validate.secret(newWallet.secret);
|
||||
assert(isValidAddress(newWallet.address));
|
||||
assert(isValidSecret(newWallet.secret));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user