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:
Nathan Nichols
2021-08-26 21:22:40 -05:00
committed by Mayukha Vadari
parent 12cfed5c17
commit 8b95ee5fab
286 changed files with 15508 additions and 12691 deletions

View File

@@ -1,75 +1,76 @@
import { ValidationError } from 'xrpl-local/common/errors'
import { verifyEscrowFinish } from './../../src/models/transactions/escrowFinish'
import { assert } from 'chai'
import { assert } from "chai";
import { ValidationError } from "xrpl-local/common/errors";
import { verifyEscrowFinish } from "../../src/models/transactions/escrowFinish";
/**
* EscrowFinish Transaction Verification Testing
* EscrowFinish Transaction Verification Testing.
*
* Providing runtime verification testing for each specific transaction type
* Providing runtime verification testing for each specific transaction type.
*/
describe('EscrowFinish Transaction Verification', function () {
let escrow
describe("EscrowFinish Transaction Verification", function () {
let escrow;
beforeEach(() => {
escrow = {
Account: "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
TransactionType: "EscrowFinish",
Owner: "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
OfferSequence: 7,
Condition: "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100",
Fulfillment: "A0028000"
}
})
it (`verifies valid EscrowFinish`, () => {
assert.doesNotThrow(() => verifyEscrowFinish(escrow))
})
beforeEach(function () {
escrow = {
Account: "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
TransactionType: "EscrowFinish",
Owner: "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
OfferSequence: 7,
Condition:
"A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100",
Fulfillment: "A0028000",
};
});
it(`verifies valid EscrowFinish`, function () {
assert.doesNotThrow(() => verifyEscrowFinish(escrow));
});
it (`verifies valid EscrowFinish w/o optional`, () => {
delete escrow.Condition
delete escrow.Fulfillment
assert.doesNotThrow(() => verifyEscrowFinish(escrow))
})
it(`verifies valid EscrowFinish w/o optional`, function () {
delete escrow.Condition;
delete escrow.Fulfillment;
assert.doesNotThrow(() => verifyEscrowFinish(escrow));
});
it (`throws w/ invalid Owner`, () => {
escrow.Owner = 0x15415253
it(`throws w/ invalid Owner`, function () {
escrow.Owner = 0x15415253;
assert.throws(
() => verifyEscrowFinish(escrow),
ValidationError,
"EscrowFinish: Owner must be a string"
)
})
assert.throws(
() => verifyEscrowFinish(escrow),
ValidationError,
"EscrowFinish: Owner must be a string"
);
});
it (`throws w/ invalid OfferSequence`, () => {
escrow.OfferSequence = "10"
it(`throws w/ invalid OfferSequence`, function () {
escrow.OfferSequence = "10";
assert.throws(
() => verifyEscrowFinish(escrow),
ValidationError,
"EscrowFinish: OfferSequence must be a number"
)
})
assert.throws(
() => verifyEscrowFinish(escrow),
ValidationError,
"EscrowFinish: OfferSequence must be a number"
);
});
it (`throws w/ invalid Condition`, () => {
escrow.Condition = 10
it(`throws w/ invalid Condition`, function () {
escrow.Condition = 10;
assert.throws(
() => verifyEscrowFinish(escrow),
ValidationError,
"EscrowFinish: Condition must be a string"
)
})
assert.throws(
() => verifyEscrowFinish(escrow),
ValidationError,
"EscrowFinish: Condition must be a string"
);
});
it (`throws w/ invalid Fulfillment`, () => {
escrow.Fulfillment = 0x142341
it(`throws w/ invalid Fulfillment`, function () {
escrow.Fulfillment = 0x142341;
assert.throws(
() => verifyEscrowFinish(escrow),
ValidationError,
"EscrowFinish: Fulfillment must be a string"
)
})
})
assert.throws(
() => verifyEscrowFinish(escrow),
ValidationError,
"EscrowFinish: Fulfillment must be a string"
);
});
});