Skip to content

Commit

Permalink
[test] Replace waitFor with act
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Oct 6, 2024
1 parent 2c86040 commit 4c080e5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe('<DataGridPro /> - Pagination', () => {
act(() => {
apiRef.current.setPage(1);
});

expect(getColumnValues(0)).to.deep.equal(['1']);
});

Expand Down Expand Up @@ -65,7 +64,6 @@ describe('<DataGridPro /> - Pagination', () => {
act(() => {
apiRef.current.setPage(50);
});

expect(getColumnValues(0)).to.deep.equal(['19']);
});
});
Expand Down
4 changes: 3 additions & 1 deletion packages/x-data-grid-pro/src/tests/rows.DataGridPro.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,9 @@ describe('<DataGridPro /> - Rows', () => {
/>,
);
expect(document.querySelectorAll('[role="row"][data-rowindex]')).to.have.length(6);
act(() => apiRef.current.setPage(1));
act(() => {
apiRef.current.setPage(1);
});
expect(document.querySelectorAll('[role="row"][data-rowindex]')).to.have.length(4);
});
});
Expand Down
8 changes: 4 additions & 4 deletions packages/x-data-grid/src/tests/rowSpanning.DataGrid.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ describe('<DataGrid /> - Row spanning', () => {
/>,
);
expect(Object.keys(apiRef.current.state.rowSpanning.spannedCells).length).to.equal(0);
apiRef.current.setPage(1);
await waitFor(() =>
expect(Object.keys(apiRef.current.state.rowSpanning.spannedCells).length).to.equal(1),
);
await act(() => {
apiRef.current.setPage(1);
});
expect(Object.keys(apiRef.current.state.rowSpanning.spannedCells).length).to.equal(1);
expect(Object.keys(apiRef.current.state.rowSpanning.hiddenCells).length).to.equal(1);
});
});
Expand Down

0 comments on commit 4c080e5

Please sign in to comment.