From 3fb25d1ee04b5cb2b70c4e92baaaed1b8056d4e3 Mon Sep 17 00:00:00 2001 From: georgewrmarshall Date: Tue, 10 Oct 2023 22:42:25 +0200 Subject: [PATCH] Updating tests for new-network-info component --- .../ui/new-network-info/new-network-info.js | 7 ++++++- .../ui/new-network-info/new-network-info.test.js | 16 ++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ui/components/ui/new-network-info/new-network-info.js b/ui/components/ui/new-network-info/new-network-info.js index 7b512fcc28e9..8094e98d8270 100644 --- a/ui/components/ui/new-network-info/new-network-info.js +++ b/ui/components/ui/new-network-info/new-network-info.js @@ -76,7 +76,12 @@ export default function NewNetworkInfo() { return ( !isLoading && showPopup && ( - + { ); // wait for the fetch to finish await waitFor(() => { - expect(getByTestId('new-network-info-wrapper')).toBeInTheDocument(); + expect(getByTestId('new-network-info')).toBeInTheDocument(); }); // render title expect(getByText('You have switched to')).toBeInTheDocument(); @@ -116,7 +116,7 @@ describe('NewNetworkInfo', () => { expect( getByTestId('new-network-info-bullet-paragraph').textContent, ).toMatchInlineSnapshot( - `"• The native token on this network is ETH. It is the token used for gas fees. "`, + `" The native token on this network is ETH. It is the token used for gas fees. If you attempt to send assets directly from one network to another, this may result in permanent asset loss. Make sure to use a bridge. Learn moreYour tokens may not automatically show up in your wallet. Click here to manually add the tokens."`, ); }); @@ -142,7 +142,7 @@ describe('NewNetworkInfo', () => { ); // wait for the fetch to finish await waitFor(() => { - expect(getByTestId('new-network-info-wrapper')).toBeInTheDocument(); + expect(getByTestId('new-network-info')).toBeInTheDocument(); }); const questionMark = container.querySelector('.question'); @@ -165,7 +165,7 @@ describe('NewNetworkInfo', () => { // wait for the fetch to finish await new Promise((r) => setTimeout(r, 2000)); await waitFor(() => { - expect(getByTestId('new-network-info-wrapper')).toBeInTheDocument(); + expect(getByTestId('new-network-info')).toBeInTheDocument(); }); const firstBox = container.querySelector( 'new-network-info__content-box-1', @@ -200,7 +200,7 @@ describe('NewNetworkInfo', () => { ); // should not render add token link await waitFor(() => { - expect(getByTestId('new-network-info-wrapper')).toBeInTheDocument(); + expect(getByTestId('new-network-info')).toBeInTheDocument(); }); expect(queryByTestId('new-network-info-add-token-manually')).toBeNull(); }); @@ -214,7 +214,7 @@ describe('NewNetworkInfo', () => { const { getByTestId } = renderWithProvider(, store); // render add token link when token is supported await waitFor(() => { - expect(getByTestId('new-network-info-wrapper')).toBeInTheDocument(); + expect(getByTestId('new-network-info')).toBeInTheDocument(); }); }); @@ -227,7 +227,7 @@ describe('NewNetworkInfo', () => { const { getByTestId } = renderWithProvider(, store); // render add token link when token is supported await waitFor(() => { - expect(getByTestId('new-network-info-wrapper')).toBeInTheDocument(); + expect(getByTestId('new-network-info')).toBeInTheDocument(); }); expect( getByTestId('new-network-info-add-token-manually'), @@ -254,7 +254,7 @@ describe('NewNetworkInfo', () => { ); // wait for the fetch to finish await waitFor(() => { - expect(getByTestId('new-network-info-wrapper')).toBeInTheDocument(); + expect(getByTestId('new-network-info')).toBeInTheDocument(); }); // render add token link when token is supported expect(