mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-22 13:15:49 +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,123 +1,127 @@
|
||||
import { ValidationError } from 'xrpl-local/common/errors'
|
||||
import { verifyCheckCreate } from './../../src/models/transactions/checkCreate'
|
||||
import { assert } from 'chai'
|
||||
import { assert } from "chai";
|
||||
|
||||
import { ValidationError } from "xrpl-local/common/errors";
|
||||
|
||||
import { verifyCheckCreate } from "../../src/models/transactions/checkCreate";
|
||||
|
||||
/**
|
||||
* CheckCreate Transaction Verification Testing
|
||||
* CheckCreate Transaction Verification Testing.
|
||||
*
|
||||
* Providing runtime verification testing for each specific transaction type
|
||||
* Providing runtime verification testing for each specific transaction type.
|
||||
*/
|
||||
describe('CheckCreate Transaction Verification', function () {
|
||||
|
||||
it (`verifies valid CheckCreate`, () => {
|
||||
const validCheck = {
|
||||
TransactionType : "CheckCreate",
|
||||
Account : "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||
Destination : "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
|
||||
SendMax : "100000000",
|
||||
Expiration : 570113521,
|
||||
InvoiceID : "6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
|
||||
DestinationTag : 1,
|
||||
Fee : "12"
|
||||
} as any
|
||||
|
||||
assert.doesNotThrow(() => verifyCheckCreate(validCheck))
|
||||
})
|
||||
describe("CheckCreate Transaction Verification", function () {
|
||||
it(`verifies valid CheckCreate`, function () {
|
||||
const validCheck = {
|
||||
TransactionType: "CheckCreate",
|
||||
Account: "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||
Destination: "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
|
||||
SendMax: "100000000",
|
||||
Expiration: 570113521,
|
||||
InvoiceID:
|
||||
"6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
|
||||
DestinationTag: 1,
|
||||
Fee: "12",
|
||||
} as any;
|
||||
|
||||
assert.doesNotThrow(() => verifyCheckCreate(validCheck));
|
||||
});
|
||||
|
||||
it (`throws w/ invalid Destination`, () => {
|
||||
const invalidDestination = {
|
||||
TransactionType : "CheckCreate",
|
||||
Account : "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||
Destination : 7896214563214789632154,
|
||||
SendMax : "100000000",
|
||||
Expiration : 570113521,
|
||||
InvoiceID : "6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
|
||||
DestinationTag : 1,
|
||||
Fee : "12"
|
||||
} as any
|
||||
it(`throws w/ invalid Destination`, function () {
|
||||
const invalidDestination = {
|
||||
TransactionType: "CheckCreate",
|
||||
Account: "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||
Destination: 7896214563214789632154,
|
||||
SendMax: "100000000",
|
||||
Expiration: 570113521,
|
||||
InvoiceID:
|
||||
"6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
|
||||
DestinationTag: 1,
|
||||
Fee: "12",
|
||||
} as any;
|
||||
|
||||
assert.throws(
|
||||
() => verifyCheckCreate(invalidDestination),
|
||||
ValidationError,
|
||||
"CheckCreate: invalid Destination"
|
||||
)
|
||||
})
|
||||
assert.throws(
|
||||
() => verifyCheckCreate(invalidDestination),
|
||||
ValidationError,
|
||||
"CheckCreate: invalid Destination"
|
||||
);
|
||||
});
|
||||
|
||||
it (`throws w/ invalid SendMax`, () => {
|
||||
const invalidSendMax = {
|
||||
TransactionType : "CheckCreate",
|
||||
Account : "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||
Destination : "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
|
||||
SendMax : 100000000,
|
||||
Expiration : 570113521,
|
||||
InvoiceID : "6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
|
||||
DestinationTag : 1,
|
||||
Fee : "12"
|
||||
} as any
|
||||
it(`throws w/ invalid SendMax`, function () {
|
||||
const invalidSendMax = {
|
||||
TransactionType: "CheckCreate",
|
||||
Account: "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||
Destination: "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
|
||||
SendMax: 100000000,
|
||||
Expiration: 570113521,
|
||||
InvoiceID:
|
||||
"6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
|
||||
DestinationTag: 1,
|
||||
Fee: "12",
|
||||
} as any;
|
||||
|
||||
assert.throws(
|
||||
() => verifyCheckCreate(invalidSendMax),
|
||||
ValidationError,
|
||||
"CheckCreate: invalid SendMax"
|
||||
)
|
||||
})
|
||||
assert.throws(
|
||||
() => verifyCheckCreate(invalidSendMax),
|
||||
ValidationError,
|
||||
"CheckCreate: invalid SendMax"
|
||||
);
|
||||
});
|
||||
|
||||
it (`throws w/ invalid DestinationTag`, () => {
|
||||
const invalidDestinationTag = {
|
||||
TransactionType : "CheckCreate",
|
||||
Account : "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||
Destination : "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
|
||||
SendMax : "100000000",
|
||||
Expiration : 570113521,
|
||||
InvoiceID : "6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
|
||||
DestinationTag : "1",
|
||||
Fee : "12"
|
||||
} as any
|
||||
it(`throws w/ invalid DestinationTag`, function () {
|
||||
const invalidDestinationTag = {
|
||||
TransactionType: "CheckCreate",
|
||||
Account: "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||
Destination: "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
|
||||
SendMax: "100000000",
|
||||
Expiration: 570113521,
|
||||
InvoiceID:
|
||||
"6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
|
||||
DestinationTag: "1",
|
||||
Fee: "12",
|
||||
} as any;
|
||||
|
||||
assert.throws(
|
||||
() => verifyCheckCreate(invalidDestinationTag),
|
||||
ValidationError,
|
||||
"CheckCreate: invalid DestinationTag"
|
||||
)
|
||||
})
|
||||
assert.throws(
|
||||
() => verifyCheckCreate(invalidDestinationTag),
|
||||
ValidationError,
|
||||
"CheckCreate: invalid DestinationTag"
|
||||
);
|
||||
});
|
||||
|
||||
it (`throws w/ invalid Expiration`, () => {
|
||||
const invalidExpiration = {
|
||||
TransactionType : "CheckCreate",
|
||||
Account : "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||
Destination : "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
|
||||
SendMax : "100000000",
|
||||
Expiration : "570113521",
|
||||
InvoiceID : "6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
|
||||
DestinationTag : 1,
|
||||
Fee : "12"
|
||||
} as any
|
||||
it(`throws w/ invalid Expiration`, function () {
|
||||
const invalidExpiration = {
|
||||
TransactionType: "CheckCreate",
|
||||
Account: "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||
Destination: "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
|
||||
SendMax: "100000000",
|
||||
Expiration: "570113521",
|
||||
InvoiceID:
|
||||
"6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
|
||||
DestinationTag: 1,
|
||||
Fee: "12",
|
||||
} as any;
|
||||
|
||||
assert.throws(
|
||||
() => verifyCheckCreate(invalidExpiration),
|
||||
ValidationError,
|
||||
"CheckCreate: invalid Expiration"
|
||||
)
|
||||
})
|
||||
assert.throws(
|
||||
() => verifyCheckCreate(invalidExpiration),
|
||||
ValidationError,
|
||||
"CheckCreate: invalid Expiration"
|
||||
);
|
||||
});
|
||||
|
||||
it (`throws w/ invalid InvoiceID`, () => {
|
||||
const invalidInvoiceID = {
|
||||
TransactionType : "CheckCreate",
|
||||
Account : "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||
Destination : "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
|
||||
SendMax : "100000000",
|
||||
Expiration : 570113521,
|
||||
InvoiceID : 7896545655285446963258531,
|
||||
DestinationTag : 1,
|
||||
Fee : "12"
|
||||
} as any
|
||||
it(`throws w/ invalid InvoiceID`, function () {
|
||||
const invalidInvoiceID = {
|
||||
TransactionType: "CheckCreate",
|
||||
Account: "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||
Destination: "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
|
||||
SendMax: "100000000",
|
||||
Expiration: 570113521,
|
||||
InvoiceID: 7896545655285446963258531,
|
||||
DestinationTag: 1,
|
||||
Fee: "12",
|
||||
} as any;
|
||||
|
||||
assert.throws(
|
||||
() => verifyCheckCreate(invalidInvoiceID),
|
||||
ValidationError,
|
||||
"CheckCreate: invalid InvoiceID"
|
||||
)
|
||||
})
|
||||
|
||||
})
|
||||
assert.throws(
|
||||
() => verifyCheckCreate(invalidInvoiceID),
|
||||
ValidationError,
|
||||
"CheckCreate: invalid InvoiceID"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user