@reltio/dashboard 1.4.1584 → 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.
- package/.DS_Store +0 -0
- package/index.ts +12 -0
- package/package.json +42 -25
- package/public/bundle.js +205 -0
- package/public/bundle.js.LICENSE.txt +59 -0
- package/public/package.json +26 -0
- package/public/types/components/DashboardConfigItem/styles.d.ts +1 -0
- package/{types → public/types}/components/DashboardError/styles.d.ts +1 -1
- package/public/types/components/DashboardLayout/styles.d.ts +1 -0
- package/public/types/components/DashboardLayoutItem/styles.d.ts +1 -0
- package/public/types/components/DashboardLayoutPanel/styles.d.ts +1 -0
- package/public/types/components/DashboardLinearLoader/styles.d.ts +1 -0
- package/{types → public/types}/components/DashboardNoData/styles.d.ts +1 -1
- package/public/types/components/DashboardPerspectiveHeader/styles.d.ts +2 -0
- package/{types → public/types}/components/DashboardPopupMenu/DashboardPopupMenu.d.ts +1 -1
- package/public/types/components/DashboardPopupMenu/styles.d.ts +1 -0
- package/public/types/components/EntityTable/cell-renderers/styles.d.ts +1 -0
- package/{types → public/types}/components/EntityTable/styles.d.ts +1 -1
- package/public/types/components/LayoutItemContent/styles.d.ts +1 -0
- package/public/types/components/LayoutItemHeader/styles.d.ts +1 -0
- package/public/types/components/LayoutItemView/styles.d.ts +1 -0
- package/public/types/components/StatsChart/customized/styles.d.ts +1 -0
- package/public/types/components/WorkflowTaskItem/styles.d.ts +1 -0
- package/public/types/perspective/styles.d.ts +1 -0
- package/public/types/views/chartBased/styles.d.ts +1 -0
- package/public/types/views/custom/styles.d.ts +1 -0
- package/public/types/views/tableBased/styles.d.ts +1 -0
- package/scripts/build/index.js +21 -0
- package/src/HOCs/withPagination.tsx +39 -0
- package/src/components/DashboardConfigItem/DashboardConfigItem.tsx +101 -0
- package/src/components/DashboardConfigItem/__tests__/DashboardConfigItem.specs.tsx +81 -0
- package/src/components/DashboardConfigItem/icons/barChart.svg +12 -0
- package/src/components/DashboardConfigItem/icons/bubbleChart.svg +18 -0
- package/src/components/DashboardConfigItem/icons/customChart.svg +66 -0
- package/src/components/DashboardConfigItem/icons/donutChart.svg +33 -0
- package/src/components/DashboardConfigItem/icons/geomap.svg +23 -0
- package/src/components/DashboardConfigItem/icons/lineChart.svg +16 -0
- package/src/components/DashboardConfigItem/icons/pieChart.svg +27 -0
- package/src/components/DashboardConfigItem/icons/tableWithBars.svg +27 -0
- package/src/components/DashboardConfigItem/icons/treemap.svg +15 -0
- package/src/components/DashboardConfigItem/icons/wordCloud.svg +27 -0
- package/src/components/DashboardConfigItem/styles.ts +56 -0
- package/src/components/DashboardError/DashboardError.tsx +34 -0
- package/src/components/DashboardError/__tests__/DashboardError.test.js +34 -0
- package/src/components/DashboardError/icons/error.svg +113 -0
- package/src/components/DashboardError/styles.ts +30 -0
- package/src/components/DashboardLayout/DashboardLayout.tsx +59 -0
- package/src/components/DashboardLayout/__tests__/DashboardLayout.specs.tsx +56 -0
- package/src/components/DashboardLayout/styles.ts +30 -0
- package/src/components/DashboardLayoutItem/DashboardLayoutItem.tsx +59 -0
- package/src/components/DashboardLayoutItem/__tests__/DashboardLayoutItem.specs.tsx +145 -0
- package/src/components/DashboardLayoutItem/styles.ts +10 -0
- package/src/components/DashboardLayoutPanel/DashboardLayoutPanel.tsx +59 -0
- package/src/components/DashboardLayoutPanel/__tests__/DashboardLayoutPanel.specs.tsx +58 -0
- package/src/components/DashboardLayoutPanel/styles.ts +43 -0
- package/src/components/DashboardLinearLoader/DashboardLinearLoader.tsx +10 -0
- package/src/components/DashboardLinearLoader/__tests__/DashboardLinearLoader.test.js +12 -0
- package/src/components/DashboardLinearLoader/styles.ts +11 -0
- package/src/components/DashboardNoData/.DS_Store +0 -0
- package/src/components/DashboardNoData/DashboardNoData.tsx +21 -0
- package/src/components/DashboardNoData/__tests__/DashboardNoData.test.js +15 -0
- package/src/components/DashboardNoData/icons/noData.svg +68 -0
- package/src/components/DashboardNoData/styles.ts +21 -0
- package/src/components/DashboardPerspectiveHeader/DashboardPerspectiveHeader.tsx +43 -0
- package/src/components/DashboardPerspectiveHeader/__tests__/DashboardPerspectiveHeader.specs.tsx +41 -0
- package/src/components/DashboardPerspectiveHeader/styles.ts +24 -0
- package/src/components/DashboardPopupMenu/DashboardPopupMenu.tsx +75 -0
- package/src/components/DashboardPopupMenu/__tests__/DashboardPopupMenu.test.tsx +51 -0
- package/src/components/DashboardPopupMenu/styles.ts +20 -0
- package/src/components/EntityTable/EntityTable.tsx +49 -0
- package/src/components/EntityTable/__tests__/EntityTable.test.tsx +33 -0
- package/src/components/EntityTable/cell-renderers/EntityLabelRenderer.tsx +24 -0
- package/src/components/EntityTable/cell-renderers/HeadCellRenderer.tsx +34 -0
- package/src/components/EntityTable/cell-renderers/__tests__/EntityLabelRenderer.test.tsx +25 -0
- package/src/components/EntityTable/cell-renderers/styles.ts +46 -0
- package/src/components/EntityTable/styles.ts +19 -0
- package/src/components/LayoutItemContent/LayoutItemContent.tsx +63 -0
- package/src/components/LayoutItemContent/__tests__/LayoutItemContent.test.tsx +71 -0
- package/src/components/LayoutItemContent/styles.ts +36 -0
- package/src/components/LayoutItemHeader/LayoutItemHeader.tsx +86 -0
- package/src/components/LayoutItemHeader/__tests__/LayoutItemHeader.specs.tsx +48 -0
- package/src/components/LayoutItemHeader/styles.ts +44 -0
- package/src/components/LayoutItemView/LayoutItemView.tsx +24 -0
- package/src/components/LayoutItemView/styles.ts +11 -0
- package/src/components/StatsChart/StatsChart.tsx +77 -0
- package/src/components/StatsChart/__tests__/StatsChart.test.tsx +106 -0
- package/src/components/StatsChart/customized/CustomAxisTick.tsx +28 -0
- package/src/components/StatsChart/customized/CustomLegend.tsx +37 -0
- package/src/components/StatsChart/customized/CustomTooltip.tsx +41 -0
- package/src/components/StatsChart/customized/styles.ts +53 -0
- package/src/components/StatsChart/getStatsChartSettings.ts +65 -0
- package/src/components/WorkflowTaskItem/WorkflowTaskItem.tsx +67 -0
- package/src/components/WorkflowTaskItem/WorkflowTaskObject.tsx +54 -0
- package/src/components/WorkflowTaskItem/__tests__/WorkflowTaskItem.test.tsx +73 -0
- package/src/components/WorkflowTaskItem/__tests__/WorkflowTaskObject.test.tsx +95 -0
- package/src/components/WorkflowTaskItem/styles.ts +74 -0
- package/src/components/WorkflowTasksList/WorkflowTasksList.tsx +34 -0
- package/src/components/WorkflowTasksList/__tests__/WorkflowTasksList.test.tsx +98 -0
- package/src/components/index.ts +8 -0
- package/src/contexts/DashboardViewIdContext/index.ts +5 -0
- package/src/hooks/__tests__/useActivititesRequest.specs.tsx +106 -0
- package/src/hooks/__tests__/useEntityByTypeRequest.specs.tsx +280 -0
- package/src/hooks/__tests__/useFacetRequest.specs.tsx +437 -0
- package/src/hooks/__tests__/useFilteredEntitiesRequest.specs.tsx +103 -0
- package/src/hooks/__tests__/useSavedSearchesRequest.specs.tsx +201 -0
- package/src/hooks/__tests__/useStatsRequest.specs.tsx +212 -0
- package/src/hooks/__tests__/useWorkflowTasksRequest.specs.tsx +388 -0
- package/src/hooks/useActivitiesRequest.ts +50 -0
- package/src/hooks/useEntityByTypeRequest.ts +67 -0
- package/src/hooks/useFacetRequest.ts +117 -0
- package/src/hooks/useFilteredEntitiesRequest.ts +57 -0
- package/src/hooks/useSavedSearchesRequest.ts +82 -0
- package/src/hooks/useStatsRequest.ts +47 -0
- package/src/hooks/useWorkflowTasksRequest.ts +66 -0
- package/src/index.ts +25 -0
- package/src/perspective/DashboardPerspectiveView.tsx +132 -0
- package/src/perspective/__tests__/DashboardPerspectiveView.specs.tsx +276 -0
- package/src/perspective/__tests__/data/metadata.data.ts +33 -0
- package/src/perspective/__tests__/data/store.data.ts +15 -0
- package/src/perspective/__tests__/helpers.specs.ts +33 -0
- package/src/perspective/helpers.ts +19 -0
- package/src/perspective/index.tsx +65 -0
- package/src/perspective/styles.ts +16 -0
- package/src/services/__tests__/facets.specs.ts +42 -0
- package/src/services/__tests__/filters.specs.ts +60 -0
- package/src/services/__tests__/period.test.ts +33 -0
- package/src/services/__tests__/stats.test.ts +319 -0
- package/src/services/entityTypes.ts +66 -0
- package/src/services/facets.ts +178 -0
- package/src/services/filters.ts +87 -0
- package/src/services/period.ts +33 -0
- package/src/services/savedSearches.ts +20 -0
- package/src/services/stats.ts +191 -0
- package/src/services/workflowTasks.ts +116 -0
- package/src/types/ActivitiesViewFacetConfig.ts +5 -0
- package/src/types/CustomActionViewFacetConfig.ts +5 -0
- package/src/types/DashboardPerspectiveConfig.ts +18 -0
- package/src/types/DashboardSavedState.ts +7 -0
- package/src/types/EntityByTypeViewFacetConfig.ts +7 -0
- package/src/types/EntityData.ts +4 -0
- package/src/types/FilteredEntitiesFacetConfig.ts +6 -0
- package/src/types/FilteredSavedSearchesFacetConfig.ts +6 -0
- package/src/types/PeriodStep.ts +4 -0
- package/src/types/SavedSearchData.ts +6 -0
- package/src/types/SearchOptions.ts +10 -0
- package/src/types/StatsData.ts +14 -0
- package/src/types/WorkflowTasks.ts +26 -0
- package/src/types/index.ts +14 -0
- package/src/views/ViewsFactory.tsx +79 -0
- package/src/views/__tests__/ViewsFactory.specs.tsx +70 -0
- package/src/views/chartBased/DashboardFacet.tsx +71 -0
- package/src/views/chartBased/EntitiesByTypeViewFacet.tsx +60 -0
- package/src/views/chartBased/ProfileStatsFacet.tsx +54 -0
- package/src/views/chartBased/__tests__/DashboardFacet.specs.tsx +358 -0
- package/src/views/chartBased/__tests__/EntitiesByTypeViewFacet.specs.tsx +101 -0
- package/src/views/chartBased/__tests__/ProfileStatsFacet.specs.tsx +106 -0
- package/src/views/chartBased/styles.ts +13 -0
- package/src/views/custom/CustomActionViewFacet.tsx +36 -0
- package/src/views/custom/NotificationInboxFacet.tsx +86 -0
- package/src/views/custom/__tests__/CustomActionViewFacet.specs.tsx +35 -0
- package/src/views/custom/__tests__/NotificationInboxFacet.specs.tsx +144 -0
- package/src/views/custom/styles.ts +31 -0
- package/src/views/tableBased/ActivitiesViewFacet.tsx +79 -0
- package/src/views/tableBased/FilteredEntitiesViewFacet.tsx +67 -0
- package/src/views/tableBased/FilteredSavedSearchesFacet.tsx +85 -0
- package/src/views/tableBased/__tests__/ActivitiesViewFacet.specs.tsx +113 -0
- package/src/views/tableBased/__tests__/FIlteredEntitiesViewFacet.specs.tsx +90 -0
- package/src/views/tableBased/__tests__/FilteredSavedSearchesFacet.specs.tsx +133 -0
- package/src/views/tableBased/helpers.ts +8 -0
- package/src/views/tableBased/styles.ts +7 -0
- package/stories/Dashboards.stories.js +118 -0
- package/stories/utils/dashboardPerspectiveConfig.js +78 -0
- package/stories/utils/dashboardsViewConfig.js +17 -0
- package/stories/utils/mdmStore.js +73 -0
- package/stories/utils/responses.js +10 -0
- package/tsconfig.json +14 -0
- package/webpack.config.js +10 -0
- package/bundle.js +0 -2
- package/bundle.js.LICENSE.txt +0 -22
- package/types/components/DashboardConfigItem/styles.d.ts +0 -1
- package/types/components/DashboardLayout/styles.d.ts +0 -1
- package/types/components/DashboardLayoutItem/styles.d.ts +0 -1
- package/types/components/DashboardLayoutPanel/styles.d.ts +0 -1
- package/types/components/DashboardLinearLoader/styles.d.ts +0 -1
- package/types/components/DashboardPerspectiveHeader/styles.d.ts +0 -2
- package/types/components/DashboardPopupMenu/styles.d.ts +0 -1
- package/types/components/EntityTable/cell-renderers/styles.d.ts +0 -1
- package/types/components/LayoutItemContent/styles.d.ts +0 -1
- package/types/components/LayoutItemHeader/styles.d.ts +0 -1
- package/types/components/LayoutItemView/styles.d.ts +0 -1
- package/types/components/StatsChart/customized/styles.d.ts +0 -1
- package/types/components/WorkflowTaskItem/styles.d.ts +0 -1
- package/types/perspective/styles.d.ts +0 -1
- package/types/views/chartBased/styles.d.ts +0 -1
- package/types/views/custom/styles.d.ts +0 -1
- package/types/views/tableBased/styles.d.ts +0 -1
- /package/{types → public/types}/HOCs/withPagination.d.ts +0 -0
- /package/{types → public/types}/components/DashboardConfigItem/DashboardConfigItem.d.ts +0 -0
- /package/{types → public/types}/components/DashboardError/DashboardError.d.ts +0 -0
- /package/{types → public/types}/components/DashboardLayout/DashboardLayout.d.ts +0 -0
- /package/{types → public/types}/components/DashboardLayoutItem/DashboardLayoutItem.d.ts +0 -0
- /package/{types → public/types}/components/DashboardLayoutPanel/DashboardLayoutPanel.d.ts +0 -0
- /package/{types → public/types}/components/DashboardLinearLoader/DashboardLinearLoader.d.ts +0 -0
- /package/{types → public/types}/components/DashboardNoData/DashboardNoData.d.ts +0 -0
- /package/{types → public/types}/components/DashboardPerspectiveHeader/DashboardPerspectiveHeader.d.ts +0 -0
- /package/{types → public/types}/components/EntityTable/EntityTable.d.ts +0 -0
- /package/{types → public/types}/components/EntityTable/cell-renderers/EntityLabelRenderer.d.ts +0 -0
- /package/{types → public/types}/components/EntityTable/cell-renderers/HeadCellRenderer.d.ts +0 -0
- /package/{types → public/types}/components/LayoutItemContent/LayoutItemContent.d.ts +0 -0
- /package/{types → public/types}/components/LayoutItemHeader/LayoutItemHeader.d.ts +0 -0
- /package/{types → public/types}/components/LayoutItemView/LayoutItemView.d.ts +0 -0
- /package/{types → public/types}/components/StatsChart/StatsChart.d.ts +0 -0
- /package/{types → public/types}/components/StatsChart/customized/CustomAxisTick.d.ts +0 -0
- /package/{types → public/types}/components/StatsChart/customized/CustomLegend.d.ts +0 -0
- /package/{types → public/types}/components/StatsChart/customized/CustomTooltip.d.ts +0 -0
- /package/{types → public/types}/components/StatsChart/getStatsChartSettings.d.ts +0 -0
- /package/{types → public/types}/components/WorkflowTaskItem/WorkflowTaskItem.d.ts +0 -0
- /package/{types → public/types}/components/WorkflowTaskItem/WorkflowTaskObject.d.ts +0 -0
- /package/{types → public/types}/components/WorkflowTasksList/WorkflowTasksList.d.ts +0 -0
- /package/{types → public/types}/components/index.d.ts +0 -0
- /package/{types → public/types}/contexts/DashboardViewIdContext/index.d.ts +0 -0
- /package/{types → public/types}/hooks/useActivitiesRequest.d.ts +0 -0
- /package/{types → public/types}/hooks/useEntityByTypeRequest.d.ts +0 -0
- /package/{types → public/types}/hooks/useFacetRequest.d.ts +0 -0
- /package/{types → public/types}/hooks/useFilteredEntitiesRequest.d.ts +0 -0
- /package/{types → public/types}/hooks/useSavedSearchesRequest.d.ts +0 -0
- /package/{types → public/types}/hooks/useStatsRequest.d.ts +0 -0
- /package/{types → public/types}/hooks/useWorkflowTasksRequest.d.ts +0 -0
- /package/{types → public/types}/index.d.ts +0 -0
- /package/{types → public/types}/perspective/DashboardPerspectiveView.d.ts +0 -0
- /package/{types → public/types}/perspective/helpers.d.ts +0 -0
- /package/{types → public/types}/perspective/index.d.ts +0 -0
- /package/{types → public/types}/services/entityTypes.d.ts +0 -0
- /package/{types → public/types}/services/facets.d.ts +0 -0
- /package/{types → public/types}/services/filters.d.ts +0 -0
- /package/{types → public/types}/services/period.d.ts +0 -0
- /package/{types → public/types}/services/savedSearches.d.ts +0 -0
- /package/{types → public/types}/services/stats.d.ts +0 -0
- /package/{types → public/types}/services/workflowTasks.d.ts +0 -0
- /package/{types → public/types}/types/ActivitiesViewFacetConfig.d.ts +0 -0
- /package/{types → public/types}/types/CustomActionViewFacetConfig.d.ts +0 -0
- /package/{types → public/types}/types/DashboardPerspectiveConfig.d.ts +0 -0
- /package/{types → public/types}/types/DashboardSavedState.d.ts +0 -0
- /package/{types → public/types}/types/EntityByTypeViewFacetConfig.d.ts +0 -0
- /package/{types → public/types}/types/EntityData.d.ts +0 -0
- /package/{types → public/types}/types/FilteredEntitiesFacetConfig.d.ts +0 -0
- /package/{types → public/types}/types/FilteredSavedSearchesFacetConfig.d.ts +0 -0
- /package/{types → public/types}/types/PeriodStep.d.ts +0 -0
- /package/{types → public/types}/types/SavedSearchData.d.ts +0 -0
- /package/{types → public/types}/types/SearchOptions.d.ts +0 -0
- /package/{types → public/types}/types/StatsData.d.ts +0 -0
- /package/{types → public/types}/types/WorkflowTasks.d.ts +0 -0
- /package/{types → public/types}/types/index.d.ts +0 -0
- /package/{types → public/types}/views/ViewsFactory.d.ts +0 -0
- /package/{types → public/types}/views/chartBased/DashboardFacet.d.ts +0 -0
- /package/{types → public/types}/views/chartBased/EntitiesByTypeViewFacet.d.ts +0 -0
- /package/{types → public/types}/views/chartBased/ProfileStatsFacet.d.ts +0 -0
- /package/{types → public/types}/views/custom/CustomActionViewFacet.d.ts +0 -0
- /package/{types → public/types}/views/custom/NotificationInboxFacet.d.ts +0 -0
- /package/{types → public/types}/views/tableBased/ActivitiesViewFacet.d.ts +0 -0
- /package/{types → public/types}/views/tableBased/FilteredEntitiesViewFacet.d.ts +0 -0
- /package/{types → public/types}/views/tableBased/FilteredSavedSearchesFacet.d.ts +0 -0
- /package/{types → public/types}/views/tableBased/helpers.d.ts +0 -0
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
import {renderHook, act} from '@testing-library/react-hooks';
|
|
4
|
+
import {SearchFilter, isLookupAttrType} from '@reltio/mdm-sdk';
|
|
5
|
+
import {SearchFiltersContext} from '@reltio/components';
|
|
6
|
+
import * as mdmSdkModule from '@reltio/mdm-sdk';
|
|
7
|
+
import * as reactReduxImports from 'react-redux';
|
|
8
|
+
import {useFacetRequest} from '../useFacetRequest';
|
|
9
|
+
|
|
10
|
+
jest.mock('@reltio/mdm-sdk', () => ({
|
|
11
|
+
...jest.requireActual<Record<string, unknown>>('@reltio/mdm-sdk'),
|
|
12
|
+
getFacets: jest.fn(),
|
|
13
|
+
getTotals: jest.fn(),
|
|
14
|
+
resolveLookupsList: jest.fn(),
|
|
15
|
+
getAttrTypeLookupCode: jest.fn(),
|
|
16
|
+
isLookupAttrType: jest.fn()
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
describe('useFacetRequest behavior', () => {
|
|
20
|
+
const initialStore = {
|
|
21
|
+
search: {
|
|
22
|
+
searchOptions: {
|
|
23
|
+
searchByOv: true,
|
|
24
|
+
ovOnly: true
|
|
25
|
+
},
|
|
26
|
+
activityFilter: 'active',
|
|
27
|
+
globalFilter: {
|
|
28
|
+
query: 'globalQuery',
|
|
29
|
+
savedSearchesUris: [],
|
|
30
|
+
isMuted: false
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
ui: {
|
|
34
|
+
paths: {
|
|
35
|
+
workflowPath: 'workflowPath',
|
|
36
|
+
workflowEnvironmentURL: 'workflowEnvironmentURL'
|
|
37
|
+
},
|
|
38
|
+
newConfig: {
|
|
39
|
+
properties: {
|
|
40
|
+
showSearchByOv: true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
tenant: {
|
|
45
|
+
id: 'tenant'
|
|
46
|
+
},
|
|
47
|
+
metadata: {
|
|
48
|
+
tenant: {
|
|
49
|
+
entityTypes: [
|
|
50
|
+
{
|
|
51
|
+
uri: 'configuration/entityTypes/HCP',
|
|
52
|
+
label: 'HCP',
|
|
53
|
+
attributes: [
|
|
54
|
+
{
|
|
55
|
+
label: 'Country Code',
|
|
56
|
+
name: 'CountryCode',
|
|
57
|
+
type: 'String',
|
|
58
|
+
uri: 'configuration/entityTypes/HCP/attributes/CountryCode'
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: 'Date',
|
|
62
|
+
name: 'Date',
|
|
63
|
+
type: 'Date',
|
|
64
|
+
uri: 'configuration/entityTypes/HCP/attributes/Date'
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
analyticsAttributes: [
|
|
68
|
+
{
|
|
69
|
+
uri: 'configuration/entityTypes/HCP/analyticsAttributes/IQ',
|
|
70
|
+
label: 'IQ',
|
|
71
|
+
name: 'IQ',
|
|
72
|
+
type: 'Nested',
|
|
73
|
+
analyticsAttributes: [
|
|
74
|
+
{
|
|
75
|
+
uri: 'configuration/entityTypes/HCP/analyticsAttributes/IQ/analyticsAttributes/score',
|
|
76
|
+
type: 'Int',
|
|
77
|
+
label: 'Reltio Score',
|
|
78
|
+
name: 'score'
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
roles: [
|
|
86
|
+
{
|
|
87
|
+
label: 'My test role',
|
|
88
|
+
uri: 'configuration/roles/MyRole'
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
let resolveFacets;
|
|
96
|
+
let rejectFacets;
|
|
97
|
+
const getFacetsSpy = jest.spyOn(mdmSdkModule, 'getFacets');
|
|
98
|
+
const getTotalsSpy = jest.spyOn(mdmSdkModule, 'getTotals');
|
|
99
|
+
|
|
100
|
+
let resolveLookups;
|
|
101
|
+
const resolveLookupsListSpy = jest.spyOn(mdmSdkModule, 'resolveLookupsList');
|
|
102
|
+
|
|
103
|
+
beforeEach(() => {
|
|
104
|
+
getFacetsSpy.mockReturnValue(
|
|
105
|
+
new Promise((resolve, reject) => {
|
|
106
|
+
resolveFacets = resolve;
|
|
107
|
+
rejectFacets = reject;
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
getTotalsSpy.mockResolvedValue({total: 10});
|
|
111
|
+
resolveLookupsListSpy.mockReturnValue(
|
|
112
|
+
new Promise((resolve) => {
|
|
113
|
+
resolveLookups = resolve;
|
|
114
|
+
})
|
|
115
|
+
);
|
|
116
|
+
jest.spyOn(reactReduxImports, 'useSelector').mockImplementation((selector) => selector(initialStore));
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
afterEach(() => {
|
|
120
|
+
jest.clearAllMocks();
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const facetResponse = {'attributes.CountryCode': {US: 300000, BQ: 11, BM: 1, DZ: 1}};
|
|
124
|
+
const facetsQuery =
|
|
125
|
+
"filter=(equals(type,'configuration/entityTypes/HCP'))" +
|
|
126
|
+
' and (globalQuery)&options=searchByOv&activeness=active';
|
|
127
|
+
const attributeUri = 'configuration/entityTypes/HCP/attributes/CountryCode';
|
|
128
|
+
const defaultRequest = {
|
|
129
|
+
body: [
|
|
130
|
+
{
|
|
131
|
+
fieldName: 'attributes.CountryCode',
|
|
132
|
+
orderType: 'reversedCount',
|
|
133
|
+
pageNo: 1,
|
|
134
|
+
pageSize: 8
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
query: facetsQuery
|
|
138
|
+
};
|
|
139
|
+
const initialProps = {filters: [], attributeUri, pageSize: 8};
|
|
140
|
+
|
|
141
|
+
it('should send request and be in the loading state, and be in loaded state once data is loaded', async () => {
|
|
142
|
+
const {result} = renderHook(useFacetRequest, {initialProps});
|
|
143
|
+
|
|
144
|
+
expect(result.current.state).toBe('loading');
|
|
145
|
+
expect(getFacetsSpy).toBeCalledWith(defaultRequest);
|
|
146
|
+
await act(async () => {
|
|
147
|
+
resolveFacets(facetResponse);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
expect(result.current.state).toBe('loaded');
|
|
151
|
+
expect(result.current.data).toEqual([
|
|
152
|
+
{
|
|
153
|
+
label: 'US',
|
|
154
|
+
group: 'US',
|
|
155
|
+
value: 300000,
|
|
156
|
+
localizedValue: '300,000'
|
|
157
|
+
},
|
|
158
|
+
{label: 'BQ', group: 'BQ', value: 11, localizedValue: '11'},
|
|
159
|
+
{label: 'BM', group: 'BM', value: 1, localizedValue: '1'},
|
|
160
|
+
{label: 'DZ', group: 'DZ', value: 1, localizedValue: '1'}
|
|
161
|
+
]);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('should send request without options=searchByOv if showSearchByOv is false', async () => {
|
|
165
|
+
jest.spyOn(reactReduxImports, 'useSelector').mockImplementation((selector) =>
|
|
166
|
+
selector({
|
|
167
|
+
...initialStore,
|
|
168
|
+
ui: {
|
|
169
|
+
...initialStore.ui,
|
|
170
|
+
newConfig: {
|
|
171
|
+
properties: {
|
|
172
|
+
showSearchByOv: false
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
);
|
|
178
|
+
const {result} = renderHook(useFacetRequest, {initialProps});
|
|
179
|
+
|
|
180
|
+
expect(result.current.state).toBe('loading');
|
|
181
|
+
expect(getFacetsSpy).toBeCalledWith({
|
|
182
|
+
...defaultRequest,
|
|
183
|
+
query: "filter=(equals(type,'configuration/entityTypes/HCP')) and (globalQuery)&activeness=active"
|
|
184
|
+
});
|
|
185
|
+
await act(async () => {
|
|
186
|
+
resolveFacets(facetResponse);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
expect(result.current.state).toBe('loaded');
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it('should return error state if loading is failed', async () => {
|
|
193
|
+
const {result} = renderHook(useFacetRequest, {initialProps});
|
|
194
|
+
|
|
195
|
+
expect(result.current.state).toBe('loading');
|
|
196
|
+
expect(getFacetsSpy).toBeCalledWith(defaultRequest);
|
|
197
|
+
await act(async () => {
|
|
198
|
+
rejectFacets();
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
expect(result.current.state).toBe('error');
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('should not localize values when attributeUri in ui.attributePresentations', async () => {
|
|
205
|
+
jest.spyOn(reactReduxImports, 'useSelector').mockImplementation((selector) =>
|
|
206
|
+
selector({
|
|
207
|
+
...initialStore,
|
|
208
|
+
ui: {
|
|
209
|
+
...initialStore.ui,
|
|
210
|
+
attributePresentations: {
|
|
211
|
+
[attributeUri]: {thousandSeparator: ''}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
);
|
|
216
|
+
const {result} = renderHook(useFacetRequest, {initialProps});
|
|
217
|
+
|
|
218
|
+
expect(result.current.state).toBe('loading');
|
|
219
|
+
expect(getFacetsSpy).toBeCalledWith(defaultRequest);
|
|
220
|
+
await act(async () => {
|
|
221
|
+
resolveFacets(facetResponse);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
expect(result.current.state).toBe('loaded');
|
|
225
|
+
expect(result.current.data).toEqual([
|
|
226
|
+
{label: 'US', group: 'US', value: 300000},
|
|
227
|
+
{label: 'BQ', group: 'BQ', value: 11},
|
|
228
|
+
{label: 'BM', group: 'BM', value: 1},
|
|
229
|
+
{label: 'DZ', group: 'DZ', value: 1}
|
|
230
|
+
]);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it('should load special attributes', async () => {
|
|
234
|
+
const props = {...initialProps, attributeUri: 'tags'};
|
|
235
|
+
const {result} = renderHook(useFacetRequest, {initialProps: props});
|
|
236
|
+
|
|
237
|
+
expect(result.current.state).toBe('loading');
|
|
238
|
+
expect(getFacetsSpy).toBeCalledWith({
|
|
239
|
+
body: [
|
|
240
|
+
{
|
|
241
|
+
fieldName: 'tags',
|
|
242
|
+
orderType: 'reversedCount',
|
|
243
|
+
pageNo: 1,
|
|
244
|
+
pageSize: 8
|
|
245
|
+
}
|
|
246
|
+
],
|
|
247
|
+
query: 'filter=globalQuery&options=searchByOv&activeness=active'
|
|
248
|
+
});
|
|
249
|
+
await act(async () => {
|
|
250
|
+
resolveFacets({tags: {tag1: 1, tag2: 2, tag3: 3, tag4: 1}});
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
expect(result.current.state).toBe('loaded');
|
|
254
|
+
const labels = result.current.data.map(({label}) => label);
|
|
255
|
+
expect(labels).toEqual(['tag3', 'tag2', 'tag1', 'tag4']);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it('should load roles correctly', async () => {
|
|
259
|
+
const props = {...initialProps, attributeUri: 'roles'};
|
|
260
|
+
const {result} = renderHook(useFacetRequest, {initialProps: props});
|
|
261
|
+
|
|
262
|
+
expect(result.current.state).toBe('loading');
|
|
263
|
+
expect(getFacetsSpy).toBeCalledWith({
|
|
264
|
+
body: [
|
|
265
|
+
{
|
|
266
|
+
fieldName: 'roles',
|
|
267
|
+
orderType: 'reversedCount',
|
|
268
|
+
pageNo: 1,
|
|
269
|
+
pageSize: 8
|
|
270
|
+
}
|
|
271
|
+
],
|
|
272
|
+
query: 'filter=globalQuery&options=searchByOv&activeness=active'
|
|
273
|
+
});
|
|
274
|
+
await act(async () => {
|
|
275
|
+
resolveFacets({roles: {MyRole: 1}});
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
expect(result.current.state).toBe('loaded');
|
|
279
|
+
const labels = result.current.data.map(({label}) => label);
|
|
280
|
+
expect(labels).toEqual(['My test role']);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
it('should load date attributes correctly', async () => {
|
|
284
|
+
const props = {...initialProps, attributeUri: 'configuration/entityTypes/HCP/attributes/Date'};
|
|
285
|
+
const {result} = renderHook(useFacetRequest, {initialProps: props});
|
|
286
|
+
|
|
287
|
+
expect(result.current.state).toBe('loading');
|
|
288
|
+
expect(getFacetsSpy).toBeCalledWith({
|
|
289
|
+
body: [
|
|
290
|
+
{
|
|
291
|
+
fieldName: 'attributes.Date',
|
|
292
|
+
orderType: 'reversedCount',
|
|
293
|
+
pageNo: 1,
|
|
294
|
+
pageSize: 8
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
query: facetsQuery
|
|
298
|
+
});
|
|
299
|
+
await act(async () => {
|
|
300
|
+
resolveFacets({
|
|
301
|
+
'attributes.Date': {
|
|
302
|
+
'1620432000000': 19
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
expect(result.current.state).toBe('loaded');
|
|
308
|
+
const labels = result.current.data.map(({label}) => label);
|
|
309
|
+
expect(labels).toEqual([moment(1620432000000).format('L')]);
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it('should load analytics attributes correctly', async () => {
|
|
313
|
+
const props = {
|
|
314
|
+
...initialProps,
|
|
315
|
+
attributeUri: 'configuration/entityTypes/HCP/analyticsAttributes/IQ/analyticsAttributes/score'
|
|
316
|
+
};
|
|
317
|
+
const {result} = renderHook(useFacetRequest, {initialProps: props});
|
|
318
|
+
|
|
319
|
+
expect(result.current.state).toBe('loading');
|
|
320
|
+
expect(getFacetsSpy).toBeCalledWith({
|
|
321
|
+
body: [
|
|
322
|
+
{
|
|
323
|
+
fieldName: 'analyticsAttributes.IQ.score',
|
|
324
|
+
orderType: 'reversedCount',
|
|
325
|
+
pageNo: 1,
|
|
326
|
+
pageSize: 8
|
|
327
|
+
}
|
|
328
|
+
],
|
|
329
|
+
query: facetsQuery
|
|
330
|
+
});
|
|
331
|
+
await act(async () => {
|
|
332
|
+
resolveFacets({'analyticsAttributes.IQ.score': {11: 2}});
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
expect(result.current.state).toBe('loaded');
|
|
336
|
+
expect(result.current.data).toEqual([{value: 2, label: '11', group: '11', localizedValue: '2'}]);
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
it('should send an additional request for other values if option is passed', async () => {
|
|
340
|
+
const filters = [{fieldName: 'attributes.Int', filter: 'range', values: ['1', '2']}];
|
|
341
|
+
const facetsQueryWithOptions =
|
|
342
|
+
"filter=(equals(type,'configuration/entityTypes/HCP')" +
|
|
343
|
+
' and range(attributes.Int,1,2))' +
|
|
344
|
+
' and (globalQuery)&options=searchByOv&activeness=active';
|
|
345
|
+
const props = {...initialProps, filters, options: {showOthers: true}};
|
|
346
|
+
const {result} = renderHook(useFacetRequest, {initialProps: props});
|
|
347
|
+
|
|
348
|
+
expect(result.current.state).toBe('loading');
|
|
349
|
+
expect(getFacetsSpy).toBeCalledWith({...defaultRequest, query: facetsQueryWithOptions});
|
|
350
|
+
await act(async () => {
|
|
351
|
+
resolveFacets(facetResponse);
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
const getTotalFiltersValues = getTotalsSpy.mock.calls[0][0]?.map(({values}) => values[0]);
|
|
355
|
+
const getTotalOptions = getTotalsSpy.mock.calls[0][1];
|
|
356
|
+
expect(getTotalFiltersValues).toEqual(['configuration/entityTypes/HCP', ['1', '2'], 'US', 'BQ', 'BM', 'DZ']);
|
|
357
|
+
expect(getTotalOptions).toEqual({
|
|
358
|
+
activityFilter: 'active',
|
|
359
|
+
globalFilter: 'globalQuery',
|
|
360
|
+
searchOptions: 'searchByOv'
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
expect(result.current.state).toBe('loaded');
|
|
364
|
+
const data = result.current.data;
|
|
365
|
+
const groups = data.map(({group}) => group);
|
|
366
|
+
const othersCount = data.find(({group}) => group === 'Other')?.value;
|
|
367
|
+
expect(groups).toEqual(['US', 'BQ', 'BM', 'DZ', 'Other']);
|
|
368
|
+
expect(othersCount).toBe(10);
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
it('should resend request when invoke reload', async () => {
|
|
372
|
+
const {result} = renderHook(useFacetRequest, {initialProps});
|
|
373
|
+
|
|
374
|
+
expect(result.current.state).toBe('loading');
|
|
375
|
+
expect(getFacetsSpy).toBeCalledWith(defaultRequest);
|
|
376
|
+
await act(async () => {
|
|
377
|
+
resolveFacets(facetResponse);
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
expect(result.current.state).toBe('loaded');
|
|
381
|
+
await act(async () => {
|
|
382
|
+
result.current.reload();
|
|
383
|
+
});
|
|
384
|
+
expect(getFacetsSpy).toHaveBeenCalledTimes(2);
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
it('should resolve lookups for data with lookups', async () => {
|
|
388
|
+
const lookupCode = 'COUNTRY_CD';
|
|
389
|
+
(isLookupAttrType as jest.Mock).mockReturnValue(true);
|
|
390
|
+
jest.spyOn(mdmSdkModule, 'getAttrTypeLookupCode').mockReturnValue(lookupCode);
|
|
391
|
+
const {result} = renderHook(useFacetRequest, {initialProps});
|
|
392
|
+
|
|
393
|
+
expect(result.current.state).toBe('loading');
|
|
394
|
+
expect(getFacetsSpy).toBeCalledWith(defaultRequest);
|
|
395
|
+
await act(async () => {
|
|
396
|
+
resolveFacets(facetResponse);
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
expect(resolveLookupsListSpy).toBeCalledWith(
|
|
400
|
+
['US', 'BQ', 'BM', 'DZ'].map((codeValue) => ({codeValue, type: lookupCode}))
|
|
401
|
+
);
|
|
402
|
+
await act(async () => {
|
|
403
|
+
resolveLookups([
|
|
404
|
+
{COUNTRY_CD: {US: {displayName: 'USA'}}},
|
|
405
|
+
{COUNTRY_CD: {BQ: {displayName: 'Bonaire, Sint Eustatius and Saba'}}},
|
|
406
|
+
{COUNTRY_CD: {BM: {displayName: 'Bermuda'}}},
|
|
407
|
+
{COUNTRY_CD: {DZ: {displayName: 'Algeria'}}}
|
|
408
|
+
]);
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
expect(result.current.state).toBe('loaded');
|
|
412
|
+
const labels = result.current.data.map(({label}) => label);
|
|
413
|
+
expect(labels).toEqual(['USA', 'Bonaire, Sint Eustatius and Saba', 'Bermuda', 'Algeria']);
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
it('should go to error state if attribute uri is undefined', () => {
|
|
417
|
+
const props = {...initialProps, attributeUri: undefined as unknown as string};
|
|
418
|
+
const {result} = renderHook(useFacetRequest, {initialProps: props});
|
|
419
|
+
|
|
420
|
+
expect(result.current.state).toBe('error');
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
it('should take into account special filters', async () => {
|
|
424
|
+
const facetQueryWithSpecialFilters =
|
|
425
|
+
"filter=(equals(type,'configuration/entityTypes/HCP')" +
|
|
426
|
+
" and equals(attributes.Test,'123'))" +
|
|
427
|
+
' and (globalQuery)&options=searchByOv&activeness=active';
|
|
428
|
+
const filterValue: SearchFilter[] = [{fieldName: 'attributes.Test', filter: 'equals', values: ['123']}];
|
|
429
|
+
const Wrapper = ({children}: {children?: React.ReactNode}) => (
|
|
430
|
+
<SearchFiltersContext.Provider value={filterValue}>{children}</SearchFiltersContext.Provider>
|
|
431
|
+
);
|
|
432
|
+
const {result} = renderHook(useFacetRequest, {initialProps, wrapper: Wrapper});
|
|
433
|
+
|
|
434
|
+
expect(result.current.state).toBe('loading');
|
|
435
|
+
expect(getFacetsSpy).toBeCalledWith({...defaultRequest, query: facetQueryWithSpecialFilters});
|
|
436
|
+
});
|
|
437
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as mdmSdkModule from '@reltio/mdm-sdk';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {act} from 'react-dom/test-utils';
|
|
4
|
+
import {asyncCheck} from '../../../../../__mocks__/test-utils';
|
|
5
|
+
import {mount} from 'enzyme';
|
|
6
|
+
import {useFilteredEntitiesRequest} from '../useFilteredEntitiesRequest';
|
|
7
|
+
import {SearchFilter} from '@reltio/mdm-sdk';
|
|
8
|
+
import {SearchFiltersContext} from '@reltio/components';
|
|
9
|
+
|
|
10
|
+
jest.mock('@reltio/mdm-sdk', () => ({
|
|
11
|
+
...jest.requireActual<Record<string, unknown>>('@reltio/mdm-sdk'),
|
|
12
|
+
getFilteredEntities: jest.fn(),
|
|
13
|
+
getTotals: jest.fn()
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
const payload = {
|
|
17
|
+
max: 10,
|
|
18
|
+
offset: 0,
|
|
19
|
+
filters: [
|
|
20
|
+
{
|
|
21
|
+
filter: 'equals',
|
|
22
|
+
fieldName: 'attributes.Phone.ValidationStatus',
|
|
23
|
+
values: ['VALID']
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
describe('useFilteredEntitiesRequest behavior', () => {
|
|
29
|
+
const TestComponent = () => {
|
|
30
|
+
const {data, state, reload, total} = useFilteredEntitiesRequest(payload);
|
|
31
|
+
return state ? <div className={'test'} data-test={{state, data, reload, total}} /> : null;
|
|
32
|
+
};
|
|
33
|
+
const tableData = [{label: 'Crazy-mini'}, {label: 'crazySS'}];
|
|
34
|
+
const hookResponse = [{label: 'Crazy-mini'}, {label: 'crazySS'}];
|
|
35
|
+
|
|
36
|
+
const totalResponse = {total: 10};
|
|
37
|
+
const getHooksValues = (component) => component.find('TestComponent').childAt(0).prop('data-test');
|
|
38
|
+
it('should send request and be in the loading state, and be in loaded state once data is loaded', (done) => {
|
|
39
|
+
jest.spyOn(mdmSdkModule, 'getFilteredEntities').mockImplementation(() => {
|
|
40
|
+
return Promise.resolve(hookResponse);
|
|
41
|
+
});
|
|
42
|
+
jest.spyOn(mdmSdkModule, 'getTotals').mockImplementation(() => {
|
|
43
|
+
return Promise.resolve(totalResponse);
|
|
44
|
+
});
|
|
45
|
+
let component;
|
|
46
|
+
act(() => {
|
|
47
|
+
component = mount(<TestComponent />);
|
|
48
|
+
});
|
|
49
|
+
act(() => {
|
|
50
|
+
component.update();
|
|
51
|
+
const {state} = getHooksValues(component);
|
|
52
|
+
expect(state).toBe('loading');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
asyncCheck(() => {
|
|
56
|
+
act(() => {
|
|
57
|
+
component.update();
|
|
58
|
+
});
|
|
59
|
+
const {state, data, total} = getHooksValues(component);
|
|
60
|
+
expect(state).toBe('loaded');
|
|
61
|
+
expect(data).toStrictEqual(tableData);
|
|
62
|
+
expect(total).toEqual(totalResponse.total);
|
|
63
|
+
}, done);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should add special filters to the request', (done) => {
|
|
67
|
+
jest.spyOn(mdmSdkModule, 'getFilteredEntities').mockImplementation((filters) => {
|
|
68
|
+
if (filters[0].fieldName === 'attributes.Test') {
|
|
69
|
+
return Promise.resolve(hookResponse);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
jest.spyOn(mdmSdkModule, 'getTotals').mockImplementation((filters) => {
|
|
73
|
+
if (filters[0].fieldName === 'attributes.Test') {
|
|
74
|
+
return Promise.resolve(totalResponse);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
let component;
|
|
78
|
+
const filterValue: SearchFilter[] = [
|
|
79
|
+
{
|
|
80
|
+
fieldName: 'attributes.Test',
|
|
81
|
+
filter: 'equals',
|
|
82
|
+
values: ['123']
|
|
83
|
+
}
|
|
84
|
+
];
|
|
85
|
+
act(() => {
|
|
86
|
+
component = mount(
|
|
87
|
+
<SearchFiltersContext.Provider value={filterValue}>
|
|
88
|
+
<TestComponent />
|
|
89
|
+
</SearchFiltersContext.Provider>
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
asyncCheck(() => {
|
|
94
|
+
act(() => {
|
|
95
|
+
component.update();
|
|
96
|
+
});
|
|
97
|
+
const {state, data, total} = getHooksValues(component);
|
|
98
|
+
expect(state).toBe('loaded');
|
|
99
|
+
expect(data).toStrictEqual(tableData);
|
|
100
|
+
expect(total).toEqual(totalResponse.total);
|
|
101
|
+
}, done);
|
|
102
|
+
});
|
|
103
|
+
});
|