Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/hooks/__tests__/useBCH.test.js
Show First 20 Lines • Show All 408 Lines • ▼ Show 20 Lines | it('creates a token correctly', async () => { | ||||
const BCH = new BCHJS(); | const BCH = new BCHJS(); | ||||
const { expectedTxId, expectedHex, wallet, configObj } = | const { expectedTxId, expectedHex, wallet, configObj } = | ||||
createTokenMock; | createTokenMock; | ||||
BCH.RawTransactions.sendRawTransaction = jest | BCH.RawTransactions.sendRawTransaction = jest | ||||
.fn() | .fn() | ||||
.mockResolvedValue(expectedTxId); | .mockResolvedValue(expectedTxId); | ||||
expect(await createToken(BCH, wallet, 5.01, configObj)).toBe( | expect(await createToken(BCH, wallet, 5.01, configObj)).toBe( | ||||
`${currency.tokenExplorerUrl}/tx/${expectedTxId}`, | `${currency.blockExplorerUrl}/tx/${expectedTxId}`, | ||||
); | ); | ||||
expect(BCH.RawTransactions.sendRawTransaction).toHaveBeenCalledWith( | expect(BCH.RawTransactions.sendRawTransaction).toHaveBeenCalledWith( | ||||
expectedHex, | expectedHex, | ||||
); | ); | ||||
}); | }); | ||||
it('Throws correct error if user attempts to create a token with an invalid wallet', async () => { | it('Throws correct error if user attempts to create a token with an invalid wallet', async () => { | ||||
const { createToken } = useBCH(); | const { createToken } = useBCH(); | ||||
▲ Show 20 Lines • Show All 234 Lines • Show Last 20 Lines |