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,14 +1,14 @@
import assert from 'assert-diff'
import {assertRejects, TestSuite} from '../testUtils'
import rippled from '../fixtures/rippled'
import assert from "assert-diff";
const rippledResponse = function(request: Request) : object {
if ('marker' in request) {
return rippled.ledger_data.last_page
} else {
return rippled.ledger_data.first_page
import rippled from "../fixtures/rippled";
import { assertRejects, TestSuite } from "../testUtils";
const rippledResponse = function (request: Request): object {
if ("marker" in request) {
return rippled.ledger_data.last_page;
}
}
return rippled.ledger_data.first_page;
};
/**
* Every test suite exports their tests in the default object.
@@ -16,37 +16,35 @@ const rippledResponse = function(request: Request) : object {
* - Check out "test/client/index.ts" for more information about the test runner.
*/
export default <TestSuite>{
'requests the next page': async (client, address, mockRippled) => {
mockRippled.addResponse({command: 'ledger_data'}, rippledResponse)
// @ts-ignore
const response = await client.request({command: 'ledger_data'})
"requests the next page": async (client, address, mockRippled) => {
mockRippled.addResponse({ command: "ledger_data" }, rippledResponse);
const response = await client.request({ command: "ledger_data" });
const responseNextPage = await client.requestNextPage(
// @ts-ignore
{command: 'ledger_data'},
{ command: "ledger_data" },
response
)
);
assert.equal(
// @ts-ignore
responseNextPage.result.state[0].index,
'000B714B790C3C79FEE00D17C4DEB436B375466F29679447BA64F265FD63D731'
)
"000B714B790C3C79FEE00D17C4DEB436B375466F29679447BA64F265FD63D731"
);
},
'rejects when there are no more pages': async (client, address, mockRippled) => {
mockRippled.addResponse({command: 'ledger_data'}, rippledResponse)
// @ts-ignore
const response = await client.request({command: 'ledger_data'})
"rejects when there are no more pages": async (
client,
address,
mockRippled
) => {
mockRippled.addResponse({ command: "ledger_data" }, rippledResponse);
const response = await client.request({ command: "ledger_data" });
const responseNextPage = await client.requestNextPage(
// @ts-ignore
{command: 'ledger_data'},
{ command: "ledger_data" },
response
)
assert(!client.hasNextPage(responseNextPage))
);
assert(!client.hasNextPage(responseNextPage));
await assertRejects(
// @ts-ignore
client.requestNextPage({command: 'ledger_data'}, responseNextPage),
client.requestNextPage({ command: "ledger_data" }, responseNextPage),
Error,
'response does not have a next page'
)
}
}
"response does not have a next page"
);
},
};