mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
build: Initial linting setup (#1560)
* sets up linting config and runs `yarn lint --fix` once, so that all changes will show up correctly in future PRs. * Note that there are still a lot of linter errors.
This commit is contained in:
committed by
Mayukha Vadari
parent
12cfed5c17
commit
8b95ee5fab
@@ -1,53 +1,57 @@
|
||||
import { ValidationError } from 'xrpl-local/common/errors'
|
||||
import { verifyOfferCancel } from './../../src/models/transactions/offerCancel'
|
||||
import { assert } from 'chai'
|
||||
import { assert } from "chai";
|
||||
|
||||
import { ValidationError } from "xrpl-local/common/errors";
|
||||
|
||||
import { verifyOfferCancel } from "../../src/models/transactions/offerCancel";
|
||||
|
||||
/**
|
||||
* OfferCancel Transaction Verification Testing
|
||||
* OfferCancel Transaction Verification Testing.
|
||||
*
|
||||
* Providing runtime verification testing for each specific transaction type
|
||||
* Providing runtime verification testing for each specific transaction type.
|
||||
*/
|
||||
describe('OfferCancel Transaction Verification', function () {
|
||||
let offer
|
||||
|
||||
beforeEach(() => {
|
||||
offer = {
|
||||
Account: "rnKiczmiQkZFiDES8THYyLA2pQohC5C6EF",
|
||||
Fee: "10",
|
||||
LastLedgerSequence: 65477334,
|
||||
OfferSequence: 60797528,
|
||||
Sequence: 60797535,
|
||||
SigningPubKey: "0361BFD43D1EEA54B77CC152887312949EBF052997FBFFCDAF6F2653164B55B21...",
|
||||
TransactionType: "OfferCancel",
|
||||
TxnSignature: "30450221008C43BDCFC68B4793857CA47DF454C07E5B45D3F80E8E6785CAB9292...",
|
||||
date: "2021-08-06T21:04:11Z"
|
||||
} as any
|
||||
})
|
||||
describe("OfferCancel Transaction Verification", function () {
|
||||
let offer;
|
||||
|
||||
it (`verifies valid OfferCancel`, () => {
|
||||
assert.doesNotThrow(() => verifyOfferCancel(offer))
|
||||
})
|
||||
beforeEach(function () {
|
||||
offer = {
|
||||
Account: "rnKiczmiQkZFiDES8THYyLA2pQohC5C6EF",
|
||||
Fee: "10",
|
||||
LastLedgerSequence: 65477334,
|
||||
OfferSequence: 60797528,
|
||||
Sequence: 60797535,
|
||||
SigningPubKey:
|
||||
"0361BFD43D1EEA54B77CC152887312949EBF052997FBFFCDAF6F2653164B55B21...",
|
||||
TransactionType: "OfferCancel",
|
||||
TxnSignature:
|
||||
"30450221008C43BDCFC68B4793857CA47DF454C07E5B45D3F80E8E6785CAB9292...",
|
||||
date: "2021-08-06T21:04:11Z",
|
||||
} as any;
|
||||
});
|
||||
|
||||
it (`verifies valid OfferCancel with flags`, () => {
|
||||
offer.Flags = 2147483648
|
||||
assert.doesNotThrow(() => verifyOfferCancel(offer))
|
||||
})
|
||||
it(`verifies valid OfferCancel`, function () {
|
||||
assert.doesNotThrow(() => verifyOfferCancel(offer));
|
||||
});
|
||||
|
||||
it (`throws w/ OfferSequence must be a number`, () => {
|
||||
offer.OfferSequence = '99'
|
||||
assert.throws(
|
||||
() => verifyOfferCancel(offer),
|
||||
ValidationError,
|
||||
"OfferCancel: OfferSequence must be a number"
|
||||
)
|
||||
})
|
||||
it(`verifies valid OfferCancel with flags`, function () {
|
||||
offer.Flags = 2147483648;
|
||||
assert.doesNotThrow(() => verifyOfferCancel(offer));
|
||||
});
|
||||
|
||||
it (`throws w/ missing OfferSequence`, () => {
|
||||
delete offer.OfferSequence
|
||||
assert.throws(
|
||||
() => verifyOfferCancel(offer),
|
||||
ValidationError,
|
||||
"OfferCancel: missing field OfferSequence"
|
||||
)
|
||||
})
|
||||
})
|
||||
it(`throws w/ OfferSequence must be a number`, function () {
|
||||
offer.OfferSequence = "99";
|
||||
assert.throws(
|
||||
() => verifyOfferCancel(offer),
|
||||
ValidationError,
|
||||
"OfferCancel: OfferSequence must be a number"
|
||||
);
|
||||
});
|
||||
|
||||
it(`throws w/ missing OfferSequence`, function () {
|
||||
delete offer.OfferSequence;
|
||||
assert.throws(
|
||||
() => verifyOfferCancel(offer),
|
||||
ValidationError,
|
||||
"OfferCancel: missing field OfferSequence"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user