Skip to content

Commit

Permalink
Fix broken unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-zimnoch committed Mar 14, 2024
1 parent dc7c78f commit 029b974
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 23 deletions.
5 changes: 4 additions & 1 deletion typescript/src/lib/ethereum/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ export class EthereumBridge
extends EthersContractHandle<BridgeTypechain>
implements Bridge
{
constructor(config: EthersContractConfig, chainId: Chains.Ethereum) {
constructor(
config: EthersContractConfig,
chainId: Chains.Ethereum = Chains.Ethereum.Local
) {
let deployment: EthersContractDeployment

switch (chainId) {
Expand Down
5 changes: 4 additions & 1 deletion typescript/src/lib/ethereum/tbtc-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export class EthereumTBTCToken
extends EthersContractHandle<TBTCTypechain>
implements TBTCToken
{
constructor(config: EthersContractConfig, chainId: Chains.Ethereum) {
constructor(
config: EthersContractConfig,
chainId: Chains.Ethereum = Chains.Ethereum.Local
) {
let deployment: EthersContractDeployment

switch (chainId) {
Expand Down
19 changes: 0 additions & 19 deletions typescript/test/lib/ethereum.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
EthereumBridge,
EthereumTBTCToken,
ethereumAddressFromSigner,
ethereumNetworkFromSigner,
Hex,
} from "../../src"
import {
Expand Down Expand Up @@ -691,22 +690,4 @@ describe("Ethereum", () => {
})
})
})

describe("ethereumNetworkFromSigner", () => {
context("when the signer is a wallet", () => {
const [mockSigner] = new MockProvider().getWallets()
it("should return the signer's network", async () => {
expect(await ethereumNetworkFromSigner(mockSigner)).to.be.eql("local")
})
})

context("when the signer is a provider", () => {
const mockProvider = getDefaultProvider()
it("should return the signer's network", async () => {
expect(await ethereumNetworkFromSigner(mockProvider)).to.be.eql(
"mainnet"
)
})
})
})
})
15 changes: 13 additions & 2 deletions typescript/test/services/deposits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
DepositsService,
EthereumAddress,
extractBitcoinRawTxVectors,
L2Chain,
} from "../../src"
import { MockBitcoinClient } from "../utils/mock-bitcoin-client"
import { MockTBTCContracts } from "../utils/mock-tbtc-contracts"
Expand Down Expand Up @@ -1620,7 +1621,12 @@ describe("Deposits", () => {
let depositService: DepositsService

beforeEach(async () => {
depositService = new DepositsService(tbtcContracts, bitcoinClient)
depositService = new DepositsService(
tbtcContracts,
bitcoinClient,
// Mock cross-chain contracts resolver.
(_: L2Chain) => undefined
)
})

context("when default depositor is not set", () => {
Expand Down Expand Up @@ -1801,7 +1807,12 @@ describe("Deposits", () => {
let depositService: DepositsService

beforeEach(async () => {
depositService = new DepositsService(tbtcContracts, bitcoinClient)
depositService = new DepositsService(
tbtcContracts,
bitcoinClient,
// Mock cross-chain contracts resolver.
(_: L2Chain) => undefined
)
})

context("when active wallet is not set", () => {
Expand Down

0 comments on commit 029b974

Please sign in to comment.