Skip to content

Commit

Permalink
Added unit tests for getBitcoinAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszslabon committed Nov 8, 2023
1 parent 741ff8a commit 2653e6f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion typescript/src/services/deposits/deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class Deposit {

/**
* Detects Bitcoin funding transactions transferring BTC to this deposit.
* @return Specific UTXOs targeting this deposit. Empty array in case
* @returns Specific UTXOs targeting this deposit. Empty array in case
* there are no UTXOs referring this deposit.
*/
async detectFunding(): Promise<BitcoinUtxo[]> {
Expand Down
24 changes: 24 additions & 0 deletions typescript/test/services/deposits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,30 @@ describe("Deposits", () => {
describe("Deposit", () => {
// TODO: Implement unit tests for other functions.

describe("getBitcoinAddress", () => {
let bitcoinClient: MockBitcoinClient
let tbtcContracts: MockTBTCContracts
let depositService: Deposit
let bitcoinAddress: string

beforeEach(async () => {
bitcoinClient = new MockBitcoinClient()
tbtcContracts = new MockTBTCContracts()
depositService = await Deposit.fromReceipt(
deposit,
tbtcContracts,
bitcoinClient
)
bitcoinAddress = await depositService.getBitcoinAddress()
})

it("should return correct address", () => {
expect(bitcoinAddress).to.be.equal(
"tb1qma629cu92skg0t86lftyaf9uflzwhp7jk63h6mpmv3ezh6puvdhs6w2r05"
)
})
})

describe("detectFunding", () => {
let bitcoinClient: MockBitcoinClient
let tbtcContracts: MockTBTCContracts
Expand Down

0 comments on commit 2653e6f

Please sign in to comment.