@reltio/interactions 1.4.1585 → 1.4.1586-mui5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/index.ts +1 -0
  2. package/package.json +38 -21
  3. package/public/bundle.js +205 -0
  4. package/public/bundle.js.LICENSE.txt +79 -0
  5. package/public/package.json +22 -0
  6. package/scripts/build/index.js +20 -0
  7. package/src/InteractionsTableView/InteractionsTable/InteractionsTable.tsx +87 -0
  8. package/src/InteractionsTableView/InteractionsTable/__tests__/InteractionsTable.test.js +146 -0
  9. package/src/InteractionsTableView/InteractionsTable/cell-renderers/ActorsRenderer.js +57 -0
  10. package/src/InteractionsTableView/InteractionsTable/cell-renderers/AttributesRenderer.js +50 -0
  11. package/src/InteractionsTableView/InteractionsTable/cell-renderers/BlobRenderer.js +14 -0
  12. package/src/InteractionsTableView/InteractionsTable/cell-renderers/DefaultCellValueRenderer.js +22 -0
  13. package/src/InteractionsTableView/InteractionsTable/cell-renderers/HeadCellRenderer.js +16 -0
  14. package/src/InteractionsTableView/InteractionsTable/cell-renderers/LinkRenderer.js +22 -0
  15. package/src/InteractionsTableView/InteractionsTable/cell-renderers/RowCellRenderer.js +31 -0
  16. package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/ActorsRenderer.test.js +87 -0
  17. package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/AttributesRenderer.test.js +118 -0
  18. package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/DefaultCellValueRenderer.test.js +23 -0
  19. package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/LinkRenderer.test.js +20 -0
  20. package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/RowCellRenderer.test.js +53 -0
  21. package/src/InteractionsTableView/InteractionsTable/cell-renderers/styles.js +67 -0
  22. package/src/InteractionsTableView/InteractionsTable/helpers/__tests__/dataHelpers.spec.js +286 -0
  23. package/src/InteractionsTableView/InteractionsTable/helpers/dataHelpers.ts +120 -0
  24. package/src/InteractionsTableView/InteractionsTable/styles.ts +29 -0
  25. package/src/InteractionsTableView/InteractionsTableHeader/InteractionTypeSelector/InteractionTypeSelector.tsx +26 -0
  26. package/src/InteractionsTableView/InteractionsTableHeader/InteractionTypeSelector/__tests__/InteractionTypeSelector.test.js +34 -0
  27. package/src/InteractionsTableView/InteractionsTableHeader/InteractionsTableHeader.js +76 -0
  28. package/src/InteractionsTableView/InteractionsTableHeader/__tests__/InteractionsTableHeader.test.js +106 -0
  29. package/src/InteractionsTableView/InteractionsTableHeader/styles.js +21 -0
  30. package/src/InteractionsTableView/__tests__/InteractionsTableView.test.js +570 -0
  31. package/src/InteractionsTableView/__tests__/stateReducer.test.js +260 -0
  32. package/src/InteractionsTableView/helpers/__tests__/filtersHelper.test.js +221 -0
  33. package/src/InteractionsTableView/helpers/__tests__/tableHelper.test.js +300 -0
  34. package/src/InteractionsTableView/helpers/filtersHelpers.ts +18 -0
  35. package/src/InteractionsTableView/helpers/tableHelpers.ts +157 -0
  36. package/src/InteractionsTableView/hooks/useInteractions.ts +45 -0
  37. package/src/InteractionsTableView/index.tsx +200 -0
  38. package/src/InteractionsTableView/stateReducer.ts +132 -0
  39. package/src/InteractionsTableView/styles.ts +18 -0
  40. package/src/InteractionsTableView/types/index.ts +8 -0
  41. package/src/index.tsx +59 -0
  42. package/stories/Interactions.stories.js +31 -0
  43. package/stories/utils/entity.js +11 -0
  44. package/stories/utils/interactions.js +837 -0
  45. package/stories/utils/interactionsViewConfig.js +6 -0
  46. package/stories/utils/mdmStore.js +28 -0
  47. package/stories/utils/metadata.js +7221 -0
  48. package/tsconfig.json +4 -0
  49. package/webpack.config.js +10 -0
  50. package/bundle.js +0 -2
  51. package/bundle.js.LICENSE.txt +0 -36
