Changeset View
Changeset View
Standalone View
Standalone View
cashtab/src/utils/__tests__/transactions.test.js
Show First 20 Lines • Show All 377 Lines • ▼ Show 20 Lines | it('creates a token correctly', async () => { | ||||
chronik.broadcastTx = jest | chronik.broadcastTx = jest | ||||
.fn() | .fn() | ||||
.mockResolvedValue({ txid: expectedTxId }); | .mockResolvedValue({ txid: expectedTxId }); | ||||
expect(await createToken(chronik, wallet, 5.01, configObj)).toBe( | expect(await createToken(chronik, wallet, 5.01, configObj)).toBe( | ||||
`${currency.blockExplorerUrl}/tx/${expectedTxId}`, | `${currency.blockExplorerUrl}/tx/${expectedTxId}`, | ||||
); | ); | ||||
}); | }); | ||||
it('creates a token correctly using max length inputs', async () => { | |||||
const { expectedTxId, wallet } = createTokenMock; | |||||
const configObj = { | |||||
name: 'maxtokennameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', | |||||
ticker: 'dddddddddddd', | |||||
documentUrl: | |||||
'https://www.longurl.com/asdfasdfasdfddddddddddddddddddddddddddddddd', | |||||
decimals: '9', | |||||
initialQty: '10000000000', | |||||
documentHash: '', | |||||
mintBatonVout: null, | |||||
}; | |||||
const chronik = new ChronikClient( | |||||
'https://FakeChronikUrlToEnsureMocksOnly.com', | |||||
); | |||||
chronik.broadcastTx = jest | |||||
.fn() | |||||
.mockResolvedValue({ txid: expectedTxId }); | |||||
expect(await createToken(chronik, wallet, 5.01, configObj)).toBe( | |||||
`${currency.blockExplorerUrl}/tx/${expectedTxId}`, | |||||
); | |||||
}); | |||||
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 { invalidWallet, configObj } = createTokenMock; | const { invalidWallet, configObj } = createTokenMock; | ||||
const chronik = new ChronikClient( | const chronik = new ChronikClient( | ||||
'https://FakeChronikUrlToEnsureMocksOnly.com', | 'https://FakeChronikUrlToEnsureMocksOnly.com', | ||||
); | ); | ||||
const invalidWalletTokenCreation = createToken( | const invalidWalletTokenCreation = createToken( | ||||
chronik, | chronik, | ||||
invalidWallet, | invalidWallet, | ||||
Show All 26 Lines |