Skip to content

Commit

Permalink
Fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
akmal-deriv committed Sep 27, 2022
1 parent f0b74d7 commit 74dd2fb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ describe('<SentEmailModal/>', () => {
jest.clearAllMocks();
});

it('should render SentEmailModal component to change dmt5 password', () => {
it('should render SentEmailModal component to change deriv mt5 password', () => {
render(<SentEmailModal identifier_title='mt5' is_open onClose={onClose} onClickSendEmail={onClickSendEmail} />);

expect(
screen.getByText(/please click on the link in the email to change your dmt5 password./i)
screen.getByText(/please click on the link in the email to change your deriv mt5 password./i)
).toBeInTheDocument();
});

Expand Down Expand Up @@ -105,7 +105,7 @@ describe('<SentEmailModal/>', () => {
);

expect(
screen.queryByText(/please click on the link in the email to change your dmt5 password./i)
screen.queryByText(/please click on the link in the email to change your deriv mt5 password./i)
).not.toBeInTheDocument();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ describe('ChangePasswordConfirmation', () => {
render(<ChangePasswordConfirmation {...mock_props} />);

expect(screen.getByText(/Confirm to change your Deriv MT5 password/i)).toBeInTheDocument();
expect(screen.getByText(/This will change the password to all of your DMT5 accounts/i)).toBeInTheDocument();
expect(
screen.getByText(/This will change the password to all of your Deriv MT5 accounts/i)
).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ describe('<CFDPasswordManagerModal />', () => {
expect(
screen.getByText(/use this password to log in to your dmt5 accounts on the desktop, web, and mobile apps/i)
).toBeInTheDocument();
expect(screen.getByRole('button', { name: /change dmt5 password/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /change deriv mt5 password/i })).toBeInTheDocument();
});

it('should render CFDPasswordManagerModal if change dmt5 password button is clicked', () => {
it('should render CFDPasswordManagerModal if change deriv mt5 password button is clicked', () => {
renderwithRouter(<CFDPasswordManagerModal {...mock_props} />);
fireEvent.click(screen.getByRole('button', { name: /change dmt5 password/i }));
fireEvent.click(screen.getByRole('button', { name: /change deriv mt5 password/i }));
expect(screen.getByText(/confirm to change your dmt5 password/i)).toBeInTheDocument();
expect(screen.getByText(/this will change the password to all of your dmt5 accounts/i)).toBeInTheDocument();
expect(screen.getByRole('button', { name: /cancel/i })).toBeInTheDocument();
Expand All @@ -124,11 +124,11 @@ describe('<CFDPasswordManagerModal />', () => {

it('should render SentEmailModal if confirm button is clicked', async () => {
renderwithRouter(<CFDPasswordManagerModal {...mock_props} />);
fireEvent.click(screen.getByRole('button', { name: /change dmt5 password/i }));
fireEvent.click(screen.getByRole('button', { name: /change deriv mt5 password/i }));
fireEvent.click(screen.getByRole('button', { name: /confirm/i }));
expect(await screen.findByText(/we've sent you an email/i)).toBeInTheDocument();
expect(
await screen.findByText(/please click on the link in the email to change your dmt5 password./i)
await screen.findByText(/please click on the link in the email to change your deriv mt5 password./i)
).toBeInTheDocument();

expect(await screen.findByText(/didn't receive the email?/i)).toBeInTheDocument();
Expand Down Expand Up @@ -314,6 +314,6 @@ describe('<CFDPasswordManagerModal />', () => {
expect(screen.getByText(/investor password/i)).toBeInTheDocument();
fireEvent.click(screen.getByText(/investor password/i));

expect(await screen.findByText(/manage dmt5 real derived account password/i)).toBeInTheDocument();
expect(await screen.findByText(/manage deriv mt5 real derived account password/i)).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe('<CFDPasswordModal/>', () => {
const ele_password_field = await screen.findByTestId('dt_mt5_password');
fireEvent.change(ele_password_field, { target: { value: user_input } });

expect(await screen.findByText(/enter your dmt5 password to add a dmt5 account/i)).toBeInTheDocument();
expect(await screen.findByText(/enter your deriv mt5 password to add a dmt5 account/i)).toBeInTheDocument();
expect(await screen.findByRole('button', { name: /add account/i })).toBeInTheDocument();

await waitFor(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ describe('TradingPasswordManager', () => {
fireEvent.click(screen.getByRole('button', { name: /Change Deriv MT5 password/i }));
expect(screen.getByText(/IcMt5OnePassword/i)).toBeInTheDocument();
expect(screen.getByText(/Confirm to change your Deriv MT5 password/i)).toBeInTheDocument();
expect(screen.getByText(/This will change the password to all of your DMT5 accounts/i)).toBeInTheDocument();
expect(
screen.getByText(/This will change the password to all of your Deriv MT5 accounts/i)
).toBeInTheDocument();
expect(screen.getByRole('button', { name: /Cancel/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /Confirm/i })).toBeInTheDocument();
});
Expand Down

0 comments on commit 74dd2fb

Please sign in to comment.