Changeset View
Changeset View
Standalone View
Standalone View
cashtab/src/components/Send/__tests__/SendByUrlParams.test.js
| Show First 20 Lines • Show All 846 Lines • ▼ Show 20 Lines | it('bip21 - ALP token send with firma param', async () => { | ||||
| await waitFor(() => | await waitFor(() => | ||||
| expect( | expect( | ||||
| screen.queryByTitle('Cashtab Loading'), | screen.queryByTitle('Cashtab Loading'), | ||||
| ).not.toBeInTheDocument(), | ).not.toBeInTheDocument(), | ||||
| ); | ); | ||||
| // BIP21 with token_id switches to token mode automatically | // BIP21 with token_id switches to token mode automatically | ||||
| // Wait for token mode UI and parsed tx to appear | // Wait for token mode UI and parsed tx to appear | ||||
| const { tokenName, tokenTicker } = FIRMA.token.genesisInfo; | |||||
| const addressPreview = `${destinationAddress.slice( | const addressPreview = `${destinationAddress.slice( | ||||
| 0, | 0, | ||||
| 'ecash:'.length + 3, | 'ecash:'.length + 3, | ||||
| )}...${destinationAddress.slice(-3)}`; | )}...${destinationAddress.slice(-3)}`; | ||||
| await waitFor( | await waitFor( | ||||
| () => | () => | ||||
| expect( | expect( | ||||
| screen.getByText( | screen.getByText( | ||||
| `Sending ${token_decimalized_qty} ${tokenName} (${tokenTicker}) to ${addressPreview}`, | `Sending ${token_decimalized_qty} Firma Alpha (FIRMA ALPHA) to ${addressPreview}`, | ||||
| ), | ), | ||||
| ).toBeInTheDocument(), | ).toBeInTheDocument(), | ||||
| { timeout: 5000 }, | { timeout: 5000 }, | ||||
| ); | ); | ||||
| // Get the token address input (in token mode) | // Get the token address input (in token mode) | ||||
| const addressInputEl = screen.getByPlaceholderText('Address'); | const addressInputEl = screen.getByPlaceholderText('Address'); | ||||
| ▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | it('bip21 - valid FIRMA-USDC redeem tx', async () => { | ||||
| screen.queryByTitle('Cashtab Loading'), | screen.queryByTitle('Cashtab Loading'), | ||||
| ).not.toBeInTheDocument(), | ).not.toBeInTheDocument(), | ||||
| ); | ); | ||||
| // BIP21 with token_id switches to token mode automatically | // BIP21 with token_id switches to token mode automatically | ||||
| // Wait for firma redeem tx UI to appear | // Wait for firma redeem tx UI to appear | ||||
| await waitFor( | await waitFor( | ||||
| () => { | () => { | ||||
| expect(screen.getByAltText('Firma reward')).toBeInTheDocument(); | expect( | ||||
| screen.getByAltText('Firma Alpha reward'), | |||||
| ).toBeInTheDocument(); | |||||
| expect(screen.getByAltText('USDC logo')).toBeInTheDocument(); | expect(screen.getByAltText('USDC logo')).toBeInTheDocument(); | ||||
| }, | }, | ||||
| { timeout: 5000 }, | { timeout: 5000 }, | ||||
| ); | ); | ||||
| // Get the token address input (in token mode) | // Get the token address input (in token mode) | ||||
| const addressInputEl = screen.getByPlaceholderText('Address'); | const addressInputEl = screen.getByPlaceholderText('Address'); | ||||
| Show All 10 Lines | it('bip21 - valid FIRMA-USDC redeem tx', async () => { | ||||
| expect(amountInputEl).toBeDisabled(); | expect(amountInputEl).toBeDisabled(); | ||||
| // We do not see a token ID query error | // We do not see a token ID query error | ||||
| expect( | expect( | ||||
| screen.queryByText(`Error querying token info for ${token_id}`), | screen.queryByText(`Error querying token info for ${token_id}`), | ||||
| ).not.toBeInTheDocument(); | ).not.toBeInTheDocument(); | ||||
| // We see the valid firma redeem tx info (full redeem qty as USDC) | // We see the valid firma redeem tx info (full redeem qty as USDC) | ||||
| expect(screen.getByAltText('Firma reward')).toBeInTheDocument(); | expect(screen.getByAltText('Firma Alpha reward')).toBeInTheDocument(); | ||||
| expect(screen.getByAltText('USDC logo')).toBeInTheDocument(); | expect(screen.getByAltText('USDC logo')).toBeInTheDocument(); | ||||
| // The text is split across multiple elements, so we check for parts of it | // The text is split across multiple elements, so we check for parts of it | ||||
| expect(screen.getByText(/On tx finalized/)).toBeInTheDocument(); | expect(screen.getByText(/On tx finalized/)).toBeInTheDocument(); | ||||
| expect(screen.getByText(/5\.0000/)).toBeInTheDocument(); | expect(screen.getByText(/5\.0000/)).toBeInTheDocument(); | ||||
| expect(screen.getByText(/USDC will be sent to/)).toBeInTheDocument(); | expect(screen.getByText(/USDC will be sent to/)).toBeInTheDocument(); | ||||
| // The send button is enabled as we have valid bip21 token send for a token qty supported | // The send button is enabled as we have valid bip21 token send for a token qty supported | ||||
| // by the wallet | // by the wallet | ||||
| ▲ Show 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | it('bip21 - ALP token send with empp_raw cashtab msg', async () => { | ||||
| // Wait for balance to be loaded | // Wait for balance to be loaded | ||||
| expect( | expect( | ||||
| await screen.findByTitle('Balance XEC', {}, { timeout: 10000 }), | await screen.findByTitle('Balance XEC', {}, { timeout: 10000 }), | ||||
| ).toHaveTextContent('9,970.81 XEC'); | ).toHaveTextContent('9,970.81 XEC'); | ||||
| // BIP21 with token_id switches to token mode automatically | // BIP21 with token_id switches to token mode automatically | ||||
| // Wait for token mode UI and parsed tx to appear | // Wait for token mode UI and parsed tx to appear | ||||
| const { tokenName, tokenTicker } = FIRMA.token.genesisInfo; | |||||
| const addressPreview = `${destinationAddress.slice( | const addressPreview = `${destinationAddress.slice( | ||||
| 0, | 0, | ||||
| 'ecash:'.length + 3, | 'ecash:'.length + 3, | ||||
| )}...${destinationAddress.slice(-3)}`; | )}...${destinationAddress.slice(-3)}`; | ||||
| await waitFor( | await waitFor( | ||||
| () => | () => | ||||
| expect( | expect( | ||||
| screen.getByText( | screen.getByText( | ||||
| `Sending ${token_decimalized_qty} ${tokenName} (${tokenTicker}) to ${addressPreview}`, | `Sending ${token_decimalized_qty} Firma Alpha (FIRMA ALPHA) to ${addressPreview}`, | ||||
| ), | ), | ||||
| ).toBeInTheDocument(), | ).toBeInTheDocument(), | ||||
| { timeout: 5000 }, | { timeout: 5000 }, | ||||
| ); | ); | ||||
| // Get the token address input (in token mode) | // Get the token address input (in token mode) | ||||
| const addressInputEl = screen.getByPlaceholderText('Address'); | const addressInputEl = screen.getByPlaceholderText('Address'); | ||||
| ▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines | |||||