Mui-datatables: Increase code coverage

Created on 31 Aug 2018  Ā·  7Comments  Ā·  Source: gregnb/mui-datatables

Hi everyone,

I've been trying to juggle a busy work life while slowly adding new features. As a result, the unit tests have taken a back seat 😢. If you ever wanted to contribute I would love some help with increasing the code coverage.

Simply clone the repo and run:

npm run test:coverage

And pick something that interests you.

Thank you!

help wanted

All 7 comments

Hi @gregnb
After a few critical issues I've tried to solve, I think there is need to some refactor MUIDataTable component to declarative approach instead of imperative. Because we have a lot of features, that are meet in different methods of class component, and visual it hard to detect what should happen in those places.

But it would affect current tests, because there we call internal methods (like instance.filterUpdate and etc.). We should test external api, not internal.

I want to refactor MUIDataTables (only logic, not view), but save external API. Do you interest in this work?

I could give an example after next weekend, I think.

I agree I actually have had to write another table component from scratch for my full time job. In that implementation the table model and its helpers are separated out. I’m really strapped for time but I started toying with that same idea.

Separating out into a ā€œtable modelā€ and helpers for the model (sorting, etc) then the MuiDataTable component would call on these to create the model and then handle changes to the model.

I didn’t spent long on it but the model and options are so tightly coupled that I found it to be a little painful. I would love to see some ideas you have? I’m not concerned about the unit tests they are too brittle.

If we had a solid rewrite that separated concerns we could worry about integration level unit tests

OK, I have idea how it should look like, and would make PR with proof of concept (with basic data and sorting). Then, if you would accept this concept, we could separate features and realize it step by step.

I think that's a great plan. Looking forward to seeing your proof of concept

@gregnb Hi. Sorry for waiting for my feedback, but recently I don't have much time. But in one weekend I tried to write concept and understood, that it too much to refactor (with saving current API), so I decided to write datatable component from scratch, to see how my idea will look like, and which problems I can catch.

Right now you can see my repository react-material-ui-datatable and see the source of files.

Concept: separate Model and View, declarative description of table's behavior (see ReactMUIDatatableModel). With such description, we can see data changing from top to bottom. That's React way - props bottom, actions up.

@DTupalov No problem, time is a major killer for me as well. I'll have to revisit this when I get some free time in the new year (hopefully)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mhmmdakbr picture mhmmdakbr  Ā·  4Comments

harryluo91 picture harryluo91  Ā·  3Comments

JordanKadish picture JordanKadish  Ā·  4Comments

ronaiza-cardoso picture ronaiza-cardoso  Ā·  3Comments

weltix picture weltix  Ā·  3Comments