Added prints for eventIndex. Fixed some suggestions.

This commit is contained in:
Maria Carmina 2023-04-27 17:45:59 +03:00
parent 1a8f2fd981
commit 83e4c3eedf
6 changed files with 40 additions and 3 deletions

View File

@ -170,7 +170,7 @@ describe('Datatoken tests', async () => {
method: 'POST',
body: JSON.stringify(initialQuery)
})
await sleep(3000)
await sleep(2000)
const dt = (await initialResponse.json()).data.token
const tx: TransactionReceipt = await web3.eth.getTransactionReceipt(dt.tx)
@ -215,6 +215,7 @@ describe('Datatoken tests', async () => {
assert(dt.block >= blockNumber, 'incorrect value for: block')
assert(dt.block < blockNumber + 50, 'incorrect value for: block')
assert(dt.lastPriceValue === '0', 'incorrect value for: lastPriceValue')
console.log('dt.eventIndex: ', dt.eventIndex)
assert(
dt.eventIndex !== null && dt.eventIndex > 0,
'incorrect value for: eventIndex'
@ -331,6 +332,7 @@ describe('Datatoken tests', async () => {
assert(dt.block >= blockNumber, 'incorrect value for: block')
assert(dt.block < blockNumber + 50, 'incorrect value for: block')
assert(dt.lastPriceValue === '0', 'incorrect value for: lastPriceValue')
console.log('dt.eventIndex 2: ', dt.eventIndex)
assert(
dt.eventIndex !== null && dt.eventIndex > 0,
'incorrect value for: eventIndex'
@ -443,6 +445,7 @@ describe('Datatoken tests', async () => {
assert(initialToken, 'Invalid initialToken')
assert(initialToken.orderCount === '0', 'Invalid initial orderCount')
assert(initialToken.orders.length === 0, 'Invalid initial orders')
console.log('initialToken.eventIndex: ', initialToken.eventIndex)
assert(
initialToken.eventIndex !== null && initialToken.eventIndex > 0,
'Invalid eventIndex'

View File

@ -18,7 +18,7 @@ import { fetch } from 'cross-fetch'
import { TransactionReceipt } from 'web3-core'
import { AbiItem } from 'web3-utils/types'
const sleepMs = 1600
const sleepMs = 1800
const data = JSON.parse(
fs.readFileSync(
@ -173,6 +173,7 @@ describe('Dispenser tests', async () => {
assert(nft.block >= blockNumber, 'incorrect value for: block')
assert(nft.block < blockNumber + 50, 'incorrect value for: block')
assert(nft.orderCount === '0', 'incorrect value for: orderCount')
console.log('176 line nft.eventIndex: ', nft.eventIndex)
assert(
nft.eventIndex !== null && nft.eventIndex > 0,
'Invalid eventIndex for NFT creation'
@ -215,7 +216,6 @@ describe('Dispenser tests', async () => {
method: 'POST',
body: JSON.stringify(dtQuery)
})
await sleep(sleepMs)
dt = (await dtResponse.json()).data.token
const dtTx: TransactionReceipt = await web3.eth.getTransactionReceipt(dt.tx)
@ -261,6 +261,7 @@ describe('Dispenser tests', async () => {
assert(dt.block >= blockNumber, 'incorrect value for: block')
assert(dt.block < blockNumber + 50, 'incorrect value for: block')
assert(dt.lastPriceValue === '0', 'incorrect value for: lastPriceValue')
console.log('264 line eventIndex: ', dt.eventIndex)
assert(
dt.eventIndex !== null && dt.eventIndex > 0,
'incorrect value for: eventIndex'
@ -282,6 +283,7 @@ describe('Dispenser tests', async () => {
})
const dt = (await minterResponse.json()).data.token
assert(dt.minter[1] === user1, 'incorrect value for: minter')
console.log('285 line eventIndex: ', dt.eventIndex)
assert(dt.eventIndex !== null, 'incorrect value for: eventIndex')
})
@ -349,6 +351,7 @@ describe('Dispenser tests', async () => {
assert(response.createdTimestamp >= time, 'incorrect: createdTimestamp')
assert(response.createdTimestamp < time + 15, 'incorrect: createdTimestamp')
assert(response.tx === tx.transactionHash, 'incorrect value for: tx')
console.log('355 line response.eventIndex: ', response.eventIndex)
assert(
response.eventIndex !== null && response.eventIndex > 0,
'incorrect value for: eventIndex'
@ -398,6 +401,7 @@ describe('Dispenser tests', async () => {
})
const initialActive = (await initialResponse.json()).data.dispenser
assert(initialActive.active === false, 'incorrect value for: initialActive')
console.log('405 line initialActive.eventIndex: ', initialActive.eventIndex)
assert(initialActive.eventIndex !== null, 'incorrect value for: eventIndex')
// Activate dispenser
@ -467,6 +471,7 @@ describe('Dispenser tests', async () => {
assert(dispense.createdTimestamp >= time, 'incorrect: createdTimestamp')
assert(dispense.createdTimestamp < time + 15, 'incorrect: createdTimestamp')
assert(dispense.tx === tx.transactionHash, 'incorrect value for: tx')
console.log('dispense.eventIndex: ', dispense.eventIndex)
assert(dispense.eventIndex !== null, 'incorrect value for: eventIndex')
assert(dispense.__typename === 'DispenserTransaction', 'wrong __typename')
})
@ -486,6 +491,7 @@ describe('Dispenser tests', async () => {
})
const balance = (await response.json()).data.dispenser
assert(balance.balance === '0', 'incorrect value for: balance')
console.log('495 line balance.eventIndex: ', balance.eventIndex)
assert(balance.eventIndex !== null, 'incorrect value for: eventIndex')
})

View File

@ -192,6 +192,7 @@ describe('Fixed Rate Exchange tests', async () => {
assert(nft.block >= blockNumber, 'incorrect value for: block')
assert(nft.block < blockNumber + 50, 'incorrect value for: block')
assert(nft.orderCount === '0', 'incorrect value for: orderCount')
console.log('195 line nft.eventIndex: ', nft.eventIndex)
assert(
nft.eventIndex !== null && nft.eventIndex > 0,
'incorrect value for: eventIndex'
@ -280,6 +281,7 @@ describe('Fixed Rate Exchange tests', async () => {
assert(dt.block >= blockNumber, 'incorrect value for: block')
assert(dt.block < blockNumber + 50, 'incorrect value for: block')
assert(dt.lastPriceValue === '0', 'incorrect value for: lastPriceValue')
console.log('284 line dt.eventIndex: ', dt.eventIndex)
assert(
dt.eventIndex !== null && dt.eventIndex > 0,
'incorrect value for: eventIndex'
@ -396,6 +398,7 @@ describe('Fixed Rate Exchange tests', async () => {
)
assert(fixedTx.from === publisher, 'incorrect value for: tx')
assert(fixedTx.to === factoryAddress, 'incorrect value for: tx')
console.log('401 line fixed.eventIndex: ', fixed.eventIndex)
assert(
fixed.eventIndex !== null && fixed.eventIndex > 0,
'incorrect value for: eventIndex'
@ -514,6 +517,7 @@ describe('Fixed Rate Exchange tests', async () => {
const updatedActive = (await updatedResponse.json()).data.fixedRateExchange
assert(updatedActive.active === false, 'incorrect value for: updatedActive')
console.log('517 line updatedActive.eventIndex: ', updatedActive.eventIndex)
assert(
updatedActive.eventIndex !== null && updatedActive.eventIndex > 0,
'incorrect value: eventIndex'
@ -543,6 +547,7 @@ describe('Fixed Rate Exchange tests', async () => {
})
const updatedActive = (await updatedResponse.json()).data.fixedRateExchange
assert(updatedActive.active === true, 'incorrect value for: updatedActive')
console.log('546 line updatedActive.eventIndex: ', updatedActive.eventIndex)
assert(
updatedActive.eventIndex !== null && updatedActive.eventIndex > 0,
'incorrect value: eventIndex'

View File

@ -183,6 +183,7 @@ describe('NFT tests', async () => {
assert(nft.block >= blockNumber, 'incorrect value for: block')
assert(nft.block < blockNumber + 50, 'incorrect value for: block')
assert(nft.orderCount === '0', 'incorrect value for: orderCount')
console.log('186 line nft.eventIndex: ', nft.eventIndex)
assert(
nft.eventIndex !== null && nft.eventIndex > 0,
'Invalid eventIndex for NFT creation'
@ -295,6 +296,7 @@ describe('NFT tests', async () => {
assert(updatedNft.block >= blockNumber, 'incorrect value for: block')
assert(updatedNft.block < blockNumber + 50, 'incorrect value for: block')
assert(updatedNft.orderCount === '0', 'incorrect value for: orderCount')
console.log('298 line updatedNft.eventIndex: ', updatedNft.eventIndex)
assert(
updatedNft.eventIndex !== null && updatedNft.eventIndex > 0,
'Invalid eventIndex for NFT update'
@ -322,6 +324,7 @@ describe('NFT tests', async () => {
})
const updatedNft = (await response.json()).data.nft
assert(updatedNft.nftData.key !== null, 'incorrect value for key')
console.log('327 line updatedNft.eventIndex: ', updatedNft.eventIndex)
assert(
updatedNft.eventIndex !== null && updatedNft.eventIndex > 0,
'Invalid eventIndex for NFT update'

View File

@ -165,6 +165,10 @@ describe('Simple Publish & consume test', async () => {
await sleep(3000)
const queryResult = await response.json()
assert(queryResult.data.nft.id === graphNftToken)
console.log(
'168 line queryResult.data.nft.eventIndex: ',
queryResult.data.nft.eventIndex
)
assert(
queryResult.data.nft.eventIndex !== null &&
queryResult.data.nft.eventIndex > 0,
@ -214,6 +218,10 @@ describe('Simple Publish & consume test', async () => {
initialResult.data.nft.owner.id.toLowerCase() ===
publisherAccount.toLowerCase()
)
console.log(
'221 line initialResult.data.nft.eventIndex: ',
initialResult.data.nft.eventIndex
)
assert(
initialResult.data.nft.eventIndex !== null &&
initialResult.data.nft.eventIndex > 0,
@ -264,6 +272,10 @@ describe('Simple Publish & consume test', async () => {
await sleep(3000)
const queryResult = await response.json()
assert(queryResult.data.nft.owner.id === newOwnerAccount)
console.log(
'275 line queryResult.data.nft.eventIndex: ',
queryResult.data.nft.eventIndex
)
assert(
queryResult.data.nft.eventIndex !== null &&
queryResult.data.nft.eventIndex > 0,
@ -342,6 +354,10 @@ describe('Simple Publish & consume test', async () => {
setProviderFee.providerFeeToken.toLowerCase(),
'Wrong providerFeeToken set'
)
console.log(
'357 line queryResult.data.order.eventIndex: ',
queryResult.data.order.eventIndex
)
assert(
queryResult.data.order.eventIndex !== null,
'Invalid eventIndex for order'

View File

@ -82,6 +82,10 @@ describe('Tests coverage without provider/aquarius', async () => {
await sleep(3000)
const queryResult = await response.json()
assert(queryResult.data.nft.id === graphNftToken)
console.log(
'85 line queryResult.data.nft.eventIndex: ',
queryResult.data.nft.eventIndex
)
assert(
queryResult.data.nft.eventIndex !== null &&
queryResult.data.nft.eventIndex > 0