Skip to content
This repository was archived by the owner on Apr 5, 2022. It is now read-only.

Commit 2a87f0f

Browse files
committed
updated test case
1 parent a0e0525 commit 2a87f0f

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

  • packages/visual-stack/src/components/Table/DataTable/tests

packages/visual-stack/src/components/Table/DataTable/tests/index.test.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -673,9 +673,10 @@ describe('DataTable', () => {
673673

674674
it('should callback with the descending sorting data on non sorted header', () => {
675675
const onSort = jest.fn();
676-
const first = 'a';
677-
const second = 'b';
678-
const third = 'c';
676+
const first = null;
677+
const second = 'a';
678+
const third = 'b';
679+
const fourth = 'c';
679680
const label = 'id';
680681
const wrapper = mount(
681682
<DataTable
@@ -692,6 +693,7 @@ describe('DataTable', () => {
692693
{ id: 0, row: [second], selected: false },
693694
{ id: 1, row: [first], selected: false },
694695
{ id: 2, row: [third], selected: false },
696+
{ id: 3, row: [fourth], selected: false },
695697
]}
696698
onSort={onSort}
697699
sortable
@@ -703,6 +705,7 @@ describe('DataTable', () => {
703705
targetHeaderWrapper.simulate('click');
704706

705707
expect(onSort.mock.calls[0][0].data).toEqual([
708+
{ id: 3, row: [fourth], selected: false },
706709
{ id: 2, row: [third], selected: false },
707710
{ id: 0, row: [second], selected: false },
708711
{ id: 1, row: [first], selected: false },
@@ -769,10 +772,10 @@ describe('DataTable', () => {
769772
order: ASCENDING,
770773
}}
771774
data={[
772-
{ id: 2, row: [second], selected: false },
775+
{ id: 2, row: [third], selected: false },
773776
{ id: 1, row: [second], selected: false },
774777
{ id: 0, row: [first], selected: false },
775-
{ id: 3, row: [third], selected: false },
778+
{ id: 3, row: [fourth], selected: false },
776779
]}
777780
onSort={onSort}
778781
sortable
@@ -783,8 +786,8 @@ describe('DataTable', () => {
783786
.filterWhere(node => trim(node.text()) === label);
784787
targetHeaderWrapper.simulate('click');
785788
expect(onSort.mock.calls[0][0].data).toEqual([
786-
{ id: 3, row: [third], selected: false },
787-
{ id: 2, row: [second], selected: false },
789+
{ id: 3, row: [fourth], selected: false },
790+
{ id: 2, row: [third], selected: false },
788791
{ id: 1, row: [second], selected: false },
789792
{ id: 0, row: [first], selected: false },
790793
]);

0 commit comments

Comments
 (0)