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,83 +1,85 @@
import { ValidationError } from 'xrpl-local/common/errors'
import { verifyPaymentChannelFund } from './../../src/models/transactions/paymentChannelFund'
import { assert } from 'chai'
import { assert } from "chai";
import { ValidationError } from "xrpl-local/common/errors";
import { verifyPaymentChannelFund } from "../../src/models/transactions/paymentChannelFund";
/**
* PaymentChannelFund Transaction Verification Testing
* PaymentChannelFund Transaction Verification Testing.
*
* Providing runtime verification testing for each specific transaction type
* Providing runtime verification testing for each specific transaction type.
*/
describe('PaymentChannelFund Transaction Verification', function () {
let channel
describe("PaymentChannelFund Transaction Verification", function () {
let channel;
beforeEach(() => {
channel = {
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"TransactionType": "PaymentChannelFund",
"Channel": "C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198",
"Amount": "200000",
"Expiration": 543171558
}
})
it (`verifies valid PaymentChannelFund`, () => {
assert.doesNotThrow(() => verifyPaymentChannelFund(channel))
})
beforeEach(function () {
channel = {
Account: "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
TransactionType: "PaymentChannelFund",
Channel:
"C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198",
Amount: "200000",
Expiration: 543171558,
};
});
it (`verifies valid PaymentChannelFund w/o optional`, () => {
delete channel.Expiration
assert.doesNotThrow(() => verifyPaymentChannelFund(channel))
})
it(`verifies valid PaymentChannelFund`, function () {
assert.doesNotThrow(() => verifyPaymentChannelFund(channel));
});
it (`throws w/ missing Amount`, () => {
delete channel.Amount
it(`verifies valid PaymentChannelFund w/o optional`, function () {
delete channel.Expiration;
assert.throws(
() => verifyPaymentChannelFund(channel),
ValidationError,
"PaymentChannelFund: missing Amount"
)
})
assert.doesNotThrow(() => verifyPaymentChannelFund(channel));
});
it (`throws w/ missing Channel`, () => {
delete channel.Channel
it(`throws w/ missing Amount`, function () {
delete channel.Amount;
assert.throws(
() => verifyPaymentChannelFund(channel),
ValidationError,
"PaymentChannelFund: missing Channel"
)
})
assert.throws(
() => verifyPaymentChannelFund(channel),
ValidationError,
"PaymentChannelFund: missing Amount"
);
});
it (`throws w/ invalid Amount`, () => {
channel.Amount = 100
it(`throws w/ missing Channel`, function () {
delete channel.Channel;
assert.throws(
() => verifyPaymentChannelFund(channel),
ValidationError,
"PaymentChannelFund: Amount must be a string"
)
})
assert.throws(
() => verifyPaymentChannelFund(channel),
ValidationError,
"PaymentChannelFund: missing Channel"
);
});
it (`throws w/ invalid Channel`, () => {
channel.Channel = 1000
it(`throws w/ invalid Amount`, function () {
channel.Amount = 100;
assert.throws(
() => verifyPaymentChannelFund(channel),
ValidationError,
"PaymentChannelFund: Channel must be a string"
)
})
assert.throws(
() => verifyPaymentChannelFund(channel),
ValidationError,
"PaymentChannelFund: Amount must be a string"
);
});
it (`throws w/ invalid Expiration`, () => {
channel.Expiration = "1000"
assert.throws(
() => verifyPaymentChannelFund(channel),
ValidationError,
"PaymentChannelFund: Expiration must be a number"
)
})
it(`throws w/ invalid Channel`, function () {
channel.Channel = 1000;
})
assert.throws(
() => verifyPaymentChannelFund(channel),
ValidationError,
"PaymentChannelFund: Channel must be a string"
);
});
it(`throws w/ invalid Expiration`, function () {
channel.Expiration = "1000";
assert.throws(
() => verifyPaymentChannelFund(channel),
ValidationError,
"PaymentChannelFund: Expiration must be a number"
);
});
});