@eohjsc/react-native-smart-city 0.4.46 → 0.4.48

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 (65) hide show
  1. package/README.md +1 -5
  2. package/android/build.gradle +24 -19
  3. package/package.json +11 -14
  4. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +7 -4
  5. package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +3 -6
  6. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +1 -4
  7. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +11 -1
  8. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +5 -0
  9. package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +6 -1
  10. package/src/commons/Dashboard/MyUnit/index.js +6 -8
  11. package/src/commons/DateTimeRangeChange/index.js +3 -3
  12. package/src/commons/Device/Hanet/ItemHanetDevice.js +1 -5
  13. package/src/commons/Device/ItemAddNew/index.js +2 -6
  14. package/src/commons/Device/ItemDevice.js +1 -5
  15. package/src/commons/FlatListDnD/__test__/index.test.js +25 -27
  16. package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +22 -1
  17. package/src/commons/HeaderAni/index.js +2 -12
  18. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerFull.test.js +23 -1
  19. package/src/commons/Modal/ModalCustom.js +2 -2
  20. package/src/commons/SubUnit/OneTap/ItemOneTap.js +2 -10
  21. package/src/commons/Unit/HeaderUnit/index.js +7 -18
  22. package/src/commons/Unit/SharedUnit.js +43 -58
  23. package/src/commons/Unit/__test__/SharedUnit.test.js +100 -60
  24. package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +289 -0
  25. package/src/commons/UnitSummary/ConfigHistoryChart/index.js +59 -1
  26. package/src/commons/WrapParallaxScrollView/index.js +0 -4
  27. package/src/configs/AccessibilityLabel.js +0 -3
  28. package/src/hooks/IoT/__test__/useRemoteControl.test.js +51 -52
  29. package/src/hooks/IoT/__test__/useWatchConfigs.test.js +2 -3
  30. package/src/navigations/AutomateStack.js +2 -5
  31. package/src/navigations/NotificationStack.js +2 -28
  32. package/src/navigations/SharedStack.js +2 -8
  33. package/src/navigations/UnitStack.js +2 -2
  34. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +32 -31
  35. package/src/screens/Automate/EditActionsList/__tests__/index.test.js +68 -69
  36. package/src/screens/Automate/ScriptDetail/Styles/indexStyles.js +0 -1
  37. package/src/screens/Automate/ScriptDetail/index.js +7 -4
  38. package/src/screens/ChangePosition/__test__/index.test.js +32 -34
  39. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +11 -1
  40. package/src/screens/Device/__test__/detail.test.js +1 -61
  41. package/src/screens/Device/components/ChartWrapper.js +12 -14
  42. package/src/screens/Device/components/VisualChart.js +1 -7
  43. package/src/screens/Device/components/__test__/VisualChart.test.js +3 -0
  44. package/src/screens/Device/detail.js +31 -28
  45. package/src/screens/Device/hooks/__test__/useEvaluateValue.test.js +18 -20
  46. package/src/screens/Device/styles.js +0 -3
  47. package/src/screens/Notification/__test__/Notification.test.js +8 -14
  48. package/src/screens/Notification/components/NotificationItem.js +0 -1
  49. package/src/screens/Notification/index.js +48 -42
  50. package/src/screens/Notification/styles/indexStyles.js +3 -6
  51. package/src/screens/SharedUnit/index.js +4 -1
  52. package/src/screens/Sharing/InfoMemberUnit.js +1 -3
  53. package/src/screens/Sharing/MemberList.js +3 -16
  54. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +0 -2
  55. package/src/screens/Sharing/__test__/SelectPermission.test.js +137 -96
  56. package/src/screens/Template/__test__/EditTemplate.test.js +45 -48
  57. package/src/screens/Unit/__test__/SelectAddress.test.js +11 -4
  58. package/src/screens/Unit/components/SharedUnit/index.js +9 -6
  59. package/src/screens/Unit/components/__test__/SharedUnit.test.js +15 -19
  60. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +11 -1
  61. package/src/utils/Monitor.js +2 -2
  62. package/src/Images/Common/pushpin-full.svg +0 -3
  63. package/src/Images/Common/pushpin-outline.svg +0 -3
  64. package/src/Images/Common/star-full.svg +0 -3
  65. package/src/Images/Common/star-outline.svg +0 -3
