Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
saadahmsiddiqui committed Oct 30, 2024
1 parent 3450ebb commit 534a364
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/types/SharedConfigTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import { BaseConfig } from "@buildwithsygma/core"

export interface SharedConfig extends BaseConfig<"ethereum" | "substrate"> {
rpcUrl: string
}
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/indexing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ SPDX-License-Identifier: LGPL-3.0-only
*/
import { expect } from "chai"
import axios from "axios"
import { Network } from "@buildwithsygma/core"
import { Transfer, Resource, Fee, Deposit, Execution, Domain } from "@prisma/client"
import { DomainTypes } from "../../src/indexer/config"

import { DepositType } from "../../src/indexer/services/evmIndexer/evmTypes"

const NUMBER_OF_TRANSFERS = 35
Expand Down Expand Up @@ -62,7 +63,7 @@ describe("Indexer e2e tests", function () {
const transfers = res.data as Array<TransferResponse>

for (const transfer of transfers) {
if (transfer.fromDomain.name.toLowerCase() == DomainTypes.SUBSTRATE) {
if (transfer.fromDomain.name.toLowerCase() == Network.SUBSTRATE) {
substrateDeposits++
}
switch (transfer.resource.type) {
Expand Down
26 changes: 13 additions & 13 deletions tests/unit/parseLogs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ SPDX-License-Identifier: LGPL-3.0-only
*/
import { expect } from "chai"
import sinon from "sinon"
import { EthereumConfig, Network, ResourceType, SubstrateConfig } from "@buildwithsygma/core"
import { ApiPromise, WsProvider } from "@polkadot/api"
import { Domain, DomainTypes, ResourceTypes } from "../../src/indexer/config"
import { parseDestination } from "../../src/indexer/utils/evm"

describe("Events parser", function () {
Expand All @@ -32,10 +32,10 @@ describe("Events parser", function () {
"0x000000000000000000000000000000000000000000000000000000000007a1200004a271ced214dee6b4c59e3a0f0088878aeccf849a49031eed30140ae5594f4b6833e488bf6c4c9e94c246d90abfdb0000000000000000000000000000000000000000000000000000018b3d2082f5"
const domain = {
id: 2,
type: DomainTypes.EVM,
} as unknown as Domain
type: Network.EVM,
} as unknown as EthereumConfig

const destination = await parseDestination(hexData, domain, ResourceTypes.PERMISSIONLESS_GENERIC)
const destination = await parseDestination(hexData, domain, ResourceType.PERMISSIONLESS_GENERIC)
expect(destination).to.be.deep.equal("0xdee6b4c59e3a0f0088878aeccf849a49031eed30")
})

Expand All @@ -44,10 +44,10 @@ describe("Events parser", function () {
"0x000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000145c1f5961696bad2e73f73417f07ef55c62a2dc5b0102"
const domain = {
id: 2,
type: DomainTypes.EVM,
} as unknown as Domain
type: Network.EVM,
} as unknown as EthereumConfig

const destination = await parseDestination(hexData, domain, ResourceTypes.FUNGIBLE)
const destination = await parseDestination(hexData, domain, ResourceType.FUNGIBLE)
expect(destination).to.be.deep.equal("0x5c1f5961696bad2e73f73417f07ef55c62a2dc5b")
})

Expand All @@ -58,8 +58,8 @@ describe("Events parser", function () {
"0x00000000000000000000000000000000000000000000000000005af3107a4000000000000000000000000000000000000000000000000000000000000000002400010100d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"
const domain = {
id: 3,
type: DomainTypes.SUBSTRATE,
} as unknown as Domain
type: Network.SUBSTRATE,
} as unknown as SubstrateConfig

sinon.stub(WsProvider.prototype, "connect")
mockToJson.returns({
Expand All @@ -72,7 +72,7 @@ describe("Events parser", function () {
},
},
})
const destination = await parseDestination(hexData, domain, ResourceTypes.FUNGIBLE)
const destination = await parseDestination(hexData, domain, ResourceType.FUNGIBLE)
expect(destination).to.equal("5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY")
})

Expand All @@ -82,8 +82,8 @@ describe("Events parser", function () {
const hexData = "0x000000"
const domain = {
id: 3,
type: DomainTypes.SUBSTRATE,
} as unknown as Domain
type: Network.SUBSTRATE,
} as unknown as SubstrateConfig

mockToJson.returns({
parents: 0,
Expand All @@ -93,7 +93,7 @@ describe("Events parser", function () {
})

sinon.stub(WsProvider.prototype, "connect")
const result = await parseDestination(hexData, domain, ResourceTypes.FUNGIBLE)
const result = await parseDestination(hexData, domain, ResourceType.FUNGIBLE)
expect(result).to.equal("")
})
})

0 comments on commit 534a364

Please sign in to comment.