mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
* lint backoff * lint wsWrapper * remove rangeset - not used * split out connection.ts classes * lint requestManager * lint connectionManager * lint most of connection * fix most of client * lint broadcastClient * resolve more linter issues * resolve magic numbers * clean up more linting * resolve rest of issues * fix tests * fix browser tests * fix tests after rebase * respond to comments * fix dependency cycles
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { assert } from "chai";
|
|
|
|
import { Client } from "../../src";
|
|
import rippled from "../fixtures/rippled";
|
|
import setupClient from "../setupClient";
|
|
|
|
describe("client.hasNextPage", function () {
|
|
beforeEach(setupClient.setup);
|
|
afterEach(setupClient.teardown);
|
|
|
|
it("returns true when there is another page", async function () {
|
|
this.mockRippled.addResponse("ledger_data", rippled.ledger_data.first_page);
|
|
const response = await this.client.request({ command: "ledger_data" });
|
|
assert(Client.hasNextPage(response));
|
|
});
|
|
|
|
it("returns false when there are no more pages", async function () {
|
|
const rippledResponse = function (request: Request): object {
|
|
if ("marker" in request) {
|
|
return rippled.ledger_data.last_page;
|
|
}
|
|
return rippled.ledger_data.first_page;
|
|
};
|
|
this.mockRippled.addResponse("ledger_data", rippledResponse);
|
|
const response = await this.client.request({ command: "ledger_data" });
|
|
const responseNextPage = await this.client.requestNextPage(
|
|
{ command: "ledger_data" },
|
|
response
|
|
);
|
|
assert(!Client.hasNextPage(responseNextPage));
|
|
});
|
|
});
|