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,140 +1,141 @@
import { ValidationError } from 'xrpl-local/common/errors'
import { verifyPaymentChannelCreate } from './../../src/models/transactions/paymentChannelCreate'
import { assert } from 'chai'
import { assert } from "chai";
import { ValidationError } from "xrpl-local/common/errors";
import { verifyPaymentChannelCreate } from "../../src/models/transactions/paymentChannelCreate";
/**
* PaymentChannelCreate Transaction Verification Testing
* PaymentChannelCreate Transaction Verification Testing.
*
* Providing runtime verification testing for each specific transaction type
* Providing runtime verification testing for each specific transaction type.
*/
describe('PaymentChannelCreate Transaction Verification', function () {
let channel
describe("PaymentChannelCreate Transaction Verification", function () {
let channel;
beforeEach(() => {
channel = {
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"TransactionType": "PaymentChannelCreate",
"Amount": "10000",
"Destination": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
"SettleDelay": 86400,
"PublicKey": "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A",
"CancelAfter": 533171558,
"DestinationTag": 23480,
"SourceTag": 11747
}
})
it (`verifies valid PaymentChannelCreate`, () => {
assert.doesNotThrow(() => verifyPaymentChannelCreate(channel))
})
beforeEach(function () {
channel = {
Account: "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
TransactionType: "PaymentChannelCreate",
Amount: "10000",
Destination: "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
SettleDelay: 86400,
PublicKey:
"32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A",
CancelAfter: 533171558,
DestinationTag: 23480,
SourceTag: 11747,
};
});
it (`verifies valid PaymentChannelCreate w/o optional`, () => {
delete channel.CancelAfter
delete channel.DestinationTag
delete channel.SourceTag
it(`verifies valid PaymentChannelCreate`, function () {
assert.doesNotThrow(() => verifyPaymentChannelCreate(channel));
});
assert.doesNotThrow(() => verifyPaymentChannelCreate(channel))
})
it(`verifies valid PaymentChannelCreate w/o optional`, function () {
delete channel.CancelAfter;
delete channel.DestinationTag;
delete channel.SourceTag;
it (`missing Amount`, () => {
delete channel.Amount
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: missing Amount"
)
})
assert.doesNotThrow(() => verifyPaymentChannelCreate(channel));
});
it(`missing Amount`, function () {
delete channel.Amount;
it (`missing Destination`, () => {
delete channel.Destination
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: missing Destination"
)
})
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: missing Amount"
);
});
it (`missing SettleDelay`, () => {
delete channel.SettleDelay
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: missing SettleDelay"
)
})
it(`missing Destination`, function () {
delete channel.Destination;
it (`missing PublicKey`, () => {
delete channel.PublicKey
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: missing PublicKey"
)
})
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: missing Destination"
);
});
it (`invalid Amount`, () => {
channel.Amount = 1000
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: Amount must be a string"
)
})
it(`missing SettleDelay`, function () {
delete channel.SettleDelay;
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: missing SettleDelay"
);
});
it (`invalid Destination`, () => {
channel.Destination = 10;
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: Destination must be a string"
)
})
it(`missing PublicKey`, function () {
delete channel.PublicKey;
it (`invalid SettleDelay`, () => {
channel.SettleDelay = "10"
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: SettleDelay must be a number"
)
})
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: missing PublicKey"
);
});
it (`invalid PublicKey`, () => {
channel.PublicKey = 10
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: PublicKey must be a string"
)
})
it(`invalid Amount`, function () {
channel.Amount = 1000;
it (`invalid DestinationTag`, () => {
channel.DestinationTag = "10"
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: Amount must be a string"
);
});
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: DestinationTag must be a number"
)
})
it(`invalid Destination`, function () {
channel.Destination = 10;
it (`invalid CancelAfter`, () => {
channel.CancelAfter = "100"
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: CancelAfter must be a number"
)
})
})
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: Destination must be a string"
);
});
it(`invalid SettleDelay`, function () {
channel.SettleDelay = "10";
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: SettleDelay must be a number"
);
});
it(`invalid PublicKey`, function () {
channel.PublicKey = 10;
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: PublicKey must be a string"
);
});
it(`invalid DestinationTag`, function () {
channel.DestinationTag = "10";
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: DestinationTag must be a number"
);
});
it(`invalid CancelAfter`, function () {
channel.CancelAfter = "100";
assert.throws(
() => verifyPaymentChannelCreate(channel),
ValidationError,
"PaymentChannelCreate: CancelAfter must be a number"
);
});
});