run prettier on all packages

This commit is contained in:
Greg Weisbrod
2021-11-12 02:41:28 -05:00
parent 3b523d7e37
commit afd6aadaf1
51 changed files with 2086 additions and 2062 deletions

View File

@@ -1,45 +1,45 @@
const fixtures = require("./fixtures/codec-fixtures.json");
const { decode, encode, decodeLedgerData } = require("../dist");
const fixtures = require('./fixtures/codec-fixtures.json')
const { decode, encode, decodeLedgerData } = require('../dist')
function json(object) {
return JSON.stringify(object);
return JSON.stringify(object)
}
function truncateForDisplay(longStr) {
return `${longStr.slice(0, 10)} ... ${longStr.slice(-10)}`;
return `${longStr.slice(0, 10)} ... ${longStr.slice(-10)}`
}
describe("ripple-binary-codec", function () {
describe('ripple-binary-codec', function () {
function makeSuite(name, entries) {
describe(name, function () {
entries.forEach((t, testN) => {
test(`${name}[${testN}] can encode ${truncateForDisplay(
json(t.json)
json(t.json),
)} to ${truncateForDisplay(t.binary)}`, () => {
expect(encode(t.json)).toEqual(t.binary);
});
expect(encode(t.json)).toEqual(t.binary)
})
test(`${name}[${testN}] can decode ${truncateForDisplay(
t.binary
t.binary,
)} to ${truncateForDisplay(json(t.json))}`, () => {
const decoded = decode(t.binary);
expect(decoded).toEqual(t.json);
});
});
});
const decoded = decode(t.binary)
expect(decoded).toEqual(t.json)
})
})
})
}
makeSuite("transactions", fixtures.transactions);
makeSuite("accountState", fixtures.accountState);
makeSuite('transactions', fixtures.transactions)
makeSuite('accountState', fixtures.accountState)
describe("ledgerData", function () {
describe('ledgerData', function () {
if (fixtures.ledgerData) {
fixtures.ledgerData.forEach((t, testN) => {
test(`ledgerData[${testN}] can decode ${t.binary} to ${json(
t.json
t.json,
)}`, () => {
const decoded = decodeLedgerData(t.binary);
expect(t.json).toEqual(decoded);
});
});
const decoded = decodeLedgerData(t.binary)
expect(t.json).toEqual(decoded)
})
})
}
});
});
})
})