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

[DataGrid] Improve test coverage of server side data source (@MBilalShafi) #15988

Merged
merged 11 commits into from
Jan 24, 2025
Prev Previous commit
Updates
  • Loading branch information
MBilalShafi committed Jan 24, 2025
commit 1274a9343e7a0a900f4884a413bb6f9688600cdf
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('<DataGridPro /> - Data source', () => {
});
});
await waitFor(() => {
expect(fetchRowsSpy.callCount).to.equal(2);
expect(fetchRowsSpy.callCount).to.be.greaterThan(1);
});
});

Expand All @@ -118,7 +118,7 @@ describe('<DataGridPro /> - Data source', () => {
apiRef.current.setSortModel([{ field: 'name', sort: 'asc' }]);
});
await waitFor(() => {
expect(fetchRowsSpy.callCount).to.equal(2);
expect(fetchRowsSpy.callCount).to.be.greaterThan(1);
});
});

Expand All @@ -131,7 +131,7 @@ describe('<DataGridPro /> - Data source', () => {
apiRef.current.setPage(1);
});
await waitFor(() => {
expect(fetchRowsSpy.callCount).to.equal(2);
expect(fetchRowsSpy.callCount).to.be.greaterThan(1);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ describeSkipIf(isJSDOM)('<DataGridPro /> - Data source tree data', () => {
expect(fetchRowsSpy.callCount).to.equal(1);
});
act(() => {
apiRef.current.setFilterModel({ items: [{ field: 'name', value: 'John', operator: 'contains' }] });
})
apiRef.current.setFilterModel({
items: [{ field: 'name', value: 'John', operator: 'contains' }],
});
});
await waitFor(() => {
expect(fetchRowsSpy.callCount).to.equal(2);
expect(fetchRowsSpy.callCount).to.be.greaterThan(1);
});
});

Expand All @@ -112,7 +114,7 @@ describeSkipIf(isJSDOM)('<DataGridPro /> - Data source tree data', () => {
apiRef.current.setSortModel([{ field: 'name', sort: 'asc' }]);
});
await waitFor(() => {
expect(fetchRowsSpy.callCount).to.equal(2);
expect(fetchRowsSpy.callCount).to.be.greaterThan(1);
});
});

Expand All @@ -125,7 +127,7 @@ describeSkipIf(isJSDOM)('<DataGridPro /> - Data source tree data', () => {
apiRef.current.setPaginationModel({ page: 1, pageSize: 10 });
});
await waitFor(() => {
expect(fetchRowsSpy.callCount).to.equal(2);
expect(fetchRowsSpy.callCount).to.be.greaterThan(1);
});
});

Expand Down
2 changes: 1 addition & 1 deletion test/utils/skipIf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ export const testSkipIf: (condition: boolean) => Mocha.PendingTestFunction =
export const isJSDOM = /jsdom/.test(window.navigator.userAgent);
export const isOSX = /macintosh/i.test(window.navigator.userAgent);
export const hasTouchSupport =
typeof window.Touch !== 'undefined' && typeof window.TouchEvent !== 'undefined';
typeof window.Touch !== 'undefined' && typeof window.TouchEvent !== 'undefined';
Loading