Skip to content

Commit

Permalink
test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
patorjk committed Jul 20, 2020
1 parent 5efc982 commit c1999a3
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/MUIDataTable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,12 @@ describe('<MUIDataTable />', function() {
const instance = shallowWrapper.instance();
});

const options3 = {
consoleWarnings: false
};
const shallowWrapper3 = shallow(<MUIDataTable columns={columns} data={data} options={options3} />).dive();
const instance3 = shallowWrapper3.instance();

assert.strictEqual(warnCallback.callCount, 6);
});

Expand Down
27 changes: 27 additions & 0 deletions test/MUIDataTableToolbarSelect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,31 @@ describe('<TableToolbarSelect />', function() {

assert.strictEqual(selectRowUpdate.calledOnce, true);
});

it('should throw an error when multiple rows are selected and selectableRows="single"', () => {
const onRowsDelete = () => {};
const selectRowUpdate = spy();
const selectedRows = { data: [1] };
const displayData = [1];
const catchErr = spy();

const wrapper = shallow(
<TableToolbarSelect
options={{ textLabels: getTextLabels(), selectableRows: 'single' }}
selectedRows={selectedRows}
onRowsDelete={onRowsDelete}
displayData={displayData}
selectRowUpdate={selectRowUpdate}
/>,
);
const instance = wrapper.dive().instance();

try {
instance.handleCustomSelectedRow([1,2]);
} catch(err) {
catchErr();
}

assert.strictEqual(catchErr.calledOnce, true);
});
});
4 changes: 4 additions & 0 deletions test/TableResize.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ describe('<TableResize />', function() {
colCoordCount++;
}

shallowWrapper.unmount();

assert.strictEqual(colCoordCount, 5);
});

Expand Down Expand Up @@ -95,6 +97,8 @@ describe('<TableResize />', function() {
);
const instance = shallowWrapper.dive().instance();

instance.handleResize();

let evt = {
clientX: 48
};
Expand Down
1 change: 1 addition & 0 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('utils.js', () => {
assert.strictEqual(escapeDangerousCSVCharacters('-SUM(1+1)'), "'-SUM(1+1)");
assert.strictEqual(escapeDangerousCSVCharacters('=SUM(1+1)'), "'=SUM(1+1)");
assert.strictEqual(escapeDangerousCSVCharacters('@SUM(1+1)'), "'@SUM(1+1)");
assert.equal(escapeDangerousCSVCharacters(123), 123);
});
});

Expand Down

0 comments on commit c1999a3

Please sign in to comment.