Skip to content

Commit

Permalink
feat: update AssetDetailsActions.test to use IDs for buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
k-g-j committed Sep 26, 2024
1 parent 53765cb commit 19ec196
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,23 @@ describe('AssetDetailsActions', () => {
});

it('renders correctly with all buttons displayed', () => {
const { getByText } = render(<AssetDetailsActions {...defaultProps} />);
const { getByTestId, getAllByText } = render(
<AssetDetailsActions {...defaultProps} />,
);

expect(getByText(strings('asset_overview.buy_button'))).toBeTruthy();
expect(getByText(strings('asset_overview.swap'))).toBeTruthy();
expect(getByText(strings('asset_overview.bridge'))).toBeTruthy();
expect(getByText(strings('asset_overview.send_button'))).toBeTruthy();
expect(getByText(strings('asset_overview.receive_button'))).toBeTruthy();
expect(getByTestId(TOKEN_OVERVIEW_BUY_BUTTON)).toBeTruthy();
expect(getByTestId(TOKEN_OVERVIEW_SWAP_BUTTON)).toBeTruthy();
expect(getByTestId(TOKEN_OVERVIEW_BRIDGE_BUTTON)).toBeTruthy();
expect(getByTestId(TOKEN_OVERVIEW_SEND_BUTTON)).toBeTruthy();
expect(getByTestId(TOKEN_OVERVIEW_RECEIVE_BUTTON)).toBeTruthy();

expect(getAllByText(strings('asset_overview.buy_button'))).toHaveLength(2);
expect(getAllByText(strings('asset_overview.swap'))).toHaveLength(2);
expect(getAllByText(strings('asset_overview.bridge'))).toHaveLength(2);
expect(getAllByText(strings('asset_overview.send_button'))).toHaveLength(2);
expect(getAllByText(strings('asset_overview.receive_button'))).toHaveLength(
2,
);
});

it('calls onBuy when the buy button is pressed', () => {
Expand Down

0 comments on commit 19ec196

Please sign in to comment.