[Table] Snapshot test issue with TablePagination
See original GitHub issueRecent changes to compnent TablePagination
break test.
The generated id is always new and snapshot doesn’t/cann’t match.
<p
class="MuiTypography-root MuiTablePagination-caption MuiTypography-body2 MuiTypography-colorInherit"
- id="mui-7460"
+ id="mui-62542"
>
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Environment 🌎
@material-ui/core: 4.10.1
jest: 24.9.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:37 (21 by maintainers)
Top Results From Across the Web
how to add string text rowsPerPageOptions in mui Table ...
I wanted to add Ids on the options, for testing so I did this, ... to ForwardRef(TablePagination) , expected one of type [number,...
Read more >Testing - Material UI - MUI
"Effective snapshot testing" by Kent C. Dodds goes into more details why snapshot testing might be misleading for React component tests. Internal.
Read more >Snapshot Testing - Jest
Snapshot tests are a very useful tool whenever you want to make sure your UI does not change unexpectedly.
Read more >React & Material UI #20: Table Pagination - YouTube
Codesandbox: https://codesandbox.io/s/jolly-dubinsky-bhoi8In this video:- A recap of how Material UI Tables work- How Sorting with Material ...
Read more >Building a pagination component in React with TypeScript
Table of Contents ... For testing, I'll use jest with enzyme. ... In order to solve the issue, we just need some logic...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Auto generated ids have no guarantee to be stable. This is another reason why we don’t recommend snapshot testing.
We never did and we shouldn’t start. It restricts us for something that shouldn’t be done in the first place.