-
Notifications
You must be signed in to change notification settings - Fork 4
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
[DT-1081] Fix filter bugs #2754
Conversation
const filterHandlerStub = cy.stub(); | ||
const props = { datasets, filters: { ...defaultFilters(datasets), participantCountMin: 2, participantCountMax: 5 }, filterHandler: filterHandlerStub, isFiltered: () => {}}; | ||
mount(<DatasetFilterList {...props} />); | ||
cy.get('#participantCountMax-range-input').type('3').trigger('change'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chaining calls after type
is unsafe. A lot of our tests suffer from this pattern, so it is something we should be trying to clean up.
@@ -303,7 +293,7 @@ export const DatasetSearchTable = (props) => { | |||
</Box> | |||
<Box sx={{display: 'flex', flexDirection: 'row', paddingTop: '2em'}}> | |||
<Box sx={{width: '14%', padding: '0 1em'}}> | |||
<DatasetFilterList datasets={datasets} filterHandler={filterHandler} isFiltered={isFilteredArray} onClear={() => setFilters(defaultFilters)}/> | |||
<DatasetFilterList datasets={datasets} filterHandler={filterHandler} filters={filters} isFiltered={isFilteredArray} onClear={() => setFilters(defaultFilters(datasets))}/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something about this is breaking the dataset_search_table.spec.js
tests, but it's not exactly clear what. I think the tests might be a little brittle as well in that they're expecting a populated response.response.body[0]
object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I see it. The search filter text is slightly different in this PR which breaks the test. Changing line 68 in dataset_search_table.spec.js
to:
return handler(req, '{"range":{"participantCount":{"gte":100,"lte":"50"}}}');
and line 91 to
return handler(req, '{"range":{"participantCount":{"gte":100,"lte":100}}}');
allows the string matching in the handler function to work correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, addresses bugs in ticket. Once tests are passing, 👍🏽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, thank you 👍
Addresses
Summary
Have you read Terra's Contributing Guide lately? If not, do that first.