mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-30 00:55:49 +00:00
Update enum definitions and dependencies * Remove redundant bytes from field definitions * Remove "date-generated" given hand editing * Remove ripple-lib test dependency * Fix linting errors introduced by updated eslint/eslintrc * Ensure STObject.toJSON returns a plain object
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert-diff');
|
||||
const {Amount} = require('../src/coretypes');
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
const fixtures = require('./fixtures/codec-fixtures.json');
|
||||
const {decode, encode} = require('../src');
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* eslint-disable func-style */
|
||||
|
||||
'use strict';
|
||||
|
||||
const coreTypes = require('../src/coretypes');
|
||||
|
||||
const _ = require('lodash');
|
||||
@@ -157,11 +155,19 @@ function transactionParsingTests() {
|
||||
}
|
||||
assert(parser.end());
|
||||
});
|
||||
|
||||
it('can be done with higher level apis', () => {
|
||||
const parser = makeParser(transaction.binary);
|
||||
const jsonFromBinary = readJSON(parser);
|
||||
assert.deepEqual(jsonFromBinary, tx_json);
|
||||
});
|
||||
|
||||
it('readJSON (binary.decode) does not return STObject ', () => {
|
||||
const parser = makeParser(transaction.binary);
|
||||
const jsonFromBinary = readJSON(parser);
|
||||
assert((jsonFromBinary instanceof coreTypes.STObject) === false);
|
||||
assert(_.isPlainObject(jsonFromBinary));
|
||||
});
|
||||
}
|
||||
|
||||
function amountParsingTests() {
|
||||
@@ -322,35 +328,8 @@ function pathSetBinaryTests() {
|
||||
});
|
||||
}
|
||||
|
||||
function parseLedger4320278() {
|
||||
let ripple = require('ripple-lib');
|
||||
if (ripple._DEPRECATED) {
|
||||
ripple = ripple._DEPRECATED;
|
||||
}
|
||||
ripple.Amount.strict_mode = false;
|
||||
ripple = false;
|
||||
|
||||
it(`can parse object`, () => {
|
||||
this.timeout(30e3);
|
||||
const json = loadFixture('as-ledger-4320278.json');
|
||||
|
||||
json.forEach((e, i) => {
|
||||
const expected = e.json;
|
||||
const actual = readJSON(makeParser(e.binary));
|
||||
actual.index = expected.index;
|
||||
// const actual = new ripple.SerializedObject(e.binary).to_json();
|
||||
try {
|
||||
assert.deepEqual(actual, expected);
|
||||
} catch (error) {
|
||||
console.log('error', i, !ripple && error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
describe('BinaryParser', function() {
|
||||
function dataDrivenTests() {
|
||||
describe.skip('as-ledger-4320278.json', parseLedger4320278);
|
||||
describe('Amount parsing tests', amountParsingTests);
|
||||
describe('Field Tests', fieldParsingTests);
|
||||
describe('Parsing nested objects', nestedObjectTests);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* eslint-disable func-style */
|
||||
|
||||
'use strict';
|
||||
|
||||
const BN = require('bn.js');
|
||||
const assert = require('assert-diff');
|
||||
const lib = require('../src/coretypes');
|
||||
@@ -78,7 +76,7 @@ function UIntTest() {
|
||||
|
||||
|
||||
function parseLedger4320278() {
|
||||
it(`can parse object`, done => {
|
||||
it('can parse object', done => {
|
||||
this.timeout(30e3);
|
||||
const json = loadFixture('as-ledger-4320278.json');
|
||||
json.forEach(e => {
|
||||
@@ -89,7 +87,7 @@ function parseLedger4320278() {
|
||||
}
|
||||
|
||||
function deliverMinTest() {
|
||||
it(`can serialize DeliverMin`, () => {
|
||||
it('can serialize DeliverMin', () => {
|
||||
assert.strictEqual(encode(deliverMinTx), deliverMinTxBinary);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
const bytesUtils = require('../src/utils/bytes-utils');
|
||||
const {slice, compareBytes, parseBytes, bytesToHex} = bytesUtils;
|
||||
|
||||
@@ -926,7 +926,7 @@
|
||||
},
|
||||
{
|
||||
"type_name": "Vector256",
|
||||
"name": "Features",
|
||||
"name": "Amendments",
|
||||
"nth_of_type": 3,
|
||||
"type": 19,
|
||||
"expected_hex": "0313"
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert-diff');
|
||||
const {Hash160, Hash256, Currency, AccountID} = require('../src/coretypes');
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
const {loadFixture} = require('./utils');
|
||||
const ledgerHashes = require('../src/ledger-hashes');
|
||||
|
||||
@@ -1 +1 @@
|
||||
--reporter spec --slow 500 --compilers js:babel/register
|
||||
--reporter spec --slow 500 --compilers js:babel-register
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert-diff');
|
||||
const {quality, binary: {bytesToHex}} = require('../src/coretypes');
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert-diff');
|
||||
const {ShaMap} = require('../src/shamap.js');
|
||||
const {binary: {serializeObject}, Hash256, HashPrefix}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
const _ = require('lodash');
|
||||
const assert = require('assert-diff');
|
||||
const {encodeForSigning, encodeForMultisigning} = require('../src');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
const _ = require('lodash');
|
||||
const assert = require('assert');
|
||||
const coreTypes = require('../src/types');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
const coreTypes = require('../src/coretypes');
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
const intercept = require('intercept-stdout');
|
||||
const fs = require('fs');
|
||||
const fsExtra = require('fs-extra');
|
||||
|
||||
Reference in New Issue
Block a user