mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 20:25:48 +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,69 +1,71 @@
|
||||
import { ValidationError } from 'xrpl-local/common/errors'
|
||||
import { verifyTicketCreate } from './../../src/models/transactions/ticketCreate'
|
||||
import { assert } from 'chai'
|
||||
import { assert } from "chai";
|
||||
|
||||
import { ValidationError } from "xrpl-local/common/errors";
|
||||
|
||||
import { verifyTicketCreate } from "../../src/models/transactions/ticketCreate";
|
||||
|
||||
/**
|
||||
* TicketCreate Transaction Verification Testing
|
||||
* TicketCreate Transaction Verification Testing.
|
||||
*
|
||||
* Providing runtime verification testing for each specific transaction type
|
||||
* Providing runtime verification testing for each specific transaction type.
|
||||
*/
|
||||
describe('TicketCreate Transaction Verification', () => {
|
||||
let ticketCreate
|
||||
describe("TicketCreate Transaction Verification", function () {
|
||||
let ticketCreate;
|
||||
|
||||
beforeEach(() => {
|
||||
ticketCreate = {
|
||||
TransactionType: 'TicketCreate',
|
||||
Account: 'rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo',
|
||||
TicketCount: 150,
|
||||
} as any
|
||||
})
|
||||
beforeEach(function () {
|
||||
ticketCreate = {
|
||||
TransactionType: "TicketCreate",
|
||||
Account: "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||
TicketCount: 150,
|
||||
} as any;
|
||||
});
|
||||
|
||||
it ('verifies valid TicketCreate', () => {
|
||||
assert.doesNotThrow(() => verifyTicketCreate(ticketCreate))
|
||||
})
|
||||
it("verifies valid TicketCreate", function () {
|
||||
assert.doesNotThrow(() => verifyTicketCreate(ticketCreate));
|
||||
});
|
||||
|
||||
it ('throws when TicketCount is missing', () => {
|
||||
delete ticketCreate.TicketCount
|
||||
assert.throws(
|
||||
() => verifyTicketCreate(ticketCreate),
|
||||
ValidationError,
|
||||
'TicketCreate: missing field TicketCount'
|
||||
)
|
||||
})
|
||||
it("throws when TicketCount is missing", function () {
|
||||
delete ticketCreate.TicketCount;
|
||||
assert.throws(
|
||||
() => verifyTicketCreate(ticketCreate),
|
||||
ValidationError,
|
||||
"TicketCreate: missing field TicketCount"
|
||||
);
|
||||
});
|
||||
|
||||
it ('throws when TicketCount is not a number', () => {
|
||||
ticketCreate.TicketCount = '150'
|
||||
assert.throws(
|
||||
() => verifyTicketCreate(ticketCreate),
|
||||
ValidationError,
|
||||
'TicketCreate: TicketCount must be a number'
|
||||
)
|
||||
})
|
||||
it("throws when TicketCount is not a number", function () {
|
||||
ticketCreate.TicketCount = "150";
|
||||
assert.throws(
|
||||
() => verifyTicketCreate(ticketCreate),
|
||||
ValidationError,
|
||||
"TicketCreate: TicketCount must be a number"
|
||||
);
|
||||
});
|
||||
|
||||
it ('throws when TicketCount is not an integer', () => {
|
||||
ticketCreate.TicketCount = 12.5
|
||||
assert.throws(
|
||||
() => verifyTicketCreate(ticketCreate),
|
||||
ValidationError,
|
||||
'TicketCreate: TicketCount must be an integer from 1 to 250'
|
||||
)
|
||||
})
|
||||
it("throws when TicketCount is not an integer", function () {
|
||||
ticketCreate.TicketCount = 12.5;
|
||||
assert.throws(
|
||||
() => verifyTicketCreate(ticketCreate),
|
||||
ValidationError,
|
||||
"TicketCreate: TicketCount must be an integer from 1 to 250"
|
||||
);
|
||||
});
|
||||
|
||||
it ('throws when TicketCount is < 1', () => {
|
||||
ticketCreate.TicketCount = 0
|
||||
assert.throws(
|
||||
() => verifyTicketCreate(ticketCreate),
|
||||
ValidationError,
|
||||
'TicketCreate: TicketCount must be an integer from 1 to 250'
|
||||
)
|
||||
})
|
||||
it("throws when TicketCount is < 1", function () {
|
||||
ticketCreate.TicketCount = 0;
|
||||
assert.throws(
|
||||
() => verifyTicketCreate(ticketCreate),
|
||||
ValidationError,
|
||||
"TicketCreate: TicketCount must be an integer from 1 to 250"
|
||||
);
|
||||
});
|
||||
|
||||
it ('throws when TicketCount is > 250', () => {
|
||||
ticketCreate.TicketCount = 251
|
||||
assert.throws(
|
||||
() => verifyTicketCreate(ticketCreate),
|
||||
ValidationError,
|
||||
'TicketCreate: TicketCount must be an integer from 1 to 250'
|
||||
)
|
||||
})
|
||||
})
|
||||
it("throws when TicketCount is > 250", function () {
|
||||
ticketCreate.TicketCount = 251;
|
||||
assert.throws(
|
||||
() => verifyTicketCreate(ticketCreate),
|
||||
ValidationError,
|
||||
"TicketCreate: TicketCount must be an integer from 1 to 250"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user