Skip to content

Commit

Permalink
Upgrade testing performance and simplify
Browse files Browse the repository at this point in the history
This test sometimes times out when the test suite is run due to the way it is building new array data. It turns out that we don't need a new data set for this test, as we can use smaller rows per page number to get the same result on the existing data set in the test suite.
  • Loading branch information
gabrielliwerant committed Oct 3, 2019
1 parent f0ea9e5 commit 778d2d4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/MUIDataTable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,15 +902,16 @@ describe('<MUIDataTable />', function() {
});

it('should recalculate page when calling changeRowsPerPage method', () => {
const data = new Array(29).fill('').map(() => ['Joe James', 'Test Corp', 'Yonkers', 'NY']);
const mountWrapper = mount(shallow(<MUIDataTable columns={columns} data={data} />).get(0));
const mountWrapper = mount(shallow(<MUIDataTable columns={columns} data={data} options={{ rowsPerPage: 2 }} />).get(0));
const instance = mountWrapper.instance();

instance.changePage(2);
instance.changeRowsPerPage(15);

const state = mountWrapper.state();
instance.changePage(1);
let state = mountWrapper.state();
assert.equal(state.page, 1);

instance.changeRowsPerPage(4);
state = mountWrapper.state();
assert.equal(state.page, 0);
});

it('should update page position when calling changePage method', () => {
Expand Down

0 comments on commit 778d2d4

Please sign in to comment.