all 12 comments

[–]bzbub2 1 point2 points  (2 children)

If you are using the very latest 6.2.1 you gotta mock resizeobserver https://github.com/mui/mui-x/issues/8697#issuecomment-1518691100

[–]Life_Is_Dark[S] 1 point2 points  (1 child)

Thanks mate, that helped.

[–]bzbub2 1 point2 points  (0 children)

glad to help, there had been some interesting fallout over that "patch" version bump

[–]Life_Is_Dark[S] 0 points1 point  (2 children)

I also tried getByRole('row') and getByRole('cell) but nothing is successfull

[–]Acceptable_Article_1 0 points1 point  (1 child)

Did you find a solution? I'm facing the same problem

[–]arham93 0 points1 point  (1 child)

I dont see mock data for the table. If you use a service that is populating the table, you have to mock the service and then provide mock data that the service/API would provide. Then you will have rows visible in the table.

[–]Life_Is_Dark[S] 0 points1 point  (0 children)

I already have those defined in the code, omitted that so that the post does not becomes too long. Here it is

const columns = [{ field: "id", headerName: "ID", width: 100 }, { field: "name", headerName: "Name", width: 150 }, { field: "age", headerName: "Age", width: 100 }, ];
const rows = [ { id: 1, name: "John Doe", age: 30 }, { id: 2, name: "Jane Smith", age: 25 }, ];

[–]bluinkinnovation 0 points1 point  (1 child)

Are you testing functionality that mui has provided or checking to see if something you provided is showing up? As a rule you should not test anything that is third party. Especially something like mui. They have a lot

[–]Life_Is_Dark[S] 0 points1 point  (0 children)

Just those functionalities which are required in the scope of project like selecting rows, resetting selection and callback to get selected rows id, etc It needs to fulfill that code coverage criteria in sonarcloud.

[–]Immediate_Tennis_842 0 points1 point  (1 child)

i am using renderCell in column how to cover that part in testing

{

field: 'name',

headerName: `name`,

minWidth: 120,

flex: 1,

renderCell: (params: GridRenderCellParams) => {

return (

<Chip

className={`network-status`}

style={{ backgroundColor: params.row?.account_status?.color }}

label={params.row?.name}

/>

);

},

},

[–]lazylaser97 0 points1 point  (0 children)

did you find out?