Skip to content

Commit

Permalink
Updating tests for new-network-info component
Browse files Browse the repository at this point in the history
  • Loading branch information
georgewrmarshall committed Oct 10, 2023
1 parent 230d8d9 commit 3fb25d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
7 changes: 6 additions & 1 deletion ui/components/ui/new-network-info/new-network-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ export default function NewNetworkInfo() {
return (
!isLoading &&
showPopup && (
<Modal isOpen isClosedOnOutsideClick={false} className="new-network-info">
<Modal
isOpen
isClosedOnOutsideClick={false}
className="new-network-inf-modal"
data-testid="new-network-info"
>
<ModalOverlay />
<ModalContent
modalDialogProps={{
Expand Down
16 changes: 8 additions & 8 deletions ui/components/ui/new-network-info/new-network-info.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,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 title
expect(getByText('You have switched to')).toBeInTheDocument();
Expand All @@ -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."`,
);
});

Expand All @@ -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');
Expand All @@ -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',
Expand Down Expand Up @@ -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();
});
Expand All @@ -214,7 +214,7 @@ describe('NewNetworkInfo', () => {
const { getByTestId } = renderWithProvider(<NewNetworkInfo />, store);
// render add token link when token is supported
await waitFor(() => {
expect(getByTestId('new-network-info-wrapper')).toBeInTheDocument();
expect(getByTestId('new-network-info')).toBeInTheDocument();
});
});

Expand All @@ -227,7 +227,7 @@ describe('NewNetworkInfo', () => {
const { getByTestId } = renderWithProvider(<NewNetworkInfo />, 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'),
Expand All @@ -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(
Expand Down

0 comments on commit 3fb25d1

Please sign in to comment.