Fix broken test case

This commit is contained in:
nitowa
2022-02-01 17:43:19 +01:00
parent 3d0d456db3
commit 3cc3d739af
4 changed files with 247 additions and 55 deletions
+20 -20
View File
@@ -7,8 +7,8 @@ const utf8 = require('utf8')
const base64 = require('base-64')
const expect = chai.expect
let sendWallet:Wallet
let receiveWallet:Wallet
let sendWallet: Wallet
let receiveWallet: Wallet
let api: RippleAPI
describe('XRPIO', () => {
@@ -16,23 +16,23 @@ describe('XRPIO', () => {
this.timeout(15000)
sendWallet = await makeTestnetWallet()
receiveWallet = await makeTestnetWallet()
await new Promise((res, rej) => setTimeout(res, 10000))
await new Promise((res, rej) => setTimeout(res, 10000)) //it takes a moment for the wallets to become active
})
before(async () => {
try{
try {
api = new RippleAPI({ server: TEST_CONFIG.rippleNode })
return await api.connect()
}catch(e){
} catch (e) {
console.log(e)
throw e
}
})
after(async function () {
try{
try {
return await api.disconnect()
}catch(e){
} catch (e) {
console.log(e)
}
})
@@ -48,9 +48,9 @@ describe('XRPIO', () => {
})
describe('payment', () => {
it('sendPayment', async function (){
it('sendPayment', async function () {
this.timeout(10000)
const result = await sendPayment(api, [{data: "123"}], sendWallet.address, receiveWallet.address, sendWallet.secret, latestSeq+1)
const result = await sendPayment(api, [{ data: "123" }], sendWallet.address, receiveWallet.address, sendWallet.secret, latestSeq + 1)
expect(result).to.exist
expect(result.resultCode).to.be.equal('tesSUCCESS')
})
@@ -58,31 +58,31 @@ describe('XRPIO', () => {
describe('I/O', () => {
let treeRoot
it(`can tree write (${TEST_DATA.length} bytes)`, async function (){
it(`can tree write (${TEST_DATA.length} bytes)`, async function () {
this.timeout(10000)
treeRoot = await treeWrite(api, TEST_DATA, {address: "123", secret: "123"}, receiveWallet.address)
treeRoot = await treeWrite(api, TEST_DATA, sendWallet, receiveWallet.address)
})
it('can tree read', async function() {
it('can tree read', async function () {
this.timeout(1500)
const data = await treeRead(api, [treeRoot])
expect(data).to.be.equal(TEST_DATA)
})
it(`can tree write large (${longText.length} bytes)`, async function (){
it(`can tree write large (${longText.length} bytes)`, async function () {
this.timeout(30000)
treeRoot = await treeWrite(api, longText, sendWallet, receiveWallet.address)
})
it('can tree read large', async function() {
it('can tree read large', async function () {
this.timeout(3000)
const data = await treeRead(api, [treeRoot])
expect(data).to.be.equal(longText)
})
it("can r/w binary", async function () {
this.timeout(10000);
const bytes = utf8.encode(TEST_DATA)
const encoded = base64.encode(bytes)
const txHash = await treeWrite(api, encoded, sendWallet, receiveWallet.address)