Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhfnjust committed Feb 25, 2024
1 parent 163b053 commit b640509
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
5 changes: 1 addition & 4 deletions tests/bsv20LockBtcToMint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,7 @@ function prepProofFromElectrum(proof: any): MerkleProof {
),
pos: MerklePath.INVALID_NODE,
}
return [
...res,
...Array(Number(MerklePath.DEPTH) - res.length).fill(invalidNode),
] as MerkleProof
return [...res, ...Array(32 - res.length).fill(invalidNode)] as MerkleProof
}

function numToBoolList(num) {
Expand Down
18 changes: 9 additions & 9 deletions tests/btcSwap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('Test SmartContract `BTCSwap`', () => {
await btcSwap.connect(getDefaultSigner(alicePrivKey))

await btcSwap.deploy(1)
const callContract = async () =>{
const callContract = async () => {
btcSwap.methods.swap(
btcTx,
merkleProof,
Expand All @@ -152,15 +152,15 @@ describe('Test SmartContract `BTCSwap`', () => {
pubKeyOrAddrToSign: alicePubKey,
} as MethodCallOptions<BTCSwap>
)
}
return expect(callContract()).not.rejected
})
}
return expect(callContract()).not.rejected
})

it('should pass cancel', async () => {
await btcSwap.connect(getDefaultSigner(bobPrivKey))

await btcSwap.deploy(1)
const callContract = async () =>{
const callContract = async () => {
btcSwap.methods.cancel(
PubKey(bobPubKey.toByteString()),
(sigResps) => findSig(sigResps, bobPubKey),
Expand All @@ -169,9 +169,9 @@ describe('Test SmartContract `BTCSwap`', () => {
pubKeyOrAddrToSign: bobPubKey,
} as MethodCallOptions<BTCSwap>
)
}
return expect(callContract()).not.rejected
})
}
return expect(callContract()).not.rejected
})
})

/**
Expand Down Expand Up @@ -226,7 +226,7 @@ function prepProofFromElectrum(proof: any): MerkleProof {
}
return [
...res,
...Array(Number(MerklePath.DEPTH) - res.length).fill(invalidNode),
...Array(Number(32) - res.length).fill(invalidNode),
] as MerkleProof
}

Expand Down

0 comments on commit b640509

Please sign in to comment.