@@ -10,6 +10,19 @@ const items = [['1', '2', '3'], ['1', '2', '3'], ['1', '2', '3']];
10
10
describe ( 'Table' , ( ) => {
11
11
beforeEach ( jest . clearAllMocks ) ;
12
12
13
+ describe ( 'Content tests' , ( ) => {
14
+ it ( 'should update state when passing an equal number of rows' , ( ) => {
15
+ const anotherSetOfItems = [
16
+ [ '4' , '5' , '6' ] ,
17
+ [ '4' , '5' , '6' ] ,
18
+ [ '4' , '5' , '6' ]
19
+ ] ;
20
+ const actual = shallow ( < Table headers = { headers } rows = { items } /> ) ;
21
+ actual . setProps ( { rows : anotherSetOfItems } ) ;
22
+ expect ( actual . state ( ) . rows ) . toEqual ( anotherSetOfItems ) ;
23
+ } ) ;
24
+ } ) ;
25
+
13
26
describe ( 'Style tests' , ( ) => {
14
27
it ( 'should render with default styles' , ( ) => {
15
28
const actual = create ( < Table headers = { headers } rows = { items } /> ) ;
@@ -70,7 +83,13 @@ describe('Table', () => {
70
83
71
84
describe ( 'onSortBy()' , ( ) => {
72
85
describe ( 'custom onSortBy' , ( ) => {
73
- it ( 'should call the provided onSortBy instead of defaultSortBy with index, nextDirection and rows' , ( ) => {
86
+ /**
87
+ * I'm skipping the next two failing tests since refactoring the component to make everything work as intended
88
+ * will require a lot of work. Me and @fernandofleury decided to take this course and unblock dependant releases,
89
+ * and decide how to refactor the code in the next few days.
90
+ */
91
+ // eslint-disable-next-line max-len
92
+ it . skip ( 'should call the provided onSortBy instead of defaultSortBy with index, nextDirection and rows' , ( ) => {
74
93
const row = [ 'a' , 'b' , 'c' , 'd' , 'e' ] ;
75
94
const rows = [ row ] ;
76
95
const shuffledRow = shuffle ( row ) ;
@@ -89,7 +108,8 @@ describe('Table', () => {
89
108
} ) ;
90
109
91
110
describe ( 'updateSort()' , ( ) => {
92
- it ( 'should update the state with sortedRow, nextDirection and nextDirection' , ( ) => {
111
+ // eslint-disable-next-line max-len
112
+ it . skip ( 'should update the state with sortedRow, nextDirection and nextDirection' , ( ) => {
93
113
const wrapper = shallow ( < Table /> ) ;
94
114
const index = 0 ;
95
115
const nextDirection = ASCENDING ;
0 commit comments