Skip to content

Added homepage unit test#19

Open
sarvesh2910 wants to merge 1 commit intomainfrom
sarvesh/unitTest
Open

Added homepage unit test#19
sarvesh2910 wants to merge 1 commit intomainfrom
sarvesh/unitTest

Conversation

@sarvesh2910
Copy link
Copy Markdown
Owner

Test whether

  1. title is rendered
  2. all page interactions work correctly

Comment thread frontend/src/App.test.js
render(<App />);
const question = screen.getByText('Enter number of people involved in the transaction?')
expect(question).toBeInTheDocument();
const inputBox = screen.getByRole('spinbutton',{name:'Enter number of people involved in the transaction?'})
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional- I would add a condition here to make sure the number of people selected is not negative.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I suggest the same, a test for the negative number could be added.

Copy link
Copy Markdown
Collaborator

@Supreeth10 Supreeth10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment, other than that it looks good to me.

Comment thread frontend/src/App.test.js
render(<App />);
const question = screen.getByText('Enter number of people involved in the transaction?')
expect(question).toBeInTheDocument();
const inputBox = screen.getByRole('spinbutton',{name:'Enter number of people involved in the transaction?'})
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to add test for scrollbar when you enter bigger number. Apart from that everything looks good to me.

<input id='personNumber' name='personNumber' type="number" onChange={onNumberChange} />
</div>
{numberOfPeople > 0 && (
<div className="row">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Looks good to me

Copy link
Copy Markdown
Collaborator

@Pranav-PSU Pranav-PSU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Suggestion: A test for the negative number could be added in App.test.js
    -everything else looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants