Skip to content

Commit

Permalink
Fix tests for orders in indexer.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariacarmina committed Dec 5, 2024
1 parent c072e1d commit a881255
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/test/integration/indexer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
} from '../../utils/address.js'
import { createFee } from '../../components/core/utils/feesHandler.js'
import { DDO } from '../../@types/DDO/DDO.js'
import { Stats } from '../../@types/DDO/IndexedMetadata.js'

Check failure on line 33 in src/test/integration/indexer.test.ts

View workflow job for this annotation

GitHub Actions / lint

'Stats' is defined but never used
import {
DEFAULT_TEST_TIMEOUT,
OverrideEnvConfig,
Expand Down Expand Up @@ -449,9 +450,15 @@ describe('Indexer stores a new metadata events and orders.', () => {
true
)
if (ddo) {
const retrievedDDO: any = ddo
expect(retrievedDDO.stats.orders).to.equal(1)
initialOrderCount = retrievedDDO.stats.orders
const retrievedDDO: DDO = ddo
console.log('indexer retrieved ddo: ', JSON.stringify(retrievedDDO))
for (const stat of retrievedDDO.indexedMetadata.stats) {
if (stat.datatokenAddress === datatokenAddress) {
expect(stat.orders).to.equal(1)
initialOrderCount = stat.orders
break
}
}
const resultOrder = await database.order.retrieve(orderTxId)
if (resultOrder) {
if (resultOrder.id) {
Expand Down Expand Up @@ -536,10 +543,15 @@ describe('Indexer stores a new metadata events and orders.', () => {
true
)

const retrievedDDO: any = ddo
const retrievedDDO: DDO = ddo

if (retrievedDDO) {
expect(retrievedDDO.stats.orders).to.be.greaterThan(initialOrderCount)
for (const stat of retrievedDDO.indexedMetadata.stats) {
if (stat.datatokenAddress === datatokenAddress) {
expect(stat.orders).to.be.greaterThan(initialOrderCount)
break
}
}
const resultOrder = await database.order.retrieve(reuseOrderTxId)
if (resultOrder) {
if (resultOrder.id) {
Expand Down

0 comments on commit a881255

Please sign in to comment.