Add functionality to verify sender on reads

This commit is contained in:
nitowa
2023-05-03 22:07:18 +02:00
parent 50fa056fe3
commit 04dab07fb5
4 changed files with 45 additions and 20 deletions
+32 -11
View File
@@ -36,7 +36,6 @@ describe('XRPIO', () => {
})
it('getAccountSequence', async function(){
//this.skip()
this.timeout(10000)
const seq = await api.getAccountSequence(sendWallet.address)
expect(seq).to.exist
@@ -44,7 +43,7 @@ describe('XRPIO', () => {
})
it('estimateFee', async function () {
this.timeout(2000)
this.timeout(10000)
const cost = await api.estimateFee(longText)
expect(cost).to.be.a('number')
expect(cost).to.be.lessThan(50)
@@ -53,7 +52,6 @@ describe('XRPIO', () => {
let txHash
it('writeRaw', async function(){
//this.skip()
this.timeout(15000)
txHash = await api.writeRaw({data: TEST_DATA}, receiveWallet.address, sendWallet.secret);
expect(txHash).to.exist
@@ -61,13 +59,26 @@ describe('XRPIO', () => {
})
it('readRaw', async function () {
//this.skip()
this.timeout(15000)
const memo = await api.readRaw(txHash)
expect(memo).to.exist
expect(memo.data).to.be.equal(TEST_DATA)
})
it('verifyOwner readRaw', async function (){
this.timeout(15000)
const memo = await api.readRaw(txHash, sendWallet.address)
expect(memo).to.exist
expect(memo.data).to.be.equal(TEST_DATA)
})
it('verifyOwner readRaw bad owner', function (done){
this.timeout(15000)
api.readRaw(txHash, "not the owner")
.then(_ => done(new Error('Expected error but succeeded')))
.catch(_ => done())
})
it('readRaw bad hash', function (done){
this.timeout(150000)
api.readRaw("123")
@@ -76,7 +87,6 @@ describe('XRPIO', () => {
})
it('treeWrite', async function(){
// this.skip()
this.timeout(45000)
txHash = await api.treeWrite(longText, receiveWallet.address, sendWallet.secret)
expect(txHash).to.exist
@@ -84,15 +94,27 @@ describe('XRPIO', () => {
})
it('treeRead', async function(){
// this.skip()
this.timeout(45000)
txHash = await api.treeRead([txHash])
expect(txHash).to.exist
expect(txHash).to.be.equal(longText)
const data = await api.treeRead([txHash])
expect(data).to.exist
expect(data).to.be.equal(longText)
})
it('treeRead verify owner', async function(){
this.timeout(45000)
const data = await api.treeRead([txHash], sendWallet.address)
expect(data).to.exist
expect(data).to.be.equal(longText)
})
it('verifyOwner treeRead bad owner', function(done){
this.timeout(45000)
api.treeRead([txHash], "not the owner")
.then(_ => done(new Error('Expected error but succeeded')))
.catch(_ => done())
})
it('treeWrite XL', async function(){
//this.skip()
this.timeout(450000)
txHash = await api.treeWrite(htmlTxt, receiveWallet.address, sendWallet.secret)
expect(txHash).to.exist
@@ -100,7 +122,6 @@ describe('XRPIO', () => {
})
it('treeRead XL', async function(){
//this.skip()
this.timeout(450000)
const data = await api.treeRead([txHash])
expect(data).to.exist