mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
committed by
Mayukha Vadari
parent
8c5bc22317
commit
e200de3073
@@ -1,32 +1,32 @@
|
||||
import { assert } from "chai";
|
||||
import { assert } from 'chai'
|
||||
|
||||
import { Client } from "../../src";
|
||||
import rippled from "../fixtures/rippled";
|
||||
import setupClient from "../setupClient";
|
||||
import { Client } from '../../src'
|
||||
import rippled from '../fixtures/rippled'
|
||||
import setupClient from '../setupClient'
|
||||
|
||||
describe("client.hasNextPage", function () {
|
||||
beforeEach(setupClient.setup);
|
||||
afterEach(setupClient.teardown);
|
||||
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 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 () {
|
||||
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;
|
||||
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" });
|
||||
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));
|
||||
});
|
||||
});
|
||||
{ command: 'ledger_data' },
|
||||
response,
|
||||
)
|
||||
assert(!Client.hasNextPage(responseNextPage))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user