mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-01 09:35: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,14 @@
|
||||
import assert from 'assert-diff'
|
||||
import {assertRejects, TestSuite} from '../testUtils'
|
||||
import rippled from '../fixtures/rippled'
|
||||
|
||||
const rippledResponse = function(request: Request) : object {
|
||||
if ('marker' in request) {
|
||||
return rippled.ledger_data.last_page
|
||||
} else {
|
||||
return rippled.ledger_data.first_page
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Every test suite exports their tests in the default object.
|
||||
@@ -7,7 +16,8 @@ import {assertRejects, TestSuite} from '../testUtils'
|
||||
* - Check out "test/client/index.ts" for more information about the test runner.
|
||||
*/
|
||||
export default <TestSuite>{
|
||||
'requests the next page': async (client, address) => {
|
||||
'requests the next page': async (client, address, mockRippled) => {
|
||||
mockRippled.addResponse({command: 'ledger_data'}, rippledResponse)
|
||||
// @ts-ignore
|
||||
const response = await client.request({command: 'ledger_data'})
|
||||
const responseNextPage = await client.requestNextPage(
|
||||
@@ -22,7 +32,8 @@ export default <TestSuite>{
|
||||
)
|
||||
},
|
||||
|
||||
'rejects when there are no more pages': async (client, address) => {
|
||||
'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'})
|
||||
const responseNextPage = await client.requestNextPage(
|
||||
|
||||
Reference in New Issue
Block a user