diff --git a/packages/ra-ui-materialui/src/list/datagrid/DatagridRow.spec.tsx b/packages/ra-ui-materialui/src/list/datagrid/DatagridRow.spec.tsx
index f621017cd0a..8491836526f 100644
--- a/packages/ra-ui-materialui/src/list/datagrid/DatagridRow.spec.tsx
+++ b/packages/ra-ui-materialui/src/list/datagrid/DatagridRow.spec.tsx
@@ -68,7 +68,7 @@ describe('', () => {
);
expect(queryAllByText('expanded')).toHaveLength(0);
fireEvent.click(getByText('hello'));
- expect(queryAllByText('expanded')).toHaveLength(0);
+ expect(queryAllByText('expanded')).toHaveLength(1);
});
it('should not show the expand button if it returns false', () => {
@@ -87,7 +87,7 @@ describe('', () => {
);
expect(queryAllByText('expanded')).toHaveLength(0);
fireEvent.click(getByText('hello'));
- expect(queryAllByText('expanded')).toHaveLength(1);
+ expect(queryAllByText('expanded')).toHaveLength(0);
});
});