Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/hooks/__tests__/useBCH.test.js
Show First 20 Lines • Show All 343 Lines • ▼ Show 20 Lines | it('Throws correct error if user attempts to create a token with an invalid wallet', async () => { | ||||
); | ); | ||||
await expect(invalidWalletTokenCreation).rejects.toThrow( | await expect(invalidWalletTokenCreation).rejects.toThrow( | ||||
new Error('Invalid wallet'), | new Error('Invalid wallet'), | ||||
); | ); | ||||
}); | }); | ||||
it(`getRecipientPublicKey() correctly retrieves the public key of a cash address`, async () => { | it(`getRecipientPublicKey() correctly retrieves the public key of a cash address`, async () => { | ||||
const { getRecipientPublicKey } = useBCH(); | const { getRecipientPublicKey } = useBCH(); | ||||
const BCH = new BCHJS(); | |||||
const chronik = new ChronikClient( | const chronik = new ChronikClient( | ||||
'https://FakeChronikUrlToEnsureMocksOnly.com', | 'https://FakeChronikUrlToEnsureMocksOnly.com', | ||||
); | ); | ||||
const expectedPubKey = | const expectedPubKey = | ||||
'03208c4f52229e021ddec5fc6e07a59fd66388ac52bc2a2c1e0f1afb24b0e275ac'; | '03208c4f52229e021ddec5fc6e07a59fd66388ac52bc2a2c1e0f1afb24b0e275ac'; | ||||
const destinationAddress = | const destinationAddress = | ||||
'bitcoincash:qqvuj09f80sw9j7qru84ptxf0hyqffc38gstxfs5ru'; | 'bitcoincash:qqvuj09f80sw9j7qru84ptxf0hyqffc38gstxfs5ru'; | ||||
expect( | expect( | ||||
await getRecipientPublicKey( | await getRecipientPublicKey( | ||||
BCH, | |||||
chronik, | chronik, | ||||
destinationAddress, | destinationAddress, | ||||
expectedPubKey, | expectedPubKey, | ||||
), | ), | ||||
).toBe(expectedPubKey); | ).toBe(expectedPubKey); | ||||
}); | }); | ||||
}); | }); |