mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-29 00:25:48 +00:00
refactor: move fixtures closer to tests (part 2) (#1561)
* move echo * move fee * move subscribe/unsubscribe * move ledger_current * move ledger_data * move submit/submit_multisigned * remove account_tx/account_offers/gateway_balances * move account_info * remove ledger_entry * remove tx * remove account_lines * remove ripple_path_find * remove ledger * remove book_offers * move ping * remove global_config * move test_command * additional mock-rippled cleanup * add explanatory comment to mock.addResponse
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import assert from 'assert-diff'
|
||||
import {TestSuite} from '../testUtils'
|
||||
import rippled from '../fixtures/rippled'
|
||||
|
||||
/**
|
||||
* Every test suite exports their tests in the default object.
|
||||
@@ -7,13 +8,22 @@ import {TestSuite} from '../testUtils'
|
||||
* - Check out "test/client/index.ts" for more information about the test runner.
|
||||
*/
|
||||
export default <TestSuite>{
|
||||
'returns true when there is another page': async (client, address) => {
|
||||
'returns true when there is another page': async (client, address, mockRippled) => {
|
||||
mockRippled.addResponse({command: 'ledger_data'}, rippled.ledger_data.first_page)
|
||||
// @ts-ignore
|
||||
const response = await client.request({command: 'ledger_data'})
|
||||
assert(client.hasNextPage(response))
|
||||
},
|
||||
|
||||
'returns false when there are no more pages': async (client, address) => {
|
||||
'returns false when there are no more pages': async (client, address, mockRippled) => {
|
||||
const rippledResponse = function(request: Request) : object {
|
||||
if ('marker' in request) {
|
||||
return rippled.ledger_data.last_page
|
||||
} else {
|
||||
return rippled.ledger_data.first_page
|
||||
}
|
||||
}
|
||||
mockRippled.addResponse({command: 'ledger_data'}, rippledResponse)
|
||||
// @ts-ignore
|
||||
const response = await client.request({command: 'ledger_data'})
|
||||
const responseNextPage = await client.requestNextPage(
|
||||
|
||||
Reference in New Issue
Block a user