Changeset View
Changeset View
Standalone View
Standalone View
cashtab/src/components/Airdrop/__tests__/Airdrop.test.js
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | it('We can send a pro-rata airdrop and equal tx to a tokenId not in our cache using custom settings', async () => { | ||||
expect( | expect( | ||||
screen.getByPlaceholderText('Please input parameters above.'), | screen.getByPlaceholderText('Please input parameters above.'), | ||||
).toHaveValue( | ).toHaveValue( | ||||
`ecash:qzj5zu6fgg8v2we82gh76xnrk9njcreglum9ffspnr, 150\necash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035, 50\necash:qr204yfphngxthvnukyrz45u7500tf60vyqspva5a6, 150\necash:qrq64hyel9hulnl9vsk29xjnuuqlpwqpcv6mk9pqly, 50\necash:qzn3gqf7vvm2qdu2rac6m6r4kgfcsyaras7jfqja3m, 200\necash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 4400`, | `ecash:qzj5zu6fgg8v2we82gh76xnrk9njcreglum9ffspnr, 150\necash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035, 50\necash:qr204yfphngxthvnukyrz45u7500tf60vyqspva5a6, 150\necash:qrq64hyel9hulnl9vsk29xjnuuqlpwqpcv6mk9pqly, 50\necash:qzn3gqf7vvm2qdu2rac6m6r4kgfcsyaras7jfqja3m, 200\necash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 4400`, | ||||
); | ); | ||||
// We can ignore the mint address | // We can ignore the mint address | ||||
const ignoreMintAddressSwitch = screen.getByTestId( | await user.click(screen.getByTestId('ignore-mint-address')); | ||||
'ignore-mint-address', | |||||
); | |||||
expect(ignoreMintAddressSwitch).toHaveAttribute( | |||||
'aria-checked', | |||||
'false', | |||||
); | |||||
await user.click(ignoreMintAddressSwitch); | |||||
expect(ignoreMintAddressSwitch).toHaveAttribute('aria-checked', 'true'); | |||||
await user.click( | await user.click( | ||||
screen.getByRole('button', { name: /Calculate Airdrop/ }), | screen.getByRole('button', { name: /Calculate Airdrop/ }), | ||||
); | ); | ||||
// The mint address for this token was not eligible anyway | // The mint address for this token was not eligible anyway | ||||
expect( | expect( | ||||
screen.getByPlaceholderText('Please input parameters above.'), | screen.getByPlaceholderText('Please input parameters above.'), | ||||
).toHaveValue( | ).toHaveValue( | ||||
`ecash:qzj5zu6fgg8v2we82gh76xnrk9njcreglum9ffspnr, 150\necash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035, 50\necash:qr204yfphngxthvnukyrz45u7500tf60vyqspva5a6, 150\necash:qrq64hyel9hulnl9vsk29xjnuuqlpwqpcv6mk9pqly, 50\necash:qzn3gqf7vvm2qdu2rac6m6r4kgfcsyaras7jfqja3m, 200\necash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 4400`, | `ecash:qzj5zu6fgg8v2we82gh76xnrk9njcreglum9ffspnr, 150\necash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035, 50\necash:qr204yfphngxthvnukyrz45u7500tf60vyqspva5a6, 150\necash:qrq64hyel9hulnl9vsk29xjnuuqlpwqpcv6mk9pqly, 50\necash:qzn3gqf7vvm2qdu2rac6m6r4kgfcsyaras7jfqja3m, 200\necash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 4400`, | ||||
); | ); | ||||
// We can ignore other addresses | // We can ignore other addresses | ||||
const ignoreCustomAddressesSwitch = screen.getByTestId( | await user.click(screen.getByTestId('ignore-custom-addresses')); | ||||
'ignore-custom-addresses', | |||||
); | |||||
expect(ignoreCustomAddressesSwitch).toHaveAttribute( | |||||
'aria-checked', | |||||
'false', | |||||
); | |||||
await user.click(ignoreCustomAddressesSwitch); | |||||
expect(ignoreCustomAddressesSwitch).toHaveAttribute( | |||||
'aria-checked', | |||||
'true', | |||||
); | |||||
await user.type( | await user.type( | ||||
await screen.findByPlaceholderText(/If more than one XEC address/), | await screen.findByPlaceholderText(/If more than one XEC address/), | ||||
'ecash:qzj5zu6fgg8v2we82gh76xnrk9njcreglum9ffspnr, ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj', | 'ecash:qzj5zu6fgg8v2we82gh76xnrk9njcreglum9ffspnr,ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj', | ||||
); | ); | ||||
await user.click( | await user.click( | ||||
screen.getByRole('button', { name: /Calculate Airdrop/ }), | screen.getByRole('button', { name: /Calculate Airdrop/ }), | ||||
); | ); | ||||
// Now these addresses are not in the airdrop, and the other amounts are proportionally adjusted | // Now these addresses are not in the airdrop, and the other amounts are proportionally adjusted | ||||
expect( | expect( | ||||
screen.getByPlaceholderText('Please input parameters above.'), | screen.getByPlaceholderText('Please input parameters above.'), | ||||
).toHaveValue( | ).toHaveValue( | ||||
`ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035, 555.55\necash:qr204yfphngxthvnukyrz45u7500tf60vyqspva5a6, 1666.66\necash:qrq64hyel9hulnl9vsk29xjnuuqlpwqpcv6mk9pqly, 555.55\necash:qzn3gqf7vvm2qdu2rac6m6r4kgfcsyaras7jfqja3m, 2222.22`, | `ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035, 555.55\necash:qr204yfphngxthvnukyrz45u7500tf60vyqspva5a6, 1666.66\necash:qrq64hyel9hulnl9vsk29xjnuuqlpwqpcv6mk9pqly, 555.55\necash:qzn3gqf7vvm2qdu2rac6m6r4kgfcsyaras7jfqja3m, 2222.22`, | ||||
); | ); | ||||
// We can airdrop people with less of a token the same amount of XEC as other users in case we happen to think in this way | // We can airdrop people with less of a token the same amount of XEC as other users in case we happen to think in this way | ||||
// We can ignore other addresses | // We can ignore other addresses | ||||
const communistSwitch = screen.getByTestId('communist-airdrop'); | await user.click(screen.getByTestId('communist-airdrop')); | ||||
expect(communistSwitch).toHaveAttribute('aria-checked', 'false'); | |||||
await user.click(communistSwitch); | |||||
expect(communistSwitch).toHaveAttribute('aria-checked', 'true'); | |||||
await user.click( | await user.click( | ||||
screen.getByRole('button', { name: /Calculate Airdrop/ }), | screen.getByRole('button', { name: /Calculate Airdrop/ }), | ||||
); | ); | ||||
// Now these addresses are not in the airdrop, and the other amounts are proportionally adjusted | // Now these addresses are not in the airdrop, and the other amounts are proportionally adjusted | ||||
expect( | expect( | ||||
screen.getByPlaceholderText('Please input parameters above.'), | screen.getByPlaceholderText('Please input parameters above.'), | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | it('We can ignore addresses with less than a token balance for a token with decimals', async () => { | ||||
expect( | expect( | ||||
screen.getByPlaceholderText('Please input parameters above.'), | screen.getByPlaceholderText('Please input parameters above.'), | ||||
).toHaveValue( | ).toHaveValue( | ||||
`ecash:qp6qkpeg5xmpcqtu6uc5qkhzexg4sq009sfeekcfk2, 499894.34\necash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 94.15\necash:qp89xgjhcqdnzzemts0aj378nfe2mhu9yvxj9nhgg6, 11.49`, | `ecash:qp6qkpeg5xmpcqtu6uc5qkhzexg4sq009sfeekcfk2, 499894.34\necash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 94.15\necash:qp89xgjhcqdnzzemts0aj378nfe2mhu9yvxj9nhgg6, 11.49`, | ||||
); | ); | ||||
// We can ignore the mint address | // We can ignore the mint address | ||||
const ignoreMintAddressSwitch = screen.getByTestId( | await user.click(screen.getByTestId('ignore-mint-address')); | ||||
'ignore-mint-address', | |||||
); | |||||
expect(ignoreMintAddressSwitch).toHaveAttribute( | |||||
'aria-checked', | |||||
'false', | |||||
); | |||||
await user.click(ignoreMintAddressSwitch); | |||||
expect(ignoreMintAddressSwitch).toHaveAttribute('aria-checked', 'true'); | |||||
await user.click( | await user.click( | ||||
screen.getByRole('button', { name: /Calculate Airdrop/ }), | screen.getByRole('button', { name: /Calculate Airdrop/ }), | ||||
); | ); | ||||
// The mint address for this token was not eligible anyway | // The mint address for this token was not eligible anyway | ||||
expect( | expect( | ||||
screen.getByPlaceholderText('Please input parameters above.'), | screen.getByPlaceholderText('Please input parameters above.'), | ||||
).toHaveValue( | ).toHaveValue( | ||||
`ecash:qp6qkpeg5xmpcqtu6uc5qkhzexg4sq009sfeekcfk2, 499894.34\necash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 94.15\necash:qp89xgjhcqdnzzemts0aj378nfe2mhu9yvxj9nhgg6, 11.49`, | `ecash:qp6qkpeg5xmpcqtu6uc5qkhzexg4sq009sfeekcfk2, 499894.34\necash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 94.15\necash:qp89xgjhcqdnzzemts0aj378nfe2mhu9yvxj9nhgg6, 11.49`, | ||||
); | ); | ||||
// We can ignore addresses based on having too little of the token | // We can ignore addresses based on having too little of the token | ||||
// We can ignore another address | await user.click(screen.getByTestId('minimum-etoken-holder-balance')); | ||||
const ignoreByBalanceSwitch = screen.getByTestId( | |||||
'minimum-etoken-holder-balance', | |||||
); | |||||
expect(ignoreByBalanceSwitch).toHaveAttribute('aria-checked', 'false'); | |||||
await user.click(ignoreByBalanceSwitch); | |||||
expect(ignoreByBalanceSwitch).toHaveAttribute('aria-checked', 'true'); | |||||
await user.type( | await user.type( | ||||
await screen.findByPlaceholderText(/Minimum eToken balance/), | await screen.findByPlaceholderText(/Minimum eToken balance/), | ||||
'0.25', | '0.25', | ||||
); | ); | ||||
await user.click( | await user.click( | ||||
screen.getByRole('button', { name: /Calculate Airdrop/ }), | screen.getByRole('button', { name: /Calculate Airdrop/ }), | ||||
); | ); | ||||
// We have excluded the token with a balance of 0.23 | // We have excluded the token with a balance of 0.23 | ||||
expect( | expect( | ||||
screen.getByPlaceholderText('Please input parameters above.'), | screen.getByPlaceholderText('Please input parameters above.'), | ||||
).toHaveValue( | ).toHaveValue( | ||||
`ecash:qp6qkpeg5xmpcqtu6uc5qkhzexg4sq009sfeekcfk2, 499905.84\necash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 94.15`, | `ecash:qp6qkpeg5xmpcqtu6uc5qkhzexg4sq009sfeekcfk2, 499905.84\necash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj, 94.15`, | ||||
); | ); | ||||
// We can ignore another address | // We can ignore another address | ||||
const ignoreCustomAddressesSwitch = screen.getByTestId( | await user.click(screen.getByTestId('ignore-custom-addresses')); | ||||
'ignore-custom-addresses', | |||||
); | |||||
expect(ignoreCustomAddressesSwitch).toHaveAttribute( | |||||
'aria-checked', | |||||
'false', | |||||
); | |||||
await user.click(ignoreCustomAddressesSwitch); | |||||
expect(ignoreCustomAddressesSwitch).toHaveAttribute( | |||||
'aria-checked', | |||||
'true', | |||||
); | |||||
await user.type( | await user.type( | ||||
await screen.findByPlaceholderText(/If more than one XEC address/), | await screen.findByPlaceholderText(/If more than one XEC address/), | ||||
'ecash:qp6qkpeg5xmpcqtu6uc5qkhzexg4sq009sfeekcfk2', | 'ecash:qp6qkpeg5xmpcqtu6uc5qkhzexg4sq009sfeekcfk2', | ||||
); | ); | ||||
await user.click( | await user.click( | ||||
screen.getByRole('button', { name: /Calculate Airdrop/ }), | screen.getByRole('button', { name: /Calculate Airdrop/ }), | ||||
); | ); | ||||
Show All 9 Lines |