mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-21 04:35: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,110 +1,111 @@
|
||||
import { ValidationError } from 'xrpl-local/common/errors'
|
||||
import { verifyAccountSet } from './../../src/models/transactions/accountSet'
|
||||
import { assert } from 'chai'
|
||||
import { assert } from "chai";
|
||||
|
||||
import { ValidationError } from "xrpl-local/common/errors";
|
||||
|
||||
import { verifyAccountSet } from "../../src/models/transactions/accountSet";
|
||||
|
||||
/**
|
||||
* AccountSet Transaction Verification Testing
|
||||
* AccountSet Transaction Verification Testing.
|
||||
*
|
||||
* Providing runtime verification testing for each specific transaction type
|
||||
* Providing runtime verification testing for each specific transaction type.
|
||||
*/
|
||||
describe('AccountSet Transaction Verification', function () {
|
||||
describe("AccountSet Transaction Verification", function () {
|
||||
let account;
|
||||
|
||||
let account
|
||||
beforeEach(function () {
|
||||
account = {
|
||||
TransactionType: "AccountSet",
|
||||
Account: "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
Fee: "12",
|
||||
Sequence: 5,
|
||||
Domain: "6578616D706C652E636F6D",
|
||||
SetFlag: 5,
|
||||
MessageKey:
|
||||
"03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB",
|
||||
} as any;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
account = {
|
||||
TransactionType : "AccountSet",
|
||||
Account : "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
Fee : "12",
|
||||
Sequence : 5,
|
||||
Domain : "6578616D706C652E636F6D",
|
||||
SetFlag : 5,
|
||||
MessageKey : "03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB"
|
||||
} as any
|
||||
})
|
||||
it(`verifies valid AccountSet`, function () {
|
||||
assert.doesNotThrow(() => verifyAccountSet(account));
|
||||
});
|
||||
|
||||
it (`verifies valid AccountSet`, () => {
|
||||
assert.doesNotThrow(() => verifyAccountSet(account))
|
||||
})
|
||||
it(`throws w/ invalid SetFlag (out of range)`, function () {
|
||||
account.SetFlag = 12;
|
||||
|
||||
it (`throws w/ invalid SetFlag (out of range)`, () => {
|
||||
account.SetFlag = 12
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid SetFlag"
|
||||
);
|
||||
});
|
||||
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid SetFlag"
|
||||
)
|
||||
})
|
||||
it(`throws w/ invalid SetFlag (incorrect type)`, function () {
|
||||
account.SetFlag = "abc";
|
||||
|
||||
it (`throws w/ invalid SetFlag (incorrect type)`, () => {
|
||||
account.SetFlag = 'abc'
|
||||
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid SetFlag"
|
||||
)
|
||||
})
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid SetFlag"
|
||||
);
|
||||
});
|
||||
|
||||
it (`throws w/ invalid ClearFlag`, () => {
|
||||
account.ClearFlag = 12
|
||||
it(`throws w/ invalid ClearFlag`, function () {
|
||||
account.ClearFlag = 12;
|
||||
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid ClearFlag"
|
||||
)
|
||||
})
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid ClearFlag"
|
||||
);
|
||||
});
|
||||
|
||||
it (`throws w/ invalid Domain`, () => {
|
||||
account.Domain = 6578616
|
||||
it(`throws w/ invalid Domain`, function () {
|
||||
account.Domain = 6578616;
|
||||
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid Domain"
|
||||
)
|
||||
})
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid Domain"
|
||||
);
|
||||
});
|
||||
|
||||
it (`throws w/ invalid EmailHash`, () => {
|
||||
account.EmailHash = 657861645678909876543456789876543
|
||||
it(`throws w/ invalid EmailHash`, function () {
|
||||
account.EmailHash = 657861645678909876543456789876543;
|
||||
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid EmailHash"
|
||||
)
|
||||
})
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid EmailHash"
|
||||
);
|
||||
});
|
||||
|
||||
it (`throws w/ invalid MessageKey`, () => {
|
||||
account.MessageKey = 65786165678908765456789567890678
|
||||
it(`throws w/ invalid MessageKey`, function () {
|
||||
account.MessageKey = 65786165678908765456789567890678;
|
||||
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid MessageKey"
|
||||
)
|
||||
})
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid MessageKey"
|
||||
);
|
||||
});
|
||||
|
||||
it (`throws w/ invalid TransferRate`, () => {
|
||||
account.TransferRate = "1000000001"
|
||||
it(`throws w/ invalid TransferRate`, function () {
|
||||
account.TransferRate = "1000000001";
|
||||
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid TransferRate"
|
||||
)
|
||||
})
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid TransferRate"
|
||||
);
|
||||
});
|
||||
|
||||
it (`throws w/ invalid TickSize`, () => {
|
||||
account.TickSize = 20
|
||||
it(`throws w/ invalid TickSize`, function () {
|
||||
account.TickSize = 20;
|
||||
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid TickSize"
|
||||
)
|
||||
})
|
||||
|
||||
})
|
||||
assert.throws(
|
||||
() => verifyAccountSet(account),
|
||||
ValidationError,
|
||||
"AccountSet: invalid TickSize"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user