mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-04 21:15:47 +00:00
combine with different transaction test
test for trying to sign already signed transaction ignore http server in coverage
This commit is contained in:
@@ -8,6 +8,7 @@ const jayson = require('jayson');
|
|||||||
const RippleAPI = require('./api').RippleAPI;
|
const RippleAPI = require('./api').RippleAPI;
|
||||||
|
|
||||||
|
|
||||||
|
/* istanbul ignore next */
|
||||||
function createHTTPServer(options, httpPort) {
|
function createHTTPServer(options, httpPort) {
|
||||||
const rippleAPI = new RippleAPI(options);
|
const rippleAPI = new RippleAPI(options);
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ const address = addresses.ACCOUNT;
|
|||||||
const utils = RippleAPI._PRIVATE.ledgerUtils;
|
const utils = RippleAPI._PRIVATE.ledgerUtils;
|
||||||
const ledgerClosed = require('./fixtures/rippled/ledger-close-newer');
|
const ledgerClosed = require('./fixtures/rippled/ledger-close-newer');
|
||||||
const schemaValidator = RippleAPI._PRIVATE.schemaValidator;
|
const schemaValidator = RippleAPI._PRIVATE.schemaValidator;
|
||||||
|
const binary = require('ripple-binary-codec');
|
||||||
assert.options.strict = true;
|
assert.options.strict = true;
|
||||||
|
|
||||||
const TIMEOUT = 10000; // how long before each test case times out
|
const TIMEOUT = 10000; // how long before each test case times out
|
||||||
@@ -325,6 +326,15 @@ describe('RippleAPI', function() {
|
|||||||
schemaValidator.schemaValidate('sign', result);
|
schemaValidator.schemaValidate('sign', result);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('sign - already signed', function() {
|
||||||
|
const secret = 'shsWGZcmZz6YsWWmcnpfr6fLTdtFV';
|
||||||
|
const result = this.api.sign(requests.sign.normal.txJSON, secret);
|
||||||
|
assert.throws(() => {
|
||||||
|
const tx = JSON.stringify(binary.decode(result.signedTransaction));
|
||||||
|
this.api.sign(tx, secret);
|
||||||
|
}, /txJSON must not contain "TxnSignature" or "Signers" properties/);
|
||||||
|
});
|
||||||
|
|
||||||
it('sign - SuspendedPaymentExecution', function() {
|
it('sign - SuspendedPaymentExecution', function() {
|
||||||
const secret = 'snoPBrXtMeMyMHUVTgbuqAfg1SUTb';
|
const secret = 'snoPBrXtMeMyMHUVTgbuqAfg1SUTb';
|
||||||
const result = this.api.sign(requests.sign.suspended.txJSON, secret);
|
const result = this.api.sign(requests.sign.suspended.txJSON, secret);
|
||||||
@@ -359,6 +369,16 @@ describe('RippleAPI', function() {
|
|||||||
checkResult(responses.combine.single, 'sign', combined);
|
checkResult(responses.combine.single, 'sign', combined);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('combine - different transactions', function() {
|
||||||
|
const request = [requests.combine.setDomain[0]];
|
||||||
|
const tx = binary.decode(requests.combine.setDomain[0]);
|
||||||
|
tx.Flags = 0;
|
||||||
|
request.push(binary.encode(tx));
|
||||||
|
assert.throws(() => {
|
||||||
|
this.api.combine(request);
|
||||||
|
}, /txJSON is not the same for all signedTransactions/);
|
||||||
|
});
|
||||||
|
|
||||||
describe('RippleAPI', function() {
|
describe('RippleAPI', function() {
|
||||||
|
|
||||||
it('getBalances', function() {
|
it('getBalances', function() {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const {payTo, ledgerAccept} = require('./utils');
|
|||||||
|
|
||||||
|
|
||||||
// how long before each test case times out
|
// how long before each test case times out
|
||||||
const TIMEOUT = process.browser ? 45000 : 10000;
|
const TIMEOUT = process.browser ? 85000 : 10000;
|
||||||
const INTERVAL = 1000; // how long to wait between checks for validated ledger
|
const INTERVAL = 1000; // how long to wait between checks for validated ledger
|
||||||
|
|
||||||
const serverUrl = 'ws://127.0.0.1:6006';
|
const serverUrl = 'ws://127.0.0.1:6006';
|
||||||
@@ -76,6 +76,9 @@ function setup(server = 'wss://s1.ripple.com') {
|
|||||||
console.log('CONNECTING...');
|
console.log('CONNECTING...');
|
||||||
return this.api.connect().then(() => {
|
return this.api.connect().then(() => {
|
||||||
console.log('CONNECTED...');
|
console.log('CONNECTED...');
|
||||||
|
}, error => {
|
||||||
|
console.log('ERROR:', error);
|
||||||
|
throw error;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user