@@ -0,0 +1,570 @@
1
+ import React from 'react';
2
+ import {act, render, screen} from '@testing-library/react';
3
+ import userEvent from '@testing-library/user-event';
4
+ import {mount} from 'enzyme';
5
+ import * as components from '@reltio/components';
6
+ import {EmptyStub} from '@reltio/components';
7
+ import mdmModule from '@reltio/mdm-module';
8
+ import * as reactRedux from 'react-redux';
9
+ import InteractionsTableView from '../index';
10
+ import {DataTypes, getInteractions} from '@reltio/mdm-sdk';
11
+ import * as tableHelpers from '../helpers/tableHelpers';
12
+ import {
13
+ ACTORS_COLUMN_ID,
14
+ ATTRIBUTES_COLUMN_ID,
15
+ DEFAULT_COLUMNS,
16
+ INTERACTION_TYPE_COLUMN_ID
17
+ } from '../helpers/tableHelpers';
18
+ import * as InteractionsTable from '../InteractionsTable/InteractionsTable';
19
+ import * as InteractionsTableHeader from '../InteractionsTableHeader/InteractionsTableHeader';
20
+
21
+ jest.mock('@reltio/mdm-sdk', () => ({
22
+ ...jest.requireActual('@reltio/mdm-sdk'),
23
+ getInteractions: jest.fn()
24
+ }));
25
+
26
+ describe('InteractionTableView tests', () => {
27
+ const INTERACTIONS_MOCK = {
28
+ interactions: [
29
+ {
30
+ uri: 'interactions/1',
31
+ type: 'configuration/interactionTypes/1',
32
+ timestamp: 132234324525
33
+ }
34
+ ],
35
+ totalFetched: 1
36
+ };
37
+ const COLUMNS_DATA_MOCK = [
38
+ {
39
+ id: 'timestamp',
40
+ dataTypeDefinition: {
41
+ type: DataTypes.TYPE_TIMESTAMP
42
+ }
43
+ },
44
+ {
45
+ id: INTERACTION_TYPE_COLUMN_ID,
46
+ dataTypeDefinition: {
47
+ type: DataTypes.TYPE_SELECT
48
+ }
49
+ },
50
+ {
51
+ id: ACTORS_COLUMN_ID,
52
+ dataTypeDefinition: {
53
+ type: DataTypes.TYPE_STRING
54
+ }
55
+ },
56
+ {id: ATTRIBUTES_COLUMN_ID}
57
+ ];
58
+
59
+ let resolveSavedState;
60
+ let resolveInteractions;
61
+ let InteractionsTableHeaderSpy;
62
+ let getColumnsDataSpy;
63
+ beforeAll(() => {
64
+ InteractionsTableHeaderSpy = jest.spyOn(InteractionsTableHeader, 'default').mockImplementation(EmptyStub);
65
+ jest.spyOn(InteractionsTable, 'default').mockImplementation(EmptyStub);
66
+ getInteractions.mockImplementation(
67
+ () =>
68
+ new Promise((_resolve) => {
69
+ resolveInteractions = _resolve;
70
+ })
71
+ );
72
+ getColumnsDataSpy = jest.spyOn(tableHelpers, 'getColumnsData').mockReturnValue(COLUMNS_DATA_MOCK);
73
+ });
74
+
75
+ const metadata = {
76
+ entityTypes: [
77
+ {
78
+ uri: 'configuration/entityTypes/1',
79
+ label: 'EntityType1'
80
+ },
81
+ {
82
+ uri: 'configuration/entityTypes/2',
83
+ label: 'EntityType2'
84
+ }
85
+ ],
86
+ interactionTypes: [
87
+ {
88
+ uri: 'configuration/interactionTypes/1',
89
+ label: 'InteractionType',
90
+ memberTypes: [
91
+ {
92
+ objectTypeURI: 'configuration/entityTypes/1'
93
+ }
94
+ ]
95
+ },
96
+ {
97
+ uri: 'configuration/interactionTypes/2',
98
+ label: 'InteractionType',
99
+ memberTypes: [
100
+ {
101
+ objectTypeURI: 'configuration/entityTypes/1'
102
+ }
103
+ ]
104
+ }
105
+ ]
106
+ };
107
+ const entity = {
108
+ type: 'configuration/entityTypes/1',
109
+ uri: 'entities/1'
110
+ };
111
+ let entitySpy;
112
+ beforeEach(() => {
113
+ jest.clearAllMocks();
114
+ jest.spyOn(reactRedux, 'useSelector').mockImplementation((selector) => selector({}));
115
+ entitySpy = jest.spyOn(mdmModule.selectors, 'getEntity').mockReturnValue(entity);
116
+ jest.spyOn(mdmModule.selectors, 'getMetadata').mockReturnValue(metadata);
117
+ });
118
+
119
+ const props = {
120
+ config: {
121
+ caption: 'Interactions',
122
+ sortOrder: 'asc'
123
+ },
124
+ getSavedState: jest.fn(
125
+ () =>
126
+ new Promise((_resolve) => {
127
+ resolveSavedState = _resolve;
128
+ })
129
+ ),
130
+ saveState: jest.fn()
131
+ };
132
+
133
+ it('should render correctly', async () => {
134
+ const wrapper = mount(<InteractionsTableView {...props} />);
135
+ await act(async () => {
136
+ resolveSavedState(null);
137
+ });
138
+ await act(async () => {
139
+ resolveInteractions(INTERACTIONS_MOCK);
140
+ });
141
+ wrapper.update();
142
+
143
+ expect(wrapper.find(InteractionsTableHeader.default).props()).toMatchObject({
144
+ title: props.config.caption,
145
+ total: INTERACTIONS_MOCK.totalFetched,
146
+ columnsData: COLUMNS_DATA_MOCK,
147
+ selectedColumns: DEFAULT_COLUMNS,
148
+ filtersEnabled: false,
149
+ interactionTypes: metadata.interactionTypes,
150
+ currentInteractionType: null
151
+ });
152
+ expect(wrapper.find(InteractionsTable.default).props()).toMatchObject({
153
+ columnsData: COLUMNS_DATA_MOCK,
154
+ interactions: INTERACTIONS_MOCK.interactions,
155
+ metadata: metadata,
156
+ filters: null,
157
+ sorting: {
158
+ order: 'asc',
159
+ field: 'timestamp'
160
+ }
161
+ });
162
+ expect(wrapper.find(components.BasicTablePagination).props()).toMatchObject({
163
+ count: INTERACTIONS_MOCK.totalFetched,
164
+ rowsPerPage: 15,
165
+ page: 0
166
+ });
167
+ });
168
+
169
+ it('should request interactions on current interaction type change', async () => {
170
+ const wrapper = mount(<InteractionsTableView {...props} />);
171
+ await act(async () => {
172
+ resolveSavedState(null);
173
+ });
174
+
175
+ expect(getInteractions).toBeCalledWith({
176
+ entityUri: entity.uri,
177
+ offset: 0,
178
+ max: 15,
179
+ filter: '',
180
+ sort: 'timestamp',
181
+ order: 'asc'
182
+ });
183
+ await act(async () => {
184
+ resolveInteractions(INTERACTIONS_MOCK);
185
+ });
186
+
187
+ act(() => {
188
+ wrapper.find(InteractionsTableHeader.default).prop('onInteractionTypeChange')(
189
+ 'configuration/interactionTypes/1'
190
+ );
191
+ });
192
+ expect(getInteractions).toBeCalledWith({
193
+ entityUri: entity.uri,
194
+ offset: 0,
195
+ max: 15,
196
+ filter: "equals(type,'configuration/interactionTypes/1')",
197
+ sort: 'timestamp',
198
+ order: 'asc'
199
+ });
200
+ });
201
+
202
+ it('should not request interactions on toggle filtering', async () => {
203
+ const wrapper = mount(<InteractionsTableView {...props} />);
204
+ await act(async () => {
205
+ resolveSavedState(null);
206
+ });
207
+ await act(async () => {
208
+ resolveInteractions(INTERACTIONS_MOCK);
209
+ });
210
+
211
+ getInteractions.mockClear();
212
+ act(() => {
213
+ wrapper.find(InteractionsTableHeader.default).prop('onToggleFilters')();
214
+ });
215
+ expect(getInteractions).not.toBeCalled();
216
+ act(() => {
217
+ wrapper.find(InteractionsTableHeader.default).prop('onToggleFilters')();
218
+ });
219
+ expect(getInteractions).not.toBeCalled();
220
+ });
221
+
222
+ it('should not fail if entity is null', () => {
223
+ const wrapper = mount(<InteractionsTableView {...props} entity={null} />);
224
+ expect(wrapper).not.toBe(null);
225
+ });
226
+
227
+ it('should send desc sorting by default', async () => {
228
+ mount(<InteractionsTableView {...props} config={{caption: 'Interactions'}} />);
229
+ await act(async () => {
230
+ resolveSavedState(null);
231
+ });
232
+ expect(getInteractions).toBeCalledWith({
233
+ entityUri: entity.uri,
234
+ offset: 0,
235
+ max: 15,
236
+ filter: '',
237
+ sort: 'timestamp',
238
+ order: 'desc'
239
+ });
240
+ });
241
+
242
+ it('should reset page on entity change', async () => {
243
+ const user = userEvent.setup();
244
+ const {rerender} = render(<InteractionsTableView {...props} />);
245
+ await act(async () => {
246
+ resolveSavedState(null);
247
+ });
248
+ await act(async () => {
249
+ resolveInteractions({...INTERACTIONS_MOCK, totalFetched: 100});
250
+ });
251
+ await user.click(screen.getByRole('button', {name: 'Go to next page'}));
252
+ expect(screen.getByText('16-30 of 100')).toBeInTheDocument();
253
+ entitySpy.mockReturnValue({
254
+ uri: 'entities/2',
255
+ type: 'configuration/entityTypes/2'
256
+ });
257
+ rerender(<InteractionsTableView {...props} />);
258
+ await act(async () => {
259
+ resolveInteractions({...INTERACTIONS_MOCK, totalFetched: 100});
260
+ });
261
+ expect(screen.getByText('1-15 of 100')).toBeInTheDocument();
262
+ });
263
+
264
+ describe('saved state scenario', () => {
265
+ describe('apply saved state behavior', () => {
266
+ it('should request saved state and apply it on mount', async () => {
267
+ render(<InteractionsTableView {...props} />);
268
+ expect(props.getSavedState).toBeCalled();
269
+ expect(getInteractions).not.toBeCalled();
270
+ const savedState = {
271
+ [entity.type]: {
272
+ currentInteractionType: null,
273
+ visibleColumns: ['timestamp', INTERACTION_TYPE_COLUMN_ID],
274
+ filters: {
275
+ [INTERACTION_TYPE_COLUMN_ID]: {
276
+ filter: 'equals',
277
+ value: 'configuration/interactionTypes/2'
278
+ }
279
+ },
280
+ sorting: {
281
+ field: 'timestamp',
282
+ order: 'asc'
283
+ }
284
+ }
285
+ };
286
+ await act(async () => {
287
+ resolveSavedState(savedState);
288
+ });
289
+ expect(getInteractions).toBeCalledWith({
290
+ entityUri: entity.uri,
291
+ offset: 0,
292
+ max: 15,
293
+ filter: "equals(type,'configuration/interactionTypes/2')",
294
+ sort: 'timestamp',
295
+ order: 'asc'
296
+ });
297
+ });
298
+
299
+ it('should change saved state and apply it on entity type change', async () => {
300
+ const {rerender} = render(<InteractionsTableView {...props} />);
301
+ const savedState = {
302
+ ['configuration/entityTypes/2']: {
303
+ currentInteractionType: null,
304
+ visibleColumns: ['timestamp', INTERACTION_TYPE_COLUMN_ID],
305
+ filters: {
306
+ [INTERACTION_TYPE_COLUMN_ID]: {
307
+ filter: 'equals',
308
+ value: 'configuration/interactionTypes/2'
309
+ }
310
+ },
311
+ sorting: {
312
+ field: 'timestamp',
313
+ order: 'asc'
314
+ }
315
+ }
316
+ };
317
+ await act(async () => {
318
+ resolveSavedState(savedState);
319
+ });
320
+ await act(async () => {
321
+ resolveInteractions(INTERACTIONS_MOCK);
322
+ });
323
+
324
+ props.getSavedState.mockClear();
325
+ getInteractions.mockClear();
326
+ entitySpy.mockReturnValue({
327
+ uri: 'entities/2',
328
+ type: 'configuration/entityTypes/2'
329
+ });
330
+ rerender(<InteractionsTableView {...props} />);
331
+ expect(props.getSavedState).not.toBeCalled();
332
+ expect(getInteractions).toBeCalledWith({
333
+ entityUri: 'entities/2',
334
+ offset: 0,
335
+ max: 15,
336
+ filter: "equals(type,'configuration/interactionTypes/2')",
337
+ sort: 'timestamp',
338
+ order: 'asc'
339
+ });
340
+ });
341
+
342
+ it('should not apply saved state if no appropriate interactions type', async () => {
343
+ getColumnsDataSpy.mockRestore();
344
+ render(<InteractionsTableView {...props} />);
345
+ const savedState = {
346
+ ['configuration/entityTypes/1']: {
347
+ currentInteractionType: 'configuration/interactionTypes/NON_EXISTING_TYPE',
348
+ visibleColumns: ['timestamp', INTERACTION_TYPE_COLUMN_ID],
349
+ filters: {
350
+ [INTERACTION_TYPE_COLUMN_ID]: {
351
+ filter: 'equals',
352
+ value: 'configuration/interactionTypes/NON_EXISTING_TYPE'
353
+ }
354
+ },
355
+ sorting: {
356
+ field: 'timestamp',
357
+ order: 'asc'
358
+ }
359
+ }
360
+ };
361
+ await act(async () => {
362
+ resolveSavedState(savedState);
363
+ });
364
+ await act(async () => {
365
+ resolveInteractions(INTERACTIONS_MOCK);
366
+ });
367
+ expect(getInteractions).toBeCalledWith({
368
+ entityUri: 'entities/1',
369
+ offset: 0,
370
+ max: 15,
371
+ filter: '',
372
+ sort: 'timestamp',
373
+ order: 'asc'
374
+ });
375
+ getColumnsDataSpy.mockReturnValue(COLUMNS_DATA_MOCK);
376
+ });
377
+
378
+ it('should preserve changed state locally on entity type change', async () => {
379
+ InteractionsTableHeaderSpy.mockImplementation(({onInteractionTypeChange}) => (
380
+ <div onClick={() => onInteractionTypeChange('configuration/interactionTypes/1')} role="header" />
381
+ ));
382
+ const user = userEvent.setup();
383
+ const {rerender} = render(<InteractionsTableView {...props} />);
384
+ const savedState = {
385
+ ['configuration/entityTypes/2']: {
386
+ currentInteractionType: null,
387
+ visibleColumns: ['timestamp', INTERACTION_TYPE_COLUMN_ID],
388
+ filters: {
389
+ [INTERACTION_TYPE_COLUMN_ID]: {
390
+ filter: 'equals',
391
+ value: 'configuration/interactionTypes/2'
392
+ }
393
+ },
394
+ sorting: {
395
+ field: 'timestamp',
396
+ order: 'asc'
397
+ }
398
+ }
399
+ };
400
+ await act(async () => {
401
+ resolveSavedState(savedState);
402
+ });
403
+ await act(async () => {
404
+ resolveInteractions(INTERACTIONS_MOCK);
405
+ });
406
+
407
+ await user.click(screen.getByRole('header'));
408
+ await act(async () => {
409
+ resolveInteractions({interactions: [], totalFetched: 0});
410
+ });
411
+
412
+ entitySpy.mockReturnValue({
413
+ uri: 'entities/2',
414
+ type: 'configuration/entityTypes/2'
415
+ });
416
+ rerender(<InteractionsTableView {...props} />);
417
+ await act(async () => {
418
+ resolveInteractions({interactions: [], totalFetched: 0});
419
+ });
420
+ entitySpy.mockReturnValue({
421
+ uri: 'entities/1',
422
+ type: 'configuration/entityTypes/1'
423
+ });
424
+ rerender(<InteractionsTableView {...props} />);
425
+ expect(getInteractions).toHaveBeenLastCalledWith({
426
+ entityUri: 'entities/1',
427
+ offset: 0,
428
+ max: 15,
429
+ filter: "equals(type,'configuration/interactionTypes/1')",
430
+ sort: 'timestamp',
431
+ order: 'asc'
432
+ });
433
+ InteractionsTableHeaderSpy.mockImplementation(EmptyStub);
434
+ });
435
+
436
+ it('should work correctly on entity type change with no saved state', async () => {
437
+ const {rerender} = render(<InteractionsTableView {...props} />);
438
+ await act(async () => {
439
+ resolveSavedState(null);
440
+ });
441
+ await act(async () => {
442
+ resolveInteractions(INTERACTIONS_MOCK);
443
+ });
444
+
445
+ getInteractions.mockClear();
446
+ entitySpy.mockReturnValue({
447
+ uri: 'entities/2',
448
+ type: 'configuration/entityTypes/2'
449
+ });
450
+ rerender(<InteractionsTableView {...props} />);
451
+ expect(getInteractions).toBeCalledWith({
452
+ entityUri: 'entities/2',
453
+ offset: 0,
454
+ max: 15,
455
+ filter: '',
456
+ sort: 'timestamp',
457
+ order: 'asc'
458
+ });
459
+ });
460
+ });
461
+
462
+ describe('save state behavior', () => {
463
+ it('should call props.saveState on interaction type change', async () => {
464
+ const wrapper = mount(<InteractionsTableView {...props} />);
465
+ await act(async () => {
466
+ resolveSavedState(null);
467
+ });
468
+ act(() => {
469
+ wrapper.find(InteractionsTableHeader.default).prop('onInteractionTypeChange')(
470
+ 'configuration/interactionTypes/1'
471
+ );
472
+ });
473
+ expect(props.saveState).toBeCalledWith({
474
+ 'configuration/entityTypes/1': {
475
+ currentInteractionType: 'configuration/interactionTypes/1',
476
+ visibleColumnsForInteractionTypes: {
477
+ null: DEFAULT_COLUMNS,
478
+ 'configuration/interactionTypes/1': ['timestamp', ACTORS_COLUMN_ID]
479
+ },
480
+ filters: null,
481
+ sorting: {
482
+ field: 'timestamp',
483
+ order: 'asc'
484
+ }
485
+ }
486
+ });
487
+ });
488
+
489
+ it('should call props.saveState on columns change', async () => {
490
+ const wrapper = mount(<InteractionsTableView {...props} />);
491
+ await act(async () => {
492
+ resolveSavedState(null);
493
+ });
494
+ act(() => {
495
+ wrapper.find(InteractionsTableHeader.default).prop('onChangeColumns')(['timestamp']);
496
+ });
497
+ expect(props.saveState).toBeCalledWith({
498
+ 'configuration/entityTypes/1': {
499
+ currentInteractionType: null,
500
+ visibleColumnsForInteractionTypes: {
501
+ null: ['timestamp']
502
+ },
503
+ filters: null,
504
+ sorting: {
505
+ field: 'timestamp',
506
+ order: 'asc'
507
+ }
508
+ }
509
+ });
510
+ });
511
+
512
+ it('should call props.saveState on filters change', async () => {
513
+ const wrapper = mount(<InteractionsTableView {...props} />);
514
+ await act(async () => {
515
+ resolveSavedState(null);
516
+ });
517
+ act(() => {
518
+ wrapper.find(InteractionsTable.default).prop('onFilter')({
519
+ columnId: INTERACTION_TYPE_COLUMN_ID,
520
+ filter: {
521
+ value: 'configuration/interactionTypes/1',
522
+ filter: 'equals'
523
+ }
524
+ });
525
+ });
526
+ expect(props.saveState).toBeCalledWith({
527
+ 'configuration/entityTypes/1': {
528
+ currentInteractionType: null,
529
+ visibleColumnsForInteractionTypes: {
530
+ null: DEFAULT_COLUMNS
531
+ },
532
+ filters: {
533
+ [INTERACTION_TYPE_COLUMN_ID]: {
534
+ value: 'configuration/interactionTypes/1',
535
+ filter: 'equals'
536
+ }
537
+ },
538
+ sorting: {
539
+ field: 'timestamp',
540
+ order: 'asc'
541
+ }
542
+ }
543
+ });
544
+ });
545
+
546
+ it('should call props.saveState on sorting change', async () => {
547
+ const wrapper = mount(<InteractionsTableView {...props} />);
548
+ await act(async () => {
549
+ resolveSavedState(null);
550
+ });
551
+ act(() => {
552
+ wrapper.find(InteractionsTable.default).prop('onSort')('timestamp');
553
+ });
554
+ expect(props.saveState).toBeCalledWith({
555
+ 'configuration/entityTypes/1': {
556
+ currentInteractionType: null,
557
+ visibleColumnsForInteractionTypes: {
558
+ null: DEFAULT_COLUMNS
559
+ },
560
+ filters: null,
561
+ sorting: {
562
+ field: 'timestamp',
563
+ order: 'desc'
564
+ }
565
+ }
566
+ });
567
+ });
568
+ });
569
+ });
570
+ });