mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-01 17:45:49 +00:00
Rename RippleAPI client to Client (#1520)
* rename RippleAPI -> XrplClient * more renames * move API stuff to client folder * rename all api -> client * fix tests * make tests run * fix integ tests * fix urls * fix merge issues * XrplClient -> Client * fix merge issues * rename xrpl-client npm symlink to xrpl-local
This commit is contained in:
47
test/client/getBalances/index.ts
Normal file
47
test/client/getBalances/index.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import responses from '../../fixtures/responses'
|
||||
import {assertResultMatch, TestSuite} from '../../utils'
|
||||
|
||||
/**
|
||||
* Every test suite exports their tests in the default object.
|
||||
* - Check out the "TestSuite" type for documentation on the interface.
|
||||
* - Check out "test/client/index.ts" for more information about the test runner.
|
||||
*/
|
||||
export default <TestSuite>{
|
||||
'getBalances': async (client, address) => {
|
||||
const result = await client.getBalances(address)
|
||||
assertResultMatch(result, responses.getBalances, 'getBalances')
|
||||
},
|
||||
|
||||
'getBalances - limit': async (client, address) => {
|
||||
const options = {limit: 3, ledgerVersion: 123456}
|
||||
const expectedResponse = responses.getBalances.slice(0, 3)
|
||||
const result = await client.getBalances(address, options)
|
||||
assertResultMatch(result, expectedResponse, 'getBalances')
|
||||
},
|
||||
|
||||
'getBalances - limit & currency': async (client, address) => {
|
||||
const options = {currency: 'USD', limit: 3}
|
||||
const expectedResponse = responses.getBalances
|
||||
.filter((item) => item.currency === 'USD')
|
||||
.slice(0, 3)
|
||||
const result = await client.getBalances(address, options)
|
||||
assertResultMatch(result, expectedResponse, 'getBalances')
|
||||
},
|
||||
|
||||
'getBalances - limit & currency & issuer': async (client, address) => {
|
||||
const options = {
|
||||
currency: 'USD',
|
||||
counterparty: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
|
||||
limit: 3
|
||||
}
|
||||
const expectedResponse = responses.getBalances
|
||||
.filter(
|
||||
(item) =>
|
||||
item.currency === 'USD' &&
|
||||
item.counterparty === 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B'
|
||||
)
|
||||
.slice(0, 3)
|
||||
const result = await client.getBalances(address, options)
|
||||
assertResultMatch(result, expectedResponse, 'getBalances')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user