mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-21 04:35:49 +00:00
merge xaddress tests into main test file
This commit is contained in:
@@ -268,13 +268,18 @@ describe('RippleAPI', function () {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
describe('isValidAddress', function () {
|
describe('isValidAddress', function () {
|
||||||
it('returns true for valid address', function () {
|
it('returns true for valid address', function () {
|
||||||
assert(this.api.isValidAddress('rLczgQHxPhWtjkaQqn3Q6UM8AbRbbRvs5K'));
|
assert(this.api.isValidAddress('rLczgQHxPhWtjkaQqn3Q6UM8AbRbbRvs5K'));
|
||||||
|
assert(this.api.isValidAddress(addresses.ACCOUNT_X));
|
||||||
|
assert(this.api.isValidAddress(addresses.ACCOUNT_T));
|
||||||
})
|
})
|
||||||
|
|
||||||
it('returns false for invalid address', function () {
|
it('returns false for invalid address', function () {
|
||||||
assert(!this.api.isValidAddress('foobar'));
|
assert(!this.api.isValidAddress('foobar'));
|
||||||
|
assert(!this.api.isValidAddress(addresses.ACCOUNT_X.slice(0, -1)));
|
||||||
|
assert(!this.api.isValidAddress(addresses.ACCOUNT_T.slice(1)));
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -315,6 +320,21 @@ describe('RippleAPI', function () {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('deriveXAddress', function () {
|
||||||
|
it('returns address for public key', function () {
|
||||||
|
assert.equal(RippleAPI.deriveXAddress({
|
||||||
|
publicKey: '035332FBA71D705BD5D97014A833BE2BBB25BEFCD3506198E14AFEA241B98C2D06',
|
||||||
|
tag: false,
|
||||||
|
test: false
|
||||||
|
}), 'XVZVpQj8YSVpNyiwXYSqvQoQqgBttTxAZwMcuJd4xteQHyt');
|
||||||
|
assert.equal(RippleAPI.deriveXAddress({
|
||||||
|
publicKey: '035332FBA71D705BD5D97014A833BE2BBB25BEFCD3506198E14AFEA241B98C2D06',
|
||||||
|
tag: false,
|
||||||
|
test: true
|
||||||
|
}), 'TVVrSWtmQQssgVcmoMBcFQZKKf56QscyWLKnUyiuZW8ALU4');
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('pagination', function () {
|
describe('pagination', function () {
|
||||||
|
|
||||||
describe('hasNextPage', function () {
|
describe('hasNextPage', function () {
|
||||||
@@ -3440,7 +3460,6 @@ describe('RippleAPI', function () {
|
|||||||
_.partial(checkResult, responses.getTrustlines.all, 'getTrustlines'));
|
_.partial(checkResult, responses.getTrustlines.all, 'getTrustlines'));
|
||||||
});
|
});
|
||||||
|
|
||||||
// @deprecated See corresponding test in `x-address-api-test.js`
|
|
||||||
it('generateAddress', function () {
|
it('generateAddress', function () {
|
||||||
function random() {
|
function random() {
|
||||||
return _.fill(Array(16), 0);
|
return _.fill(Array(16), 0);
|
||||||
@@ -3458,6 +3477,24 @@ describe('RippleAPI', function () {
|
|||||||
}, this.api.errors.UnexpectedError);
|
}, this.api.errors.UnexpectedError);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('generateXAddress', function () {
|
||||||
|
function random() {
|
||||||
|
return _.fill(Array(16), 0);
|
||||||
|
}
|
||||||
|
assert.deepEqual(this.api.generateXAddress({ entropy: random() }),
|
||||||
|
responses.generateXAddress);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('generateXAddress invalid', function () {
|
||||||
|
assert.throws(() => {
|
||||||
|
function random() {
|
||||||
|
return _.fill(Array(1), 0);
|
||||||
|
}
|
||||||
|
this.api.generateXAddress({ entropy: random() });
|
||||||
|
}, this.api.errors.UnexpectedError);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
it('getSettings', function () {
|
it('getSettings', function () {
|
||||||
return this.api.getSettings(address).then(
|
return this.api.getSettings(address).then(
|
||||||
_.partial(checkResult, responses.getSettings, 'getSettings'));
|
_.partial(checkResult, responses.getSettings, 'getSettings'));
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user