Skip to content

Commit

Permalink
test: updated test files with new data test id
Browse files Browse the repository at this point in the history
  • Loading branch information
usman-deriv committed Aug 1, 2024
1 parent d2fb2f6 commit 4531802
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('FullPageMobileWrapper', () => {
expect(screen.getByText('Body')).toBeVisible();
expect(screen.queryByText('Footer')).not.toBeInTheDocument();

const backBtn = screen.getByTestId('dt_mobile_wrapper_button');
const backBtn = screen.getByTestId('dt_mobile_wrapper_back_button');
await userEvent.click(backBtn);
expect(spyOnBack).toBeCalled();
});
Expand All @@ -47,7 +47,7 @@ describe('FullPageMobileWrapper', () => {
expect(screen.queryByText('Header')).not.toBeInTheDocument();
expect(screen.getByText('Body')).toBeVisible();
expect(screen.queryByText('Footer')).toBeVisible();
expect(screen.queryByTestId('dt_mobile_wrapper_button')).not.toBeInTheDocument();
expect(screen.queryByTestId('dt_mobile_wrapper_back_button')).not.toBeInTheDocument();
});
it('should hide the left arrow icon', () => {
render(
Expand All @@ -56,6 +56,6 @@ describe('FullPageMobileWrapper', () => {
</FullPageMobileWrapper>
);

expect(screen.queryByTestId('dt_mobile_wrapper_button')).not.toBeInTheDocument();
expect(screen.queryByTestId('dt_mobile_wrapper_back_button')).not.toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ describe('<FilterModal />', () => {

render(<FilterModal {...mockProps} />);

const backButton = screen.getByTestId('dt_mobile_wrapper_button');
const backButton = screen.getByTestId('dt_mobile_wrapper_back_button');
await user.click(backButton);

expect(mockProps.onRequestClose).toHaveBeenCalled();
Expand All @@ -318,7 +318,7 @@ describe('<FilterModal />', () => {
const paymentMethodsText = screen.getByText('Payment methods');
await user.click(paymentMethodsText);

const backButton = screen.getAllByTestId('dt_mobile_wrapper_button')[0];
const backButton = screen.getAllByTestId('dt_mobile_wrapper_back_button')[0];
await user.click(backButton);

expect(screen.getByText('Filter')).toBeInTheDocument();
Expand All @@ -331,7 +331,7 @@ describe('<FilterModal />', () => {
const toggleSwitch = screen.getByRole('checkbox');
await user.click(toggleSwitch);

const closeIcon = screen.getByTestId('dt_mobile_wrapper_button');
const closeIcon = screen.getByTestId('dt_mobile_wrapper_back_button');
await user.click(closeIcon);

expect(mockModalManager.showModal).toHaveBeenCalledWith('LeaveFilterModal');
Expand All @@ -345,7 +345,7 @@ describe('<FilterModal />', () => {
const toggleSwitch = screen.getByRole('checkbox');
await user.click(toggleSwitch);

const closeIcon = screen.getByTestId('dt_mobile_wrapper_button');
const closeIcon = screen.getByTestId('dt_mobile_wrapper_back_button');
await user.click(closeIcon);

const cancelButton = screen.getByRole('button', { name: 'Cancel' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('<CurrencyDropdown />', () => {

expect(screen.getByText('Preferred currency')).toBeInTheDocument();

const arrowIcon = screen.getByTestId('dt_mobile_wrapper_button');
const arrowIcon = screen.getByTestId('dt_mobile_wrapper_back_button');
await user.click(arrowIcon);

expect(screen.queryByText('Preferred currency')).not.toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('MyProfileBalance', () => {
expect(contactTextBoxNode).toBeInTheDocument();
expect(descriptionTextBoxNode).toBeInTheDocument();

const goBackBtn = screen.getByTestId('dt_mobile_wrapper_button');
const goBackBtn = screen.getByTestId('dt_mobile_wrapper_back_button');
await user.click(goBackBtn);
expect(mockSetQueryString).toHaveBeenCalledWith({
tab: 'default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('MyProfileCounterparties', () => {
it('should call setQueryString if back button is clicked', async () => {
render(<MyProfileCounterparties />);

const backButton = screen.getByTestId('dt_mobile_wrapper_button');
const backButton = screen.getByTestId('dt_mobile_wrapper_back_button');
await userEvent.click(backButton);

expect(mockSetQueryString).toHaveBeenCalledWith({ tab: 'default' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('MyProfileStatsMobile', () => {
render(<MyProfileStatsMobile />);
expect(screen.getByText('MyProfileStats')).toBeInTheDocument();
expect(screen.getByText('Stats')).toBeInTheDocument();
const goBackBtn = screen.getByTestId('dt_mobile_wrapper_button');
const goBackBtn = screen.getByTestId('dt_mobile_wrapper_back_button');
await userEvent.click(goBackBtn);
expect(mockSetQueryString).toBeCalledWith({
tab: 'default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('PaymentMethodsEmpty', () => {
expect(screen.getByText('You haven’t added any payment methods yet')).toBeInTheDocument();
expect(screen.getByText('Hit the button below to add payment methods.')).toBeInTheDocument();
expect(screen.getByText('Add payment methods')).toBeInTheDocument();
expect(screen.queryByTestId('dt_mobile_wrapper_button')).not.toBeInTheDocument();
expect(screen.queryByTestId('dt_mobile_wrapper_back_button')).not.toBeInTheDocument();
});
it('should render the correct content when isMobile is true', () => {
(mockUseDevice as jest.Mock).mockReturnValueOnce({
Expand All @@ -71,7 +71,7 @@ describe('PaymentMethodsEmpty', () => {
expect(screen.getByText('You haven’t added any payment methods yet')).toBeInTheDocument();
expect(screen.getByText('Hit the button below to add payment methods.')).toBeInTheDocument();
expect(screen.getByText('Add payment methods')).toBeInTheDocument();
expect(screen.getByTestId('dt_mobile_wrapper_button')).toBeInTheDocument();
expect(screen.getByTestId('dt_mobile_wrapper_back_button')).toBeInTheDocument();
});
it('should call setQueryString when isMobile is true', async () => {
const { setQueryString: mockSetQueryString } = mockUseQueryString();
Expand All @@ -83,7 +83,7 @@ describe('PaymentMethodsEmpty', () => {
});
const onAddPaymentMethod = jest.fn();
render(<PaymentMethodsEmpty onAddPaymentMethod={onAddPaymentMethod} />);
const back = screen.getByTestId('dt_mobile_wrapper_button');
const back = screen.getByTestId('dt_mobile_wrapper_back_button');
await userEvent.click(back);
expect(mockSetQueryString).toHaveBeenCalledWith({ tab: 'default' });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ describe('PaymentMethodsList', () => {
p2pAdvertiserPaymentMethods={[]}
/>
);
const backButton = screen.getByTestId('dt_mobile_wrapper_button');
const backButton = screen.getByTestId('dt_mobile_wrapper_back_button');
await userEvent.click(backButton);
expect(mockSetQueryString).toHaveBeenCalledWith({ tab: 'default' });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe('<OrderDetails />', () => {

render(<OrderDetails />);

const backButton = screen.getByTestId('dt_mobile_wrapper_button');
const backButton = screen.getByTestId('dt_mobile_wrapper_back_button');
await userEvent.click(backButton);

expect(mockGoBack).toHaveBeenCalled();
Expand Down

0 comments on commit 4531802

Please sign in to comment.