Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/hooks/__tests__/useBCH.test.js
Show First 20 Lines • Show All 316 Lines • ▼ Show 20 Lines | it('creates a token correctly', async () => { | ||||
expectedHex, | expectedHex, | ||||
wallet, | wallet, | ||||
configObj, | configObj, | ||||
} = createTokenMock; | } = createTokenMock; | ||||
BCH.RawTransactions.sendRawTransaction = jest | BCH.RawTransactions.sendRawTransaction = jest | ||||
.fn() | .fn() | ||||
.mockResolvedValue(expectedTxId); | .mockResolvedValue(expectedTxId); | ||||
expect( | expect(await createToken(BCH, wallet, 5.01, configObj)).toBe( | ||||
await createToken(BCH, wallet, currency.defaultFee, configObj), | `${currency.tokenExplorerUrl}/tx/${expectedTxId}`, | ||||
).toBe(`${currency.tokenExplorerUrl}/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(); | ||||
const BCH = new BCHJS(); | const BCH = new BCHJS(); | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |