diff --git a/cashtab/package-lock.json b/cashtab/package-lock.json --- a/cashtab/package-lock.json +++ b/cashtab/package-lock.json @@ -1,12 +1,12 @@ { "name": "cashtab", - "version": "2.34.0", + "version": "2.34.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cashtab", - "version": "2.34.0", + "version": "2.34.1", "dependencies": { "@bitgo/utxo-lib": "^9.33.0", "@zxing/browser": "^0.1.4", diff --git a/cashtab/package.json b/cashtab/package.json --- a/cashtab/package.json +++ b/cashtab/package.json @@ -1,6 +1,6 @@ { "name": "cashtab", - "version": "2.34.0", + "version": "2.34.1", "private": true, "scripts": { "start": "node scripts/start.js", diff --git a/cashtab/src/components/Etokens/__tests__/Token.test.js b/cashtab/src/components/Etokens/__tests__/Token.test.js --- a/cashtab/src/components/Etokens/__tests__/Token.test.js +++ b/cashtab/src/components/Etokens/__tests__/Token.test.js @@ -74,7 +74,7 @@ `This token only supports ${SEND_TOKEN_DECIMALS} decimal places`, ]; -describe('', () => { +describe('', () => { let user, mockedChronik; beforeEach(async () => { // Mock the app with context at the Send screen @@ -134,7 +134,13 @@ // Wait for element to get token info and load expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); - const addressInputEl = screen.getByPlaceholderText('Address'); + // Wait for Cashtab to recognize this is an SLP1 fungible token and enable Send + expect(await screen.findByTitle('Toggle Send')).toHaveProperty( + 'checked', + true, + ); + + const addressInputEl = screen.getByPlaceholderText(/Address/); const amountInputEl = screen.getByPlaceholderText('Amount'); // Input fields are rendered @@ -165,7 +171,13 @@ // Wait for element to get token info and load expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); - const addressInputEl = screen.getByPlaceholderText('Address'); + // Wait for Cashtab to recognize this is an SLP1 fungible token and enable Send + expect(await screen.findByTitle('Toggle Send')).toHaveProperty( + 'checked', + true, + ); + + const addressInputEl = screen.getByPlaceholderText(/Address/); // The user enters a valid address const addressInput = 'ecash:qp89xgjhcqdnzzemts0aj378nfe2mhu9yvxj9nhgg6'; @@ -194,7 +206,13 @@ // Wait for element to get token info and load expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); - const addressInputEl = screen.getByPlaceholderText('Address'); + // Wait for Cashtab to recognize this is an SLP1 fungible token and enable Send + expect(await screen.findByTitle('Toggle Send')).toHaveProperty( + 'checked', + true, + ); + + const addressInputEl = screen.getByPlaceholderText(/Address/); // The user enters a valid address const addressInput = @@ -224,7 +242,13 @@ // Wait for element to get token info and load expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); - const addressInputEl = screen.getByPlaceholderText('Address'); + // Wait for Cashtab to recognize this is an SLP1 fungible token and enable Send + expect(await screen.findByTitle('Toggle Send')).toHaveProperty( + 'checked', + true, + ); + + const addressInputEl = screen.getByPlaceholderText(/Address/); const alias = 'twelvechar12'; const expectedResolvedAddress = @@ -282,7 +306,13 @@ // Wait for element to get token info and load expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); - const addressInputEl = screen.getByPlaceholderText('Address'); + // Wait for Cashtab to recognize this is an SLP1 fungible token and enable Send + expect(await screen.findByTitle('Toggle Send')).toHaveProperty( + 'checked', + true, + ); + + const addressInputEl = screen.getByPlaceholderText(/Address/); // The user enters an invalid address const addressInput = 'not a valid address'; @@ -305,7 +335,13 @@ // Wait for element to get token info and load expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); - const addressInputEl = screen.getByPlaceholderText('Address'); + // Wait for Cashtab to recognize this is an SLP1 fungible token and enable Send + expect(await screen.findByTitle('Toggle Send')).toHaveProperty( + 'checked', + true, + ); + + const addressInputEl = screen.getByPlaceholderText(/Address/); // The user enters a potentially valid alias without .xec suffix const addressInput = 'chicken'; @@ -330,7 +366,13 @@ // Wait for element to get token info and load expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); - const addressInputEl = screen.getByPlaceholderText('Address'); + // Wait for Cashtab to recognize this is an SLP1 fungible token and enable Send + expect(await screen.findByTitle('Toggle Send')).toHaveProperty( + 'checked', + true, + ); + + const addressInputEl = screen.getByPlaceholderText(/Address/); const alias = 'notregistered'; @@ -375,7 +417,13 @@ // Wait for element to get token info and load expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); - const addressInputEl = screen.getByPlaceholderText('Address'); + // Wait for Cashtab to recognize this is an SLP1 fungible token and enable Send + expect(await screen.findByTitle('Toggle Send')).toHaveProperty( + 'checked', + true, + ); + + const addressInputEl = screen.getByPlaceholderText(/Address/); const alias = 'servererror'; @@ -413,7 +461,13 @@ // Wait for element to get token info and load expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); - const addressInputEl = screen.getByPlaceholderText('Address'); + // Wait for Cashtab to recognize this is an SLP1 fungible token and enable Send + expect(await screen.findByTitle('Toggle Send')).toHaveProperty( + 'checked', + true, + ); + + const addressInputEl = screen.getByPlaceholderText(/Address/); // The user enters an ivalid address const addressInput = @@ -449,8 +503,14 @@ // Wait for element to get token info and load expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); + // Wait for Cashtab to recognize this is an SLP1 fungible token and enable Send + expect(await screen.findByTitle('Toggle Send')).toHaveProperty( + 'checked', + true, + ); + // The user enters a valid address and send amount - const addressInputEl = screen.getByPlaceholderText('Address'); + const addressInputEl = screen.getByPlaceholderText(/Address/); const addressInput = 'ecash:qp89xgjhcqdnzzemts0aj378nfe2mhu9yvxj9nhgg6'; const amountInputEl = screen.getByPlaceholderText('Amount'); const amountInput = '1'; @@ -491,6 +551,12 @@ // Wait for element to get token info and load expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); + // Wait for Cashtab to recognize this is an SLP1 fungible token and enable Send + expect(await screen.findByTitle('Toggle Send')).toHaveProperty( + 'checked', + true, + ); + // The send switch is turned on by default expect(screen.getByTitle('Toggle Send')).toHaveProperty( 'checked', @@ -553,6 +619,12 @@ // Wait for element to get token info and load expect((await screen.findAllByText(/BEAR/))[0]).toBeInTheDocument(); + // Wait for Cashtab to recognize this is an SLP1 fungible token and enable Send + expect(await screen.findByTitle('Toggle Send')).toHaveProperty( + 'checked', + true, + ); + // The mint switch is not rendered expect(screen.queryByTitle('Toggle Mint')).not.toBeInTheDocument(); }); @@ -652,6 +724,12 @@ // Wait for element to get token info and load expect((await screen.findAllByText(/CACHET/))[0]).toBeInTheDocument(); + // Wait for Cashtab to recognize this is an SLP1 fungible token and enable Send + expect(await screen.findByTitle('Toggle Send')).toHaveProperty( + 'checked', + true, + ); + // The mint switch is rendered const mintSwitch = screen.getByTitle('Toggle Mint'); expect(mintSwitch).toBeInTheDocument();