mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-29 08:35:49 +00:00
Add unit test for generateWallet and reorganize API files
This commit is contained in:
@@ -25,6 +25,7 @@ const transactionResponse = require('./fixtures/transaction-response');
|
||||
const accountTransactionsResponse =
|
||||
require('./fixtures/account-transactions-response');
|
||||
const trustlinesResponse = require('./fixtures/trustlines-response');
|
||||
const walletResponse = require('./fixtures/wallet.json');
|
||||
|
||||
function checkResult(expected, done, error, response) {
|
||||
if (error) {
|
||||
@@ -117,4 +118,10 @@ describe('RippleAPI', function() {
|
||||
this.api.getTrustlines(address, options,
|
||||
_.partial(checkResult, trustlinesResponse, done));
|
||||
});
|
||||
|
||||
it('generateWallet', function() {
|
||||
withDeterministicPRNG(() => {
|
||||
assert.deepEqual(this.api.generateWallet(), walletResponse);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
4
test/fixtures/wallet.json
vendored
Normal file
4
test/fixtures/wallet.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"address": "ra2d1wnhDFyZGFz62wT3GSRhAEjpLuqfnj",
|
||||
"secret": "ss4JedFMSQJa4mHQz3VZ58ZG4TYWg"
|
||||
}
|
||||
@@ -12,6 +12,10 @@ function MockPRNG(seed) {
|
||||
this.seed = seed || SEED;
|
||||
}
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
MockPRNG.prototype.addEntropy = function(data, estimatedEntropy, source) {};
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
MockPRNG.prototype.randomWord = function() {
|
||||
const i = this.position;
|
||||
this.position = (i + 8) % this.seed.length;
|
||||
|
||||
Reference in New Issue
Block a user