Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New] Added test cases for record list add record menu #332

Conversation

Srinivas9933
Copy link
Contributor

Added test cases for record list add record menu component

  • add-record-menu.spec.js

@jtoliver-quoin jtoliver-quoin force-pushed the develop_react_upgrade branch 2 times, most recently from 0211087 to a407855 Compare November 1, 2023 15:49
@dhernandez-quoin dhernandez-quoin changed the base branch from develop_react_upgrade to main February 12, 2024 15:08
@dhernandez-quoin dhernandez-quoin changed the base branch from main to develop_react_upgrade February 12, 2024 15:09
@dhernandez-quoin dhernandez-quoin self-assigned this Feb 20, 2024

});

it("opens a <CreateRecordDialog /> if module allow_searchable_ids", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to test if the CreateRecordDialog is open.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

done();
});

it("renders record view modal", done => {
expect(component.find(ViewModal)).to.have.lengthOf(1);
mountedComponent(<RecordList />,initialState, ["/cases"])
expect(screen.getAllByText('messages.record_list.rows_per_page')).toHaveLength(2)
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to test if the ViewModal was rendered.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


expect(component.find(ViewModal).props().openViewModal).to.be.true;
mountedComponent(<RecordList />,initialState, ["/cases"])
expect(screen.getAllByText('messages.record_list.rows_per_page')).toHaveLength(2)
Copy link
Contributor

Choose a reason for hiding this comment

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

This no longer performs a click and doesn't seem to test if the ViewModal was opened.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


expect(component.find(ViewModal).props().openViewModal).to.be.false;
mountedComponent(<RecordList />,initialState.setIn(["application", "online"], false), ["/cases"])
expect(screen.getByTestId('filters')).toBeInTheDocument()
Copy link
Contributor

Choose a reason for hiding this comment

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

This test is supposed to check that the view modal was not opened, but this code checks for filters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

});
});

describe("when age is 0", () => {
it("renders a 0 in the cell ", () => {
expect(component.find(TableRow).at(1).find(TableCell).at(2).find(ConditionalWrapper).text()).to.equal("0");
mountedComponent(<RecordList />,initialState.setIn(["application", "online"], false), ["/cases"])
expect(screen.getAllByText('0-0 messages.record_list.of 0')).toHaveLength(2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why this is checking the pagination.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To check if the rows are empty

@Srinivas9933 Srinivas9933 force-pushed the trigyn-testcases-record-list branch from c03a72a to 8529c5a Compare April 11, 2024 05:45
@Srinivas9933 Srinivas9933 force-pushed the trigyn-testcases-record-list branch from 8529c5a to ea5a6ff Compare April 18, 2024 07:29
@dhernandez-quoin dhernandez-quoin merged commit 386ad20 into primeroIMS:develop_react_upgrade May 24, 2024
8 checks passed
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.

2 participants