@@ -17,7 +17,7 @@ import api from '../../../../utils/Apis/axios';
17
17
  import { API } from '../../../../configs';
18
18
  import { PERMISSION_TYPE } from '../../../../configs/Constants';
19
19
  import Detail from '../../components/Detail';
20
- // import ModalPopupCT from '../../../../commons/ModalPopupCT';
20
+ import ModalPopupCT from '../../../../commons/ModalPopupCT';
21
21
  import { fetchGatewayCT, flushPromises } from '../../test-utils';
22
22
 
23
23
  const mock = new MockAdapter(api.axiosInstance);
@@ -133,6 +133,8 @@ describe('Test DeviceModbusDetail', () => {
133
133
  const menuActionMore = detail?.findAllByType(MenuActionMore);
134
134
  expect(menuActionMore[0].props.isVisible).toEqual(true);
135
135
 
136
+ await flushPromises();
137
+
136
138
  await act(async () => {
137
139
  await menuActionMore[0].props.listMenuItem[0].doAction();
138
140
  });
@@ -143,39 +145,38 @@ describe('Test DeviceModbusDetail', () => {
143
145
  });
144
146
  });
145
147
 
146
- // NOTE: Hinh will fix it later
147
- // it('test render DeviceModbusDetail onPress more and onPress Delete modbus', async () => {
148
- // await act(async () => {
149
- // tree = await create(wrapComponent());
150
- // });
151
- // await flushPromises();
152
- // const instance = tree.root;
153
- // const detail = instance?.findByType(Detail);
154
- // await headerCustomOnPressMore(detail);
155
- // const menuActionMore = detail?.findByType(MenuActionMore);
156
- // expect(menuActionMore.props.isVisible).toEqual(true);
148
+ it('test render DeviceModbusDetail onPress more and onPress Delete modbus', async () => {
149
+ await act(async () => {
150
+ tree = await create(wrapComponent());
151
+ });
152
+ await flushPromises();
153
+ const instance = tree.root;
154
+ const detail = instance?.findByType(Detail);
155
+ await headerCustomOnPressMore(detail);
156
+ const menuActionMore = detail?.findByType(MenuActionMore);
157
+ expect(menuActionMore.props.isVisible).toEqual(true);
157
158
 
158
- // await act(async () => {
159
- // menuActionMore.props.listMenuItem[1].doAction();
160
- // });
161
- // await flushPromises();
159
+ await act(async () => {
160
+ menuActionMore.props.listMenuItem[1].doAction();
161
+ });
162
+ await flushPromises();
162
163
 
163
- // const modal = instance.findByType(ModalPopupCT);
164
- // mock.onDelete(API.DEV_MODE.ZIGBEE.DEVICE_DETAIL(1, 1)).reply(200);
165
- // await act(async () => {
166
- // await modal.props.onPressConfirm();
167
- // });
168
- // await flushPromises();
164
+ const modal = instance.findByType(ModalPopupCT);
165
+ mock.onDelete(API.DEV_MODE.ZIGBEE.DEVICE_DETAIL(1, 1)).reply(200);
166
+ await act(async () => {
167
+ await modal.props.onPressConfirm();
168
+ });
169
+ await flushPromises();
169
170
 
170
- // expect(mockPop).toBeCalledWith(1);
171
- // expect(Toast.show).toBeCalledWith({
172
- // position: 'bottom',
173
- // text1: 'Delete successfully!',
174
- // text2: undefined,
175
- // type: 'success',
176
- // visibilityTime: 1000,
177
- // });
178
- // });
171
+ expect(mockPop).toBeCalledWith(1);
172
+ expect(Toast.show).toBeCalledWith({
173
+ position: 'bottom',
174
+ text1: 'Delete successfully!',
175
+ text2: undefined,
176
+ type: 'success',
177
+ visibilityTime: 1000,
178
+ });
179
+ });
179
180
 
180
181
  it('test render DeviceZigbeeDetail onPress TabPanel config write', async () => {
181
182
  mock.onGet(API.DEV_MODE.MODBUS.REGISTER(1, 1)).reply(200, [
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-unused-vars */
2
1
  import React from 'react';
3
2
  import DraggableFlatList from 'react-native-draggable-flatlist';
4
3
  import { create, act } from 'react-test-renderer';
@@ -38,78 +37,78 @@ describe('EditActionsList', () => {
38
37
  mockedNavigate.mockClear();
39
38
  });
40
39
  it('render EditActionsList', async () => {
41
- // await act(async () => {
42
- // tree = await create(wrapComponent());
43
- // });
44
- // const instance = tree.root;
45
- // const draggableFlatList = instance.findAllByType(DraggableFlatList);
46
- // const modalBottom = instance.findAllByType(ModalBottom);
47
- // expect(draggableFlatList).toHaveLength(1);
48
- // expect(modalBottom).toHaveLength(1);
40
+ await act(async () => {
41
+ tree = await create(wrapComponent());
42
+ });
43
+ const instance = tree.root;
44
+ const draggableFlatList = instance.findAllByType(DraggableFlatList);
45
+ const modalBottom = instance.findAllByType(ModalBottom);
46
+ expect(draggableFlatList).toHaveLength(1);
47
+ expect(modalBottom).toHaveLength(1);
48
+ });
49
+ it('EditActionsList onPress cancel', async () => {
50
+ await act(async () => {
51
+ tree = await create(wrapComponent());
52
+ });
53
+ const instance = tree.root;
54
+ const buttonCancel = instance.find(
55
+ (el) =>
56
+ el.props.accessibilityLabel ===
57
+ AccessibilityLabel.BUTTON_CANCEL_EDIT_ACTION_LIST &&
58
+ el.type === TouchableOpacity
59
+ );
60
+ expect(buttonCancel).toBeDefined();
61
+ await act(async () => {
62
+ buttonCancel.props.onPress();
63
+ });
64
+ expect(mockedNavigate).toHaveBeenCalled();
49
65
  });
50
- // it('EditActionsList onPress cancel', async () => {
51
- // await act(async () => {
52
- // tree = await create(wrapComponent());
53
- // });
54
- // const instance = tree.root;
55
- // const buttonCancel = instance.find(
56
- // (el) =>
57
- // el.props.accessibilityLabel ===
58
- // AccessibilityLabel.BUTTON_CANCEL_EDIT_ACTION_LIST &&
59
- // el.type === TouchableOpacity
60
- // );
61
- // expect(buttonCancel).toBeDefined();
62
- // await act(async () => {
63
- // buttonCancel.props.onPress();
64
- // });
65
- // expect(mockedNavigate).toHaveBeenCalled();
66
- // });
67
- // it('EditActionsList onPress save', async () => {
68
- // mock.onPut(API.AUTOMATE.ORDER_SCRIPT_ACTION(1)).reply(200);
69
- // await act(async () => {
70
- // tree = await create(wrapComponent());
71
- // });
72
- // const instance = tree.root;
73
- // const buttonSave = instance.find(
74
- // (el) =>
75
- // el.props.accessibilityLabel ===
76
- // AccessibilityLabel.BUTTON_SAVE_EDIT_ACTION_LIST &&
77
- // el.type === TouchableOpacity
78
- // );
79
- // expect(buttonSave).toBeDefined();
66
+ it('EditActionsList onPress save', async () => {
67
+ mock.onPut(API.AUTOMATE.ORDER_SCRIPT_ACTION(1)).reply(200);
68
+ await act(async () => {
69
+ tree = await create(wrapComponent());
70
+ });
71
+ const instance = tree.root;
72
+ const buttonSave = instance.find(
73
+ (el) =>
74
+ el.props.accessibilityLabel ===
75
+ AccessibilityLabel.BUTTON_SAVE_EDIT_ACTION_LIST &&
76
+ el.type === TouchableOpacity
77
+ );
78
+ expect(buttonSave).toBeDefined();
80
79
 
81
- // await act(async () => {
82
- // buttonSave.props.onPress();
83
- // });
80
+ await act(async () => {
81
+ buttonSave.props.onPress();
82
+ });
84
83
 
85
- // expect(mock.history.put).toHaveLength(1);
86
- // });
84
+ expect(mock.history.put).toHaveLength(1);
85
+ });
87
86
 
88
- // it('EditActionsList has remove button', async () => {
89
- // await act(async () => {
90
- // tree = await create(wrapComponent());
91
- // });
92
- // const instance = tree.root;
93
- // const buttonRemove = instance.find(
94
- // (el) =>
95
- // el.props.accessibilityLabel ===
96
- // AccessibilityLabel.BUTTON_REMOVE_EDIT_ACTION_LIST &&
97
- // el.type === TouchableOpacity
98
- // );
99
- // expect(buttonRemove).toBeDefined();
100
- // });
87
+ it('EditActionsList has remove button', async () => {
88
+ await act(async () => {
89
+ tree = await create(wrapComponent());
90
+ });
91
+ const instance = tree.root;
92
+ const buttonRemove = instance.find(
93
+ (el) =>
94
+ el.props.accessibilityLabel ===
95
+ AccessibilityLabel.BUTTON_REMOVE_EDIT_ACTION_LIST &&
96
+ el.type === TouchableOpacity
97
+ );
98
+ expect(buttonRemove).toBeDefined();
99
+ });
101
100
 
102
- // it('EditActionsList modal onPress remove', async () => {
103
- // await act(async () => {
104
- // tree = await create(wrapComponent());
105
- // });
106
- // const instance = tree.root;
107
- // const modalBottom = instance.findAllByType(ModalBottom);
108
- // await act(async () => {
109
- // modalBottom[0].props.onRemove();
110
- // });
101
+ it('EditActionsList modal onPress remove', async () => {
102
+ await act(async () => {
103
+ tree = await create(wrapComponent());
104
+ });
105
+ const instance = tree.root;
106
+ const modalBottom = instance.findAllByType(ModalBottom);
107
+ await act(async () => {
108
+ modalBottom[0].props.onRemove();
109
+ });
111
110
 
112
- // mock.onDelete(API.AUTOMATE.DELETE_SCRIPT_ACTION(1, 1)).reply(200);
113
- // expect(mock.history.delete).toHaveLength(1);
114
- // });
111
+ mock.onDelete(API.AUTOMATE.DELETE_SCRIPT_ACTION(1, 1)).reply(200);
112
+ expect(mock.history.delete).toHaveLength(1);
113
+ });
115
114
  });
@@ -63,7 +63,6 @@ export default StyleSheet.create({
63
63
  },
64
64
  moreButton: {
65
65
  marginLeft: -5,
66
- transform: [{ rotate: '90deg' }],
67
66
  },
68
67
  wrapStyle: {
69
68
  borderRadius: 8,
@@ -7,6 +7,7 @@ import React, {
7
7
  } from 'react';
8
8
  import { Image, Platform, TouchableOpacity, View } from 'react-native';
9
9
  import { PopoverMode } from 'react-native-popover-view';
10
+ import { IconFill, IconOutline } from '@ant-design/icons-react-native';
10
11
  import { Icon } from '@ant-design/react-native';
11
12
 
12
13
  import { useTranslations } from '../../../hooks/Common/useTranslations';
@@ -30,8 +31,6 @@ import RenameScript from './Components/RenameScript';
30
31
  import DeleteScript from './Components/DeleteScript';
31
32
  import Images from '../../../configs/Images';
32
33
  import { useBackendPermission } from '../../../utils/Permission/backend';
33
- import StarFull from '../../../Images/Common/star-full.svg';
34
- import StarOutline from '../../../Images/Common/star-outline.svg';
35
34
 
36
35
  const PreventDoubleTouch = withPreventDoubleClick(TouchableOpacity);
37
36
 
@@ -161,7 +160,7 @@ const ScriptDetail = ({ route }) => {
161
160
  style={[styles.headerButton, styles.moreButton]}
162
161
  accessibilityLabel={AccessibilityLabel.ICON_MORE}
163
162
  >
164
- <Icon name={'ellipsis'} size={27} color={Colors.Black} />
163
+ <Icon name={'more'} size={27} color={Colors.Black} />
165
164
  </TouchableOpacity>
166
165
  </View>
167
166
  ),
@@ -377,7 +376,11 @@ const ButtonStar = ({ automate }) => {
377
376
  onPress={onPressStar}
378
377
  accessibilityLabel={AccessibilityLabel.HEADER_SCRIPT_DETAIL_BUTTON_STAR}
379
378
  >
380
- {isStarred ? <StarFull /> : <StarOutline />}
379
+ {isStarred ? (
380
+ <IconFill name="star" size={25} color={Colors.Yellow6} />
381
+ ) : (
382
+ <IconOutline name="star" size={25} />
383
+ )}
381
384
  </PreventDoubleTouch>
382
385
  );
383
386
  };
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-unused-vars */
2
1
  import React from 'react';
3
2
  import { act, create } from 'react-test-renderer';
4
3
  import MockAdapter from 'axios-mock-adapter';
@@ -34,8 +33,6 @@ const wrapComponent = ({ ...rest }) => (
34
33
  </SCProvider>
35
34
  );
36
35
 
37
- // NOTE: Hinh will fix it later
38
-
39
36
  describe('Test ChangePosition', () => {
40
37
  let tree;
41
38
 
@@ -45,36 +42,37 @@ describe('Test ChangePosition', () => {
45
42
  });
46
43
 
47
44
  it('render ChangePosition', async () => {
48
- // const mockFetchData = jest.fn();
49
- // const spyToastSuccess = jest.spyOn(ToastBottomHelper, 'success');
50
- // useRoute.mockReturnValue({
51
- // params: {
52
- // sensor: { id: 1, name: 'device' },
53
- // display: { items: [{ id: 1 }, { id: 2 }] },
54
- // setDisplay: mockSetDisplay,
55
- // station: { id: 1, name: 'station' },
56
- // evaluate: {},
57
- // fetchDataDeviceDetail: mockFetchData,
58
- // },
59
- // });
60
- // mock.onPut(API.DEVICE.ORDER_DISPLAY_ITEMS(1)).reply(200);
61
- // await act(async () => {
62
- // tree = await create(wrapComponent({}));
63
- // });
64
- // const instance = tree.root;
65
- // const flatListDnD = instance.findAllByType(DraggableFlatList);
66
- // expect(flatListDnD).toHaveLength(1);
67
- // const bottomButtonView = instance.findAllByType(BottomButtonView);
68
- // expect(bottomButtonView).toHaveLength(1);
69
- // await act(async () => {
70
- // flatListDnD[0].props.onDragEnd({ data: [{ id: 2 }, { id: 1 }] });
71
- // });
72
- // await act(async () => {
73
- // bottomButtonView[0].props.onPressMain();
74
- // });
75
- // expect(mockGoBack).toHaveBeenCalled();
76
- // expect(mockFetchData).toHaveBeenCalled();
77
- // expect(mockSetDisplay).toHaveBeenCalled();
78
- // expect(spyToastSuccess).toBeCalledWith('Updated widget successfully');
45
+ const mockFetchData = jest.fn();
46
+ const spyToastSuccess = jest.spyOn(ToastBottomHelper, 'success');
47
+ useRoute.mockReturnValue({
48
+ params: {
49
+ sensor: { id: 1, name: 'device' },
50
+ display: { items: [{ id: 1 }, { id: 2 }] },
51
+ setDisplay: mockSetDisplay,
52
+ station: { id: 1, name: 'station' },
53
+ evaluate: {},
54
+ fetchDataDeviceDetail: mockFetchData,
55
+ },
56
+ });
57
+ mock.onPut(API.DEVICE.ORDER_DISPLAY_ITEMS(1)).reply(200);
58
+ await act(async () => {
59
+ tree = await create(wrapComponent({}));
60
+ });
61
+ const instance = tree.root;
62
+ const flatListDnD = instance.findAllByType(DraggableFlatList);
63
+ expect(flatListDnD).toHaveLength(1);
64
+
65
+ const bottomButtonView = instance.findAllByType(BottomButtonView);
66
+ expect(bottomButtonView).toHaveLength(1);
67
+ await act(async () => {
68
+ flatListDnD[0].props.onDragEnd({ data: [{ id: 2 }, { id: 1 }] });
69
+ });
70
+ await act(async () => {
71
+ bottomButtonView[0].props.onPressMain();
72
+ });
73
+ expect(mockGoBack).toHaveBeenCalled();
74
+ expect(mockFetchData).toHaveBeenCalled();
75
+ expect(mockSetDisplay).toHaveBeenCalled();
76
+ expect(spyToastSuccess).toBeCalledWith('Updated widget successfully');
79
77
  });
80
78
  });
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import renderer, { act } from 'react-test-renderer';
3
3
 
4
4
  import { SCProvider } from '../../../context';
@@ -30,6 +30,14 @@ jest.mock('@react-navigation/native', () => {
30
30
  };
31
31
  });
32
32
 
33
+ const mockSetState = jest.fn();
34
+ jest.mock('react', () => {
35
+ return {
36
+ ...jest.requireActual('react'),
37
+ useState: jest.fn((init) => [init, mockSetState]),
38
+ };
39
+ });
40
+
33
41
  describe('Test ConfirmUnitDeletion', () => {
34
42
  let tree;
35
43
  let route;
@@ -45,6 +53,7 @@ describe('Test ConfirmUnitDeletion', () => {
45
53
  });
46
54
 
47
55
  it('test render ConfirmUnitDeletion', async () => {
56
+ useState.mockImplementationOnce((init) => ['new_name', mockSetState]);
48
57
  await act(async () => {
49
58
  tree = await renderer.create(wrapComponent(route));
50
59
  });
@@ -56,6 +65,7 @@ describe('Test ConfirmUnitDeletion', () => {
56
65
  });
57
66
  });
58
67
  it('Onpress button ConfirmUnitDeletion ', async () => {
68
+ useState.mockImplementationOnce((init) => ['YES', mockSetState]);
59
69
  await act(async () => {
60
70
  tree = await renderer.create(wrapComponent(route));
61
71
  });
@@ -194,7 +194,6 @@ describe('test DeviceDetail', () => {
194
194
  useLayoutEffectSpy.mockImplementation(() => setState);
195
195
  mock.reset();
196
196
  mockedNavigate.mockClear();
197
- watchMultiConfigs.mockReset();
198
197
  });
199
198
 
200
199
  it('render DeviceDetail render SensorDisplayItem', async () => {
@@ -814,65 +813,6 @@ describe('test DeviceDetail', () => {
814
813
  el.props.accessibilityLabel === AccessibilityLabel.SENSOR_DISPLAY_ITEM
815
814
  );
816
815
  expect(sensorDisplayItem.length).toEqual(1);
817
- expect(watchMultiConfigs).toHaveBeenCalledWith([1]);
818
- });
819
-
820
- it('watch action config', async () => {
821
- mock.onGet(API.CHIP.JSON_CONFIGURATION).reply(200, []);
822
- const responseDisplay = {
823
- items: [
824
- {
825
- id: 1,
826
- order: 0,
827
- template: 'on_off_button_action_template',
828
- type: 'on_off_button_action_template',
829
- configuration: {
830
- config: 2,
831
- },
832
- },
833
- ],
834
- };
835
- const responseDisplayValueV2 = {
836
- configs: [{ id: 2 }],
837
- is_connected: true,
838
- last_updated: '2021-01-24T12:00:00.000Z',
839
- };
840
- mockAxios(responseDisplay, responseDisplayValueV2);
841
- await act(async () => {
842
- tree = await create(wrapComponent(store, account, route));
843
- });
844
-
845
- expect(watchMultiConfigs).toHaveBeenCalledWith([2]);
846
- });
847
-
848
- it('watch stages grid action config', async () => {
849
- mock.onGet(API.CHIP.JSON_CONFIGURATION).reply(200, []);
850
- const responseDisplay = {
851
- items: [
852
- {
853
- id: 1,
854
- order: 0,
855
- template: 'StatesGridActionTemplate',
856
- configuration: {
857
- options: [
858
- {
859
- config: 3,
860
- },
861
- ],
862
- },
863
- },
864
- ],
865
- };
866
- const responseDisplayValueV2 = {
867
- configs: [{ id: 2 }],
868
- is_connected: true,
869
- last_updated: '2021-01-24T12:00:00.000Z',
870
- };
871
- mockAxios(responseDisplay, responseDisplayValueV2);
872
- await act(async () => {
873
- tree = await create(wrapComponent(store, account, route));
874
- });
875
-
876
- expect(watchMultiConfigs).toHaveBeenCalledWith([3]);
816
+ expect(watchMultiConfigs).toHaveBeenCalled();
877
817
  });
878
818
  });
@@ -5,7 +5,7 @@ import DateTimeRangeChange from '../../../commons/DateTimeRangeChange';
5
5
  import moment from 'moment';
6
6
 
7
7
  const ChartWrapper = memo(
8
- ({ children, onChangeDate, showTime, isWidgetOrder, shouldRenderDate }) => {
8
+ ({ children, onChangeDate, showTime, isWidgetOrder }) => {
9
9
  const [value, setValue] = useState([
10
10
  moment().subtract(6, 'days'),
11
11
  moment(),
@@ -24,20 +24,18 @@ const ChartWrapper = memo(
24
24
 
25
25
  return (
26
26
  <View>
27
- {shouldRenderDate && (
28
- <View style={styles.headerContainer}>
29
- <View>
30
- <DateTimeRangeChange
31
- startTime={value[0]}
32
- endTime={value[1]}
33
- showTime={showTime}
34
- selectStart={selectStart}
35
- selectEnd={selectEnd}
36
- isWidgetOrder={isWidgetOrder}
37
- />
38
- </View>
27
+ <View style={styles.headerContainer}>
28
+ <View>
29
+ <DateTimeRangeChange
30
+ startTime={value[0]}
31
+ endTime={value[1]}
32
+ showTime={showTime}
33
+ selectStart={selectStart}
34
+ selectEnd={selectEnd}
35
+ isWidgetOrder={isWidgetOrder}
36
+ />
39
37
  </View>
40
- )}
38
+ </View>
41
39
  {children}
42
40
  </View>
43
41
  );
@@ -163,12 +163,7 @@ const groupByOptions = [
163
163
  { title: 'Y', data: CHART_GROUP_TYPE.YEAR },
164
164
  ];
165
165
 
166
- const VisualChart = ({
167
- item,
168
- isDemo = false,
169
- isWidgetOrder,
170
- shouldRenderDate,
171
- }) => {
166
+ const VisualChart = ({ item, isDemo = false, isWidgetOrder }) => {
172
167
  const { configuration = {} } = item;
173
168
  const {
174
169
  configs = [],
@@ -307,7 +302,6 @@ const VisualChart = ({
307
302
  dateFormat={date_format}
308
303
  showTime={show_time}
309
304
  isWidgetOrder={isWidgetOrder}
310
- shouldRenderDate
311
305
  >
312
306
  <Highcharts
313
307
  options={options}
@@ -6,6 +6,7 @@ import { act, create } from 'react-test-renderer';
6
6
  import VisualChart from '../VisualChart';
7
7
  import { API } from '../../../../configs';
8
8
  import { getPusher } from '../../../../utils/Pusher';
9
+ import { flushPromises } from '../../../AllGateway/test-utils';
9
10
  import api from '../../../../utils/Apis/axios';
10
11
  import ChartAggregationOption from '../../../../commons/ChartAggregationOption';
11
12
  import DateTimeRangeChange from '../../../../commons/DateTimeRangeChange';
@@ -135,6 +136,8 @@ describe('Test LinearChartWidget', () => {
135
136
  });
136
137
  });
137
138
 
139
+ await flushPromises();
140
+
138
141
  assertChartData(chart.props.options.series[0].data, [
139
142
  [moment(1), 2],
140
143
  [moment(3), 4],