mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
feat: Jest Test Runner (#2170)
This commit is contained in:
@@ -1,36 +1,45 @@
|
||||
import { assert } from 'chai'
|
||||
import _ from 'lodash'
|
||||
import { LedgerCurrentResponse, LedgerCurrentRequest } from 'xrpl-local'
|
||||
|
||||
import { LedgerCurrentResponse, LedgerCurrentRequest } from '../../../src'
|
||||
import serverUrl from '../serverUrl'
|
||||
import { setupClient, teardownClient } from '../setup'
|
||||
import {
|
||||
setupClient,
|
||||
teardownClient,
|
||||
type XrplIntegrationTestContext,
|
||||
} from '../setup'
|
||||
|
||||
// how long before each test case times out
|
||||
const TIMEOUT = 20000
|
||||
|
||||
describe('ledger_current', function () {
|
||||
this.timeout(TIMEOUT)
|
||||
let testContext: XrplIntegrationTestContext
|
||||
|
||||
beforeEach(_.partial(setupClient, serverUrl))
|
||||
afterEach(teardownClient)
|
||||
|
||||
it('base', async function () {
|
||||
const ledgerCurrentRequest: LedgerCurrentRequest = {
|
||||
command: 'ledger_current',
|
||||
}
|
||||
|
||||
const ledgerCurrentResponse = await this.client.request(
|
||||
ledgerCurrentRequest,
|
||||
)
|
||||
|
||||
const expectedResponse: LedgerCurrentResponse = {
|
||||
id: ledgerCurrentResponse.id,
|
||||
type: 'response',
|
||||
result: {
|
||||
ledger_current_index: 1,
|
||||
},
|
||||
}
|
||||
assert.equal(ledgerCurrentResponse.type, expectedResponse.type)
|
||||
assert.typeOf(ledgerCurrentResponse.result.ledger_current_index, 'number')
|
||||
beforeEach(async () => {
|
||||
testContext = await setupClient(serverUrl)
|
||||
})
|
||||
afterEach(async () => teardownClient(testContext))
|
||||
|
||||
it(
|
||||
'base',
|
||||
async () => {
|
||||
const ledgerCurrentRequest: LedgerCurrentRequest = {
|
||||
command: 'ledger_current',
|
||||
}
|
||||
|
||||
const ledgerCurrentResponse = await testContext.client.request(
|
||||
ledgerCurrentRequest,
|
||||
)
|
||||
|
||||
const expectedResponse: LedgerCurrentResponse = {
|
||||
id: ledgerCurrentResponse.id,
|
||||
type: 'response',
|
||||
result: {
|
||||
ledger_current_index: 1,
|
||||
},
|
||||
}
|
||||
assert.equal(ledgerCurrentResponse.type, expectedResponse.type)
|
||||
assert.typeOf(ledgerCurrentResponse.result.ledger_current_index, 'number')
|
||||
},
|
||||
TIMEOUT,
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user