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

[core] Clean filtering.DataGrid.test.tsx #3768

Merged
merged 9 commits into from Feb 1, 2022

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Jan 28, 2022

Closes #3518

  • Unify all the column type tests with a getRows which allow to to cover more scenarios for each operator (they replace the forEach we had for some column types)
it('should filter with operator "="', () => {
  expect(getRows({ operatorValue: '=', value: 1974 })).to.deep.equal(['1974']);
  expect(getRows({ operatorValue: '=', value: 0 })).to.deep.equal(['', '0']);
  expect(getRows({ operatorValue: '=', value: undefined })).to.deep.equal(ALL_ROWS);
  expect(getRows({ operatorValue: '=', value: '' })).to.deep.equal(ALL_ROWS);
});
  • Always test the nullish values for operatorValue

  • Handle null value in singleSelect (they were causing crashes)

  • Remove duplicated tests (sometimes we have two times the same tests for basic use-cases, especially in the string column type.

  • Add TODO for filtering behavior that I find questionable

  • Move filter panel tests to a standalone file (only copy paste, I did not touche those tests)

@flaviendelangle flaviendelangle self-assigned this Jan 28, 2022
@mui-bot
Copy link

mui-bot commented Jan 28, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 1,227.8 1,965.3 1,287 1,523.08 330.312
Sort 100k rows ms 729.2 1,193.6 1,193.6 989.32 189.269
Select 100k rows ms 147.8 251.3 225.3 209.26 35.902
Deselect 100k rows ms 101.4 220.4 162.6 158.6 40.128

Generated by 🚫 dangerJS against 39095c1

@flaviendelangle flaviendelangle marked this pull request as draft January 28, 2022 17:05
@flaviendelangle flaviendelangle changed the title [core] Clean filtering.DataGrid.test.tsx [core] Clean filtering.DataGrid.test.tsx Jan 31, 2022
@flaviendelangle flaviendelangle added the core Infrastructure work going on behind the scenes label Jan 31, 2022
@flaviendelangle flaviendelangle marked this pull request as ready for review February 1, 2022 09:30
Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

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

That's much clearer with this two distinct file and the getRows helper :)

@flaviendelangle flaviendelangle merged commit 1512f82 into mui:master Feb 1, 2022
@flaviendelangle flaviendelangle deleted the filter-tests branch February 1, 2022 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataGrid] Filtering tests cleanup
3 participants