@rholabs/rho-sdk
Version:
Rho Protocol SDK
57 lines (50 loc) • 1.35 kB
text/typescript
import { describe, expect, test } from '@jest/globals'
import { DataServiceAPI } from '../src/v1'
const waitTimeout = 5000
const api = new DataServiceAPI({ network: 'testnet' })
describe('DataService API', () => {
test(
'getTrades',
async () => {
const trades = await api.getTrades({ count: 10 })
expect(trades.length).toBe(10)
expect(trades[0].marketId).toMatch('0x')
},
waitTimeout
)
test(
'getProvisions',
async () => {
const provisions = await api.getProvision({ count: 10 })
expect(provisions.length).toBe(10)
expect(provisions[0].marketId).toMatch('0x')
},
waitTimeout
)
test(
'getMarginUpdates',
async () => {
const marginUpdates = await api.getMarginUpdates({ count: 10 })
expect(marginUpdates.length).toBe(10)
expect(marginUpdates[0].marketId).toMatch('0x')
},
waitTimeout
)
test(
'getPositionOwnershipTransfers',
async () => {
const items = await api.getPositionOwnershipTransfers({ limit: 1 })
expect(items.length).toBe(1)
expect(items[0].marketId).toMatch('0x')
},
waitTimeout
)
test(
'getPositionLiqudations',
async () => {
const items = await api.getPositionLiqudations({ limit: 1 })
expect(items.length).toBeGreaterThanOrEqual(0)
},
waitTimeout
)
})