@eohjsc/react-native-smart-city 0.3.71 → 0.3.73

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 (177) hide show
  1. package/index.js +0 -2
  2. package/package.json +4 -5
  3. package/src/Images/ThreeButton/buttonCircleBig.png +0 -0
  4. package/src/Images/ThreeButton/buttonCircleSmall.png +0 -0
  5. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +1 -1
  6. package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +2 -2
  7. package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLockStyle.js +1 -1
  8. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +12 -11
  9. package/src/commons/ActionGroup/SliderRangeTemplate.js +2 -3
  10. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +1 -0
  11. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonCircle.test.js +52 -0
  12. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonDefault.test.js +52 -0
  13. package/src/commons/ActionGroup/{__test__ → ThreeButtonTemplate/__test__}/ThreeButtonTemplate.test.js +21 -8
  14. package/src/commons/ActionGroup/ThreeButtonTemplate/components/ThreeButtonCircle.js +103 -0
  15. package/src/commons/ActionGroup/ThreeButtonTemplate/components/ThreeButtonCircleStyles.js +31 -0
  16. package/src/commons/ActionGroup/ThreeButtonTemplate/components/ThreeButtonDefault.js +96 -0
  17. package/src/commons/ActionGroup/{ThreeButtonTemplateStyle.js → ThreeButtonTemplate/components/ThreeButtonDefaultStyles.js} +11 -34
  18. package/src/commons/ActionGroup/{ThreeButtonTemplate.js → ThreeButtonTemplate/index.js} +48 -51
  19. package/src/commons/ActionGroup/ThreeButtonTemplate/styles.js +27 -0
  20. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +1 -0
  21. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +39 -34
  22. package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +1 -1
  23. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +19 -10
  24. package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +0 -1
  25. package/src/commons/ActionGroup/__test__/index.test.js +24 -16
  26. package/src/commons/ActionTemplate/__test__/index.test.js +5 -1
  27. package/src/commons/AlertAction/__test__/AlertAction.test.js +2 -2
  28. package/src/commons/Automate/__test__/ItemAutomate.test.js +1 -1
  29. package/src/commons/Calendar/__test__/Calendar.test.js +3 -5
  30. package/src/commons/CameraDevice/index.js +37 -22
  31. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +3 -3
  32. package/src/commons/Dashboard/MyUnit/index.js +1 -1
  33. package/src/commons/Device/ConnectedViewHeader.js +2 -1
  34. package/src/commons/Device/DeviceAlertStatus.js +1 -1
  35. package/src/commons/Device/DisconnectedView.js +10 -14
  36. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +1 -1
  37. package/src/commons/Device/HorizontalBarChart.js +1 -1
  38. package/src/commons/Device/LinearChart/LinearChart.test.js +10 -4
  39. package/src/commons/Device/LinearChart.js +5 -1
  40. package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +1 -1
  41. package/src/commons/Device/SonosSpeaker/index.js +1 -1
  42. package/src/commons/Device/WindDirection/Compass/Compass.test.js +12 -27
  43. package/src/commons/Device/WindDirection/Compass/index.js +15 -23
  44. package/src/commons/Device/WindSpeed/__test__/Anemometer.test.js +4 -4
  45. package/src/commons/Device/WindSpeed/__test__/ChartInfo.test.js +2 -2
  46. package/src/commons/Device/__test__/ConnectedViewHeader.test.js +11 -8
  47. package/src/commons/Device/__test__/DisconnectedView.test.js +8 -45
  48. package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +1 -1
  49. package/src/commons/DisplayChecking/index.js +4 -3
  50. package/src/commons/DisplayChecking/styles.js +2 -2
  51. package/src/commons/MediaPlayer/index.js +2 -1
  52. package/src/commons/MediaPlayerDetail/MediaPlayerFull.js +1 -1
  53. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +0 -1
  54. package/src/commons/MediaPlayerDetail/index.js +2 -3
  55. package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +2 -1
  56. package/src/commons/MenuActionList/__test__/MenuActionList.test.js +1 -1
  57. package/src/commons/MenuActionList/index.js +8 -70
  58. package/src/commons/MenuActionList/styles.js +68 -0
  59. package/src/commons/Modal/__test__/ModalBottom.test.js +1 -10
  60. package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +45 -31
  61. package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +15 -13
  62. package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +12 -9
  63. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +19 -13
  64. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +5 -5
  65. package/src/commons/PreventAccess/index.js +3 -3
  66. package/src/commons/Sharing/__test__/MemberList.test.js +17 -6
  67. package/src/commons/Sharing/__test__/RowMember.test.js +0 -2
  68. package/src/commons/SubUnit/OneTap/index.js +6 -1
  69. package/src/commons/Today/__test__/Today.test.js +3 -3
  70. package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +1 -1
  71. package/src/configs/IOPinConstants.js +285 -0
  72. package/src/configs/SCConfig.js +3 -0
  73. package/src/hooks/IoT/useBluetoothConnection.js +2 -1
  74. package/src/libs/react-native-parallax-scroll-view/index.js +2 -1
  75. package/src/navigations/AllGatewayStack.js +3 -3
  76. package/src/navigations/UnitStack.js +0 -6
  77. package/src/screens/ActivityLog/__test__/index.test.js +16 -22
  78. package/src/screens/ActivityLog/index.js +2 -3
  79. package/src/screens/AddLocationMaps/index.js +1 -1
  80. package/src/screens/AddNewAction/SelectAction.js +3 -0
  81. package/src/screens/AddNewAction/SetupSensor.js +3 -3
  82. package/src/screens/AddNewAction/__test__/SelectAction.test.js +12 -0
  83. package/src/screens/AddNewAction/__test__/SetupSensor.test.js +11 -24
  84. package/src/screens/AddNewGateway/ConnectingWifiGuide.js +4 -1
  85. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectRouterGuide.test.js +0 -1
  86. package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +0 -1
  87. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +0 -1
  88. package/src/screens/AddNewGateway/SetupGatewayWifiStyles.js +2 -2
  89. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +22 -7
  90. package/src/screens/AllCamera/__test__/index.test.js +1 -1
  91. package/src/screens/AllCamera/index.js +1 -1
  92. package/src/screens/AllGateway/DetailConfigActionInternal/__test__/index.test.js +82 -0
  93. package/src/screens/AllGateway/DetailConfigActionInternal/index.js +84 -5
  94. package/src/screens/AllGateway/DetailConfigActionModbus/index.js +6 -4
  95. package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +63 -57
  96. package/src/screens/AllGateway/DeviceInternalDetail/index.js +32 -32
  97. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +40 -79
  98. package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +36 -42
  99. package/src/screens/AllGateway/DeviceZigbeeDetail/index.js +4 -4
  100. package/src/screens/AllGateway/GatewayConnectionMethods/__test__/index.test.js +4 -1
  101. package/src/screens/AllGateway/GatewayConnectionMethods/index.js +4 -2
  102. package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +49 -61
  103. package/src/screens/AllGateway/GatewayDetail/index.js +2 -1
  104. package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +2 -1
  105. package/src/screens/AllGateway/components/Information/__test__/index.test.js +2 -1
  106. package/src/screens/AllGateway/components/Information/index.js +4 -2
  107. package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +1 -1
  108. package/src/screens/AllGateway/components/TabPaneCT/index.js +1 -1
  109. package/src/screens/AllGateway/hooks/useGateway.js +1 -0
  110. package/src/screens/AllGateway/test-utils.js +20 -0
  111. package/src/screens/Device/__test__/detail.test.js +8 -3
  112. package/src/screens/Device/components/SensorDisplayItem.js +1 -5
  113. package/src/screens/EmergencyContacts/EmergencyContactsList.js +1 -4
  114. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +32 -4
  115. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -5
  116. package/src/screens/EmergencyContacts/__test__/hooks.test.js +1 -1
  117. package/src/screens/GuestInfo/__test__/index.test.js +26 -14
  118. package/src/screens/GuestInfo/index.js +2 -2
  119. package/src/screens/HanetCamera/CaptureFaceID.js +1 -1
  120. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +1 -5
  121. package/src/screens/HanetCamera/styles/captureFaceIDStyles.js +1 -1
  122. package/src/screens/PlayBackCamera/Timer.js +2 -3
  123. package/src/screens/PlayBackCamera/__test__/index.test.js +69 -48
  124. package/src/screens/ScanChipQR/components/QRScan/index.js +8 -8
  125. package/src/screens/SharedUnit/__test__/ShareUnit.test.js +20 -10
  126. package/src/screens/SharedUnit/index.js +19 -17
  127. package/src/screens/Sharing/InfoMemberUnit.js +2 -2
  128. package/src/screens/SmartAccount/Connecting/index.js +2 -2
  129. package/src/screens/SmartAccount/ListDevice/__test__/DeviceItem.test.js +4 -2
  130. package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +17 -8
  131. package/src/screens/SmartAccount/ListDevice/index.js +1 -1
  132. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +9 -6
  133. package/src/screens/SmartAccount/SuccessfullyConnected/index.js +1 -0
  134. package/src/screens/SmartAccount/__test__/Connecting.test.js +2 -1
  135. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +17 -6
  136. package/src/screens/SubUnit/EditSubUnit.js +6 -6
  137. package/src/screens/SubUnit/EditSubUnitStyles.js +2 -2
  138. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +5 -6
  139. package/src/screens/SubUnit/__test__/Detail.test.js +2 -3
  140. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +25 -10
  141. package/src/screens/Template/EditTemplate.js +13 -3
  142. package/src/screens/Template/__test__/EditTemplate.test.js +21 -15
  143. package/src/screens/Unit/Detail.js +157 -121
  144. package/src/screens/Unit/ManageUnit.js +3 -3
  145. package/src/screens/Unit/ManageUnitStyles.js +1 -1
  146. package/src/screens/Unit/SelectAddress.js +1 -1
  147. package/src/screens/Unit/__test__/Detail.test.js +40 -20
  148. package/src/screens/Unit/__test__/ManageUnit.test.js +18 -15
  149. package/src/screens/Unit/components/AutomateScript/index.js +9 -8
  150. package/src/screens/Unit/components/Header/index.js +1 -14
  151. package/src/screens/Unit/components/__test__/AutomateScript.test.js +10 -36
  152. package/src/screens/Unit/components/__test__/Header.test.js +14 -9
  153. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +4 -5
  154. package/src/utils/I18n/translations/en.json +13 -12
  155. package/src/utils/I18n/translations/vi.json +12 -11
  156. package/src/utils/Route/index.js +1 -2
  157. package/src/utils/Utils.js +62 -2
  158. package/src/commons/Explore/ActivityIndicator/index.js +0 -49
  159. package/src/commons/Explore/CityItem/index.js +0 -116
  160. package/src/commons/Explore/HeaderExplore/index.js +0 -44
  161. package/src/commons/Explore/HeaderLabel/index.js +0 -46
  162. package/src/commons/Explore/LocationItem/index.js +0 -71
  163. package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +0 -58
  164. package/src/commons/Explore/SearchBox/index.js +0 -59
  165. package/src/commons/Explore/__test__/CityItem.test.js +0 -156
  166. package/src/commons/Explore/__test__/HeaderExplore.test.js +0 -25
  167. package/src/commons/Explore/__test__/HeaderLabel.test.js +0 -33
  168. package/src/commons/Explore/__test__/LocationItem.test.js +0 -31
  169. package/src/screens/Explore/__test__/Explore.test.js +0 -43
  170. package/src/screens/Explore/index.js +0 -201
  171. package/src/screens/Unit/MyAllUnit/index.js +0 -44
  172. package/src/screens/Unit/__test__/MyAllUnit.test.js +0 -87
  173. package/src/screens/Unit/components/ListMyAllUnit/index.js +0 -162
  174. package/src/screens/Unit/components/MyAllUnit/__test__/Header.test.js +0 -117
  175. package/src/screens/Unit/components/MyAllUnit/__test__/MyAllUnit.test.js +0 -36
  176. package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +0 -54
  177. package/src/screens/Unit/components/MyAllUnit/index.js +0 -44
@@ -18,6 +18,7 @@ import { API } from '../../../../configs';
18
18
  import { DEVICE_TYPE } from '../../../../configs/Constants';
19
19
  import Detail from '../../components/Detail';
20
20
  import ModalPopupCT from '../../../../commons/ModalPopupCT';
21
+ import { flushPromises } from '../../test-utils';
21
22
 
22
23
  const mock = new MockAdapter(api.axiosInstance);
23
24
 
@@ -64,17 +65,49 @@ const headerCustomOnPressMore = async (instance) => {
64
65
  });
65
66
  };
66
67
 
67
- describe('Test GatewayDetail', () => {
68
+ const renderDetail = async () => {
68
69
  let tree;
70
+ mock
71
+ .onGet(API.DEV_MODE.MODBUS.DEVICE(1))
72
+ .reply(200, [{ id: 1, name: 'device 1' }]);
73
+ await act(async () => {
74
+ tree = await create(wrapComponent());
75
+ });
76
+ const instance = tree.root;
77
+ const detail = instance?.findByType(Detail);
78
+ const tabPaneCT = detail.findByType(TabPaneCT);
79
+ await onChangeTab(tabPaneCT, 2);
80
+ await flushPromises();
81
+ return { detail, tabPaneCT };
82
+ };
69
83
 
70
- const onChangeTab = async (tabPaneCT, index) => {
71
- const segmentedControl = tabPaneCT.findByType(SegmentedControl);
72
- await act(async () => {
73
- await segmentedControl.props.onChange({
74
- nativeEvent: { selectedSegmentIndex: index },
75
- });
84
+ const renderDetail2 = async () => {
85
+ let tree;
86
+ mock
87
+ .onGet(API.DEV_MODE.ZIGBEE.DEVICE(1))
88
+ .reply(200, [{ id: 1, name: 'device 1' }]);
89
+ await act(async () => {
90
+ tree = await create(wrapComponent());
91
+ });
92
+ const instance = tree.root;
93
+ const detail = instance?.findByType(Detail);
94
+ const tabPaneCT = detail.findByType(TabPaneCT);
95
+ await onChangeTab(tabPaneCT, 1);
96
+ await flushPromises();
97
+ return { detail, tabPaneCT };
98
+ };
99
+
100
+ const onChangeTab = async (tabPaneCT, index) => {
101
+ const segmentedControl = tabPaneCT.findByType(SegmentedControl);
102
+ await act(async () => {
103
+ await segmentedControl.props.onChange({
104
+ nativeEvent: { selectedSegmentIndex: index },
76
105
  });
77
- };
106
+ });
107
+ };
108
+
109
+ describe('Test GatewayDetail', () => {
110
+ let tree;
78
111
 
79
112
  beforeEach(() => {
80
113
  useRoute.mockReturnValue({
@@ -116,7 +149,7 @@ describe('Test GatewayDetail', () => {
116
149
  });
117
150
  const instance = tree.root;
118
151
  const detail = instance?.findByType(Detail);
119
- headerCustomOnPressMore(detail);
152
+ await headerCustomOnPressMore(detail);
120
153
  const menuActionMore = detail?.findAllByType(MenuActionMore);
121
154
  expect(menuActionMore[0].props.isVisible).toEqual(true);
122
155
  await act(async () => {
@@ -133,7 +166,7 @@ describe('Test GatewayDetail', () => {
133
166
  });
134
167
  const instance = tree.root;
135
168
  const detail = instance?.findByType(Detail);
136
- headerCustomOnPressMore(detail);
169
+ await await headerCustomOnPressMore(detail);
137
170
  const menuActionMore = detail?.findAllByType(MenuActionMore);
138
171
  expect(menuActionMore[0].props.isVisible).toEqual(true);
139
172
  await act(async () => {
@@ -153,7 +186,7 @@ describe('Test GatewayDetail', () => {
153
186
  });
154
187
  const instance = tree.root;
155
188
  const detail = instance?.findByType(Detail);
156
- headerCustomOnPressMore(detail);
189
+ await headerCustomOnPressMore(detail);
157
190
  const menuActionMore = detail?.findByType(MenuActionMore);
158
191
  expect(menuActionMore.props.isVisible).toEqual(true);
159
192
  await act(async () => {
@@ -185,16 +218,7 @@ describe('Test GatewayDetail', () => {
185
218
  });
186
219
 
187
220
  it('test render GatewayDetail onPress TabPanel zigbee', async () => {
188
- mock
189
- .onGet(API.DEV_MODE.ZIGBEE.DEVICE(1))
190
- .reply(200, [{ id: 1, name: 'device 1' }]);
191
- await act(async () => {
192
- tree = await create(wrapComponent());
193
- });
194
- const instance = tree.root;
195
- const detail = instance?.findByType(Detail);
196
- const tabPaneCT = detail.findByType(TabPaneCT);
197
- await onChangeTab(tabPaneCT, 1);
221
+ const { tabPaneCT } = await renderDetail2();
198
222
  expect(tabPaneCT.props.listTabs[1].data).toEqual([
199
223
  { id: 1, name: 'device 1' },
200
224
  ]);
@@ -202,16 +226,7 @@ describe('Test GatewayDetail', () => {
202
226
  });
203
227
 
204
228
  it('test render GatewayDetail onPress TabPanel modbus', async () => {
205
- mock
206
- .onGet(API.DEV_MODE.MODBUS.DEVICE(1))
207
- .reply(200, [{ id: 1, name: 'device 1' }]);
208
- await act(async () => {
209
- tree = await create(wrapComponent());
210
- });
211
- const instance = tree.root;
212
- const detail = instance?.findByType(Detail);
213
- const tabPaneCT = detail.findByType(TabPaneCT);
214
- await onChangeTab(tabPaneCT, 2);
229
+ const { tabPaneCT } = await renderDetail();
215
230
  expect(tabPaneCT.props.listTabs[2].data).toEqual([
216
231
  { id: 1, name: 'device 1' },
217
232
  ]);
@@ -243,16 +258,7 @@ describe('Test GatewayDetail', () => {
243
258
  });
244
259
 
245
260
  it('test render GatewayDetail onPress TabPanel zigbee onPressRow', async () => {
246
- mock
247
- .onGet(API.DEV_MODE.ZIGBEE.DEVICE(1))
248
- .reply(200, [{ id: 1, name: 'device 1' }]);
249
- await act(async () => {
250
- tree = await create(wrapComponent());
251
- });
252
- const instance = tree.root;
253
- const detail = instance?.findByType(Detail);
254
- const tabPaneCT = detail.findByType(TabPaneCT);
255
- await onChangeTab(tabPaneCT, 1);
261
+ const { detail } = await renderDetail2();
256
262
  await act(async () => {
257
263
  await detail.props.onPressRow(1);
258
264
  });
@@ -266,16 +272,7 @@ describe('Test GatewayDetail', () => {
266
272
  });
267
273
 
268
274
  it('test render GatewayDetail onPress TabPanel modbus onPressRow', async () => {
269
- mock
270
- .onGet(API.DEV_MODE.MODBUS.DEVICE(1))
271
- .reply(200, [{ id: 1, name: 'device 1' }]);
272
- await act(async () => {
273
- tree = await create(wrapComponent());
274
- });
275
- const instance = tree.root;
276
- const detail = instance?.findByType(Detail);
277
- const tabPaneCT = detail.findByType(TabPaneCT);
278
- await onChangeTab(tabPaneCT, 2);
275
+ const { detail } = await renderDetail();
279
276
 
280
277
  await act(async () => {
281
278
  await detail.props.onPressRow(1);
@@ -314,16 +311,7 @@ describe('Test GatewayDetail', () => {
314
311
  });
315
312
 
316
313
  it('test render GatewayDetail onPress TabPanel zigbee onRefresh', async () => {
317
- mock
318
- .onGet(API.DEV_MODE.ZIGBEE.DEVICE(1))
319
- .reply(200, [{ id: 1, name: 'device 1' }]);
320
- await act(async () => {
321
- tree = await create(wrapComponent());
322
- });
323
- const instance = tree.root;
324
- const detail = instance?.findByType(Detail);
325
- const tabPaneCT = detail.findByType(TabPaneCT);
326
- await onChangeTab(tabPaneCT, 1);
314
+ const { detail, tabPaneCT } = await renderDetail2();
327
315
  await act(async () => {
328
316
  await detail.props.onRefresh();
329
317
  });
@@ -179,10 +179,11 @@ const GatewayDetail = () => {
179
179
  isInternal,
180
180
  isZigbee,
181
181
  isModbus,
182
+ board: item?.board,
182
183
  }
183
184
  );
184
185
  },
185
- [isModbus, isZigbee, gatewayId, isInternal, navigate]
186
+ [navigate, isInternal, isZigbee, isModbus, gatewayId, item]
186
187
  );
187
188
 
188
189
  const title = useMemo(() => {
@@ -14,6 +14,7 @@ import api from '../../../../utils/Apis/axios';
14
14
  import GatewayInfo from '..';
15
15
  import t from '../../../../hooks/Common/useTranslations';
16
16
  import ModalPopupCT from '../../../../commons/ModalPopupCT';
17
+ import { SCConfig } from '../../../../configs';
17
18
 
18
19
  const mockPop = jest.fn();
19
20
  const mock = new MockAdapter(api.axiosInstance);
@@ -93,7 +94,7 @@ describe('Test GatewayInfo', () => {
93
94
  const btnDelete = buttonDelete(instance);
94
95
  expect(headerCustom).toHaveLength(1);
95
96
  expect(alert.props.children[1].props.children.props.children).toEqual(
96
- t('go_to_eoh_web_to_see_firmware')
97
+ t('go_to_eoh_web_to_see_firmware', { appName: SCConfig.appName })
97
98
  );
98
99
  expect(flatList).toHaveLength(1);
99
100
  const textConnect = btnConnect.findAllByType(Text);
@@ -7,6 +7,7 @@ import { mockSCStore } from '../../../../../context/mockStore';
7
7
  import { HeaderCustom } from '../../../../../commons';
8
8
  import Information from '../../../components/Information';
9
9
  import { AccessibilityLabel } from '../../../../../configs/Constants';
10
+ import { getTranslate } from '../../../../../utils/I18n';
10
11
 
11
12
  const mockHandleDeleteGateway = jest.fn();
12
13
  const mockHandleConnectionMethods = jest.fn();
@@ -51,7 +52,7 @@ describe('Test Information', () => {
51
52
  expect(headerCustom).toHaveLength(1);
52
53
  expect(flatList).toHaveLength(1);
53
54
  expect(viewAlert.props.children[1].props.children.props.children).toEqual(
54
- 'Go to EoH web to see firmware configuration'
55
+ getTranslate('en', 'go_to_eoh_web_to_see_firmware', { appName: 'E-Ra' })
55
56
  );
56
57
  const buttonConnect = instance.findByProps({
57
58
  accessibilityLabel:
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, memo } from 'react';
2
2
  import { TouchableOpacity, View, Image, FlatList } from 'react-native';
3
- import { Colors } from '../../../../configs';
3
+ import { Colors, SCConfig } from '../../../../configs';
4
4
  import t from '../../../../hooks/Common/useTranslations';
5
5
  import { Text, HeaderCustom } from '../../../../commons';
6
6
  import Images from '../../../../configs/Images';
@@ -51,7 +51,9 @@ const Information = ({
51
51
  <Image source={Images.inforCode} />
52
52
  <View style={styles.flex1}>
53
53
  <Text type="H4" style={styles.marginLeft16}>
54
- {t('go_to_eoh_web_to_see_firmware')}
54
+ {t('go_to_eoh_web_to_see_firmware', {
55
+ appName: SCConfig.appName,
56
+ })}
55
57
  </Text>
56
58
  </View>
57
59
  </View>
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { create, act } from 'react-test-renderer';
3
3
  import SegmentedControl from '@react-native-community/segmented-control';
4
- import Carousel from 'react-native-snap-carousel';
4
+ import Carousel from 'react-native-new-snap-carousel';
5
5
 
6
6
  import { SCProvider } from '../../../../../context';
7
7
  import { mockSCStore } from '../../../../../context/mockStore';
@@ -7,7 +7,7 @@ import {
7
7
  RefreshControl,
8
8
  } from 'react-native';
9
9
  import SegmentedControl from '@react-native-community/segmented-control';
10
- import Carousel from 'react-native-snap-carousel';
10
+ import Carousel from 'react-native-new-snap-carousel';
11
11
 
12
12
  import { Text, StatusBox } from '../../../../commons';
13
13
  import { Constants } from '../../../../configs';
@@ -151,6 +151,7 @@ export const useGateway = () => {
151
151
  success &&
152
152
  setDetailDeviceZigbee((prev) => ({ ...prev, configs: data }));
153
153
  }
154
+
154
155
  if (isAction) {
155
156
  const { success, data } = await axiosGet(
156
157
  API.DEV_MODE.ZIGBEE.ACTION(gatewayId, deviceId)
@@ -0,0 +1,20 @@
1
+ import Detail from './components/Detail';
2
+ import TabPaneCT from './components/TabPaneCT';
3
+ import SegmentedControl from '@react-native-community/segmented-control';
4
+ import { act } from 'react-test-renderer';
5
+
6
+ export const fetchGatewayCT = async (tree) => {
7
+ const instance = tree.root;
8
+ const detail = instance?.findByType(Detail);
9
+ const tabPaneCT = detail.findByType(TabPaneCT);
10
+ const segmentedControl = tabPaneCT.findByType(SegmentedControl);
11
+ await act(async () => {
12
+ await segmentedControl.props.onChange({
13
+ nativeEvent: { selectedSegmentIndex: 1 },
14
+ });
15
+ });
16
+ return { tabPaneCT, detail };
17
+ };
18
+
19
+ export const flushPromises = () =>
20
+ new Promise((resolve) => setImmediate(resolve));
@@ -136,9 +136,7 @@ describe('test DeviceDetail', () => {
136
136
  const setState = jest.fn();
137
137
  const useLayoutEffectSpy = jest.spyOn(React, 'useLayoutEffect');
138
138
  useLayoutEffectSpy.mockImplementation(() => setState);
139
- });
140
-
141
- afterEach(() => {
139
+ mock.reset();
142
140
  mockedNavigate.mockClear();
143
141
  });
144
142
 
@@ -333,10 +331,17 @@ describe('test DeviceDetail', () => {
333
331
  });
334
332
 
335
333
  it('ButtonPopup render', async () => {
334
+ mock.onPut(API.EMERGENCY_BUTTON.RESOLVE(0)).reply(200);
336
335
  await act(async () => {
337
336
  tree = await create(wrapComponent(store, account, route));
338
337
  });
339
338
  const instance = tree.root;
339
+
340
+ const alertAction = instance.findByType(AlertAction);
341
+ await act(async () => {
342
+ await alertAction.props.rightButtonClick();
343
+ await alertAction.props.onHide();
344
+ });
340
345
  const buttonPopupTitle = instance.find(
341
346
  (el) =>
342
347
  el.props.accessibilityLabel ===
@@ -162,11 +162,7 @@ export const SensorDisplayItem = ({
162
162
  return <EmergencyButton emergency={emergency} />;
163
163
  }
164
164
  case 'info':
165
- return (
166
- <CardDevMode id={idTemplate}>
167
- <FooterInfo data={configuration} />
168
- </CardDevMode>
169
- );
165
+ return <FooterInfo data={configuration} />;
170
166
  case 'smart_ir':
171
167
  return <SmartIr item={item} />;
172
168
  default:
@@ -57,9 +57,6 @@ export const EmergencyContactsList = ({ route }) => {
57
57
  group.id,
58
58
  ]);
59
59
 
60
- const onAddNew = useCallback(() => {
61
- setShowAddnewModal();
62
- }, [setShowAddnewModal]);
63
60
  const onItemAddClick = useCallback(
64
61
  (item) => {
65
62
  item.route && navigate(item.route, item.data || {});
@@ -108,7 +105,7 @@ export const EmergencyContactsList = ({ route }) => {
108
105
  subtext={t('emergency_max_contacts', {
109
106
  number: MAX_EMERGENCY_CONTACTS.toString(),
110
107
  })}
111
- onPress={onAddNew}
108
+ onPress={setShowAddnewModal}
112
109
  />
113
110
  {!!listContacts.length &&
114
111
  listContacts.map((contact, index) => (
@@ -12,6 +12,7 @@ import { getTranslate } from '../../../utils/I18n';
12
12
  import { SCProvider } from '../../../context';
13
13
  import { mockSCStore } from '../../../context/mockStore';
14
14
  import api from '../../../utils/Apis/axios';
15
+ import { RowUser } from '../../../commons/RowUser';
15
16
 
16
17
  const mock = new MockAdapter(api.axiosInstance);
17
18
 
@@ -43,12 +44,10 @@ describe('test EmergencyContactList', () => {
43
44
  group: 1,
44
45
  },
45
46
  };
46
- });
47
- let tree;
48
-
49
- afterEach(() => {
50
47
  mockedNavigate.mockClear();
48
+ mock.reset();
51
49
  });
50
+ let tree;
52
51
 
53
52
  it('handleRemove', async () => {
54
53
  await act(async () => {
@@ -103,7 +102,11 @@ describe('test EmergencyContactList', () => {
103
102
  tree = await create(wrapComponent(route));
104
103
  });
105
104
  const instance = tree.root;
105
+ const rowUsers = instance.findAllByType(RowUser);
106
106
 
107
+ await act(async () => {
108
+ rowUsers[0].props.onPress();
109
+ });
107
110
  const buttons = instance.findAllByType(TouchableOpacity);
108
111
  const buttonsMenuActionList = buttons.filter(
109
112
  (item) =>
@@ -113,11 +116,36 @@ describe('test EmergencyContactList', () => {
113
116
  expect(buttonsMenuActionList).toHaveLength(2);
114
117
  });
115
118
 
119
+ it('delete user', async () => {
120
+ mock.onGet(API.EMERGENCY_BUTTON.CONTACTS()).reply(200, [
121
+ {
122
+ id: 1,
123
+ },
124
+ ]);
125
+ await act(async () => {
126
+ tree = await create(wrapComponent(route));
127
+ });
128
+ const instance = tree.root;
129
+ const rowUsers = instance.findAllByType(RowUser);
130
+ expect(rowUsers).toHaveLength(2);
131
+ const remove = rowUsers[1].findByType(TouchableOpacity);
132
+ await act(async () => {
133
+ remove.props.onPress();
134
+ });
135
+ const alertAction = instance.findByType(AlertAction);
136
+ expect(alertAction.props.visible).toBeTruthy();
137
+ });
138
+
116
139
  it('onItemAddClick select unit members', async () => {
117
140
  await act(async () => {
118
141
  tree = await create(wrapComponent(route));
119
142
  });
120
143
  const instance = tree.root;
144
+ const rowUsers = instance.findAllByType(RowUser);
145
+
146
+ await act(async () => {
147
+ rowUsers[0].props.onPress();
148
+ });
121
149
 
122
150
  const buttons = instance.findAllByType(TouchableOpacity);
123
151
  const buttonsMenuActionList = buttons.filter(
@@ -59,11 +59,13 @@ describe('test EmergencyContactsSelectContacts', () => {
59
59
 
60
60
  it('render emergencyContactsSelectContacts success', async () => {
61
61
  jest.useFakeTimers();
62
- mock.onGet(API.SHARE.UNITS_MEMBERS(1, 1)).reply(200, {
63
- id: 1,
64
- name: 'test',
65
- phone_number: 1,
66
- });
62
+ mock.onGet(API.SHARE.UNITS_MEMBERS(1, 1)).reply(200, [
63
+ {
64
+ id: 1,
65
+ name: 'test',
66
+ phone_number: 1,
67
+ },
68
+ ]);
67
69
  await act(async () => {
68
70
  tree = await create(wrapComponent(route));
69
71
  });
@@ -50,7 +50,7 @@ describe('Test EmergencyContacts', () => {
50
50
  const { result } = renderHook(() => useAlertRemoveEmergencyContact(), {
51
51
  wrapper,
52
52
  });
53
- await act(() => {
53
+ await act(async () => {
54
54
  result.current.stateAlertRemoveContact = {
55
55
  ...result.current.stateAlertRemoveContact,
56
56
  visible: true,
@@ -81,6 +81,12 @@ describe('Test GuestInfo', () => {
81
81
  const texts = instance.findAllByType(Text);
82
82
  expect(texts[4].props.children).toBe(data.user.id);
83
83
  expect(texts[6].props.children).toBe('Always');
84
+
85
+ const rows = instance.findAllByType(RowGuestInfo);
86
+ // show AccessScheduleSheet
87
+ await act(async () => {
88
+ await rows[1].props.onPress();
89
+ });
84
90
  const accessScheduleItems = instance.findAllByType(AccessScheduleItem);
85
91
  const radioButtons = getButton(
86
92
  instance,
@@ -115,32 +121,24 @@ describe('Test GuestInfo', () => {
115
121
  tree = await create(wrapComponent(route));
116
122
  });
117
123
  const instance = tree.root;
118
- const rows = instance.findAllByType(RowGuestInfo);
119
124
  const accessScheduleSheet = instance.find(
120
125
  (el) =>
121
126
  el.props.accessibilityLabel === AccessibilityLabel.ACCESS_SCHEDULE_SHEET
122
127
  );
123
128
  const dateTimePicker = instance.findByType(WheelDateTimePicker);
124
- const radioButtons = getButton(
125
- instance,
126
- AccessibilityLabel.ACCESS_SCHEDULE_RADIO_BUTTON,
127
- true
128
- );
129
- const accessScheduleSheetDone = getButton(
130
- instance,
131
- `${AccessibilityLabel.ACCESS_SCHEDULE_SHEET}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
132
- );
133
- const dateTimePickerDone = getButton(
134
- instance,
135
- `${AccessibilityLabel.WHEEL_DATE_TIME_PICKER_BUTTON}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
136
- );
137
129
 
130
+ const rows = instance.findAllByType(RowGuestInfo);
138
131
  // show AccessScheduleSheet
139
132
  await act(async () => {
140
133
  await rows[1].props.onPress();
141
134
  });
142
135
  expect(accessScheduleSheet.props.isVisible).toBeTruthy();
143
136
 
137
+ const radioButtons = getButton(
138
+ instance,
139
+ AccessibilityLabel.ACCESS_SCHEDULE_RADIO_BUTTON,
140
+ true
141
+ );
144
142
  // select recurring
145
143
  await act(async () => {
146
144
  await radioButtons[1].props.onPress();
@@ -159,6 +157,11 @@ describe('Test GuestInfo', () => {
159
157
  expect(accessScheduleSheet.props.isVisible).toBeFalsy();
160
158
  expect(dateTimePicker.props.isVisible).toBeTruthy();
161
159
 
160
+ const dateTimePickerDone = getButton(
161
+ instance,
162
+ `${AccessibilityLabel.WHEEL_DATE_TIME_PICKER_BUTTON}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
163
+ );
164
+
162
165
  // WheelDateTimePicker -> click done
163
166
  await act(async () => {
164
167
  await dateTimePickerDone.props.onPress();
@@ -167,6 +170,10 @@ describe('Test GuestInfo', () => {
167
170
  expect(accessScheduleSheet.props.isVisible).toBeTruthy();
168
171
  expect(dateTimePicker.props.isVisible).toBeFalsy();
169
172
 
173
+ const accessScheduleSheetDone = getButton(
174
+ instance,
175
+ `${AccessibilityLabel.ACCESS_SCHEDULE_SHEET}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
176
+ );
170
177
  // AccessScheduleSheet -> click done
171
178
  await act(async () => {
172
179
  await accessScheduleSheetDone.props.onPress();
@@ -182,6 +189,11 @@ describe('Test GuestInfo', () => {
182
189
  tree = await create(wrapComponent(route));
183
190
  });
184
191
  const instance = tree.root;
192
+ const rows = instance.findAllByType(RowGuestInfo);
193
+ await act(async () => {
194
+ await rows[1].props.onPress();
195
+ });
196
+
185
197
  const saveButton = instance.find(
186
198
  (el) =>
187
199
  el.props.accessibilityLabel ===
@@ -12,7 +12,7 @@ import Text from '../../commons/Text';
12
12
  import { useBoolean } from '../../hooks/Common';
13
13
  import { axiosGet, axiosPut } from '../../utils/Apis/axios';
14
14
 
15
- import { API, Colors } from '../../configs';
15
+ import { API, Colors, SCConfig } from '../../configs';
16
16
  import {
17
17
  ACCESS_SCHEDULE_PROPERTIES,
18
18
  typeMaps,
@@ -123,7 +123,7 @@ const GuestInfo = ({ route }) => {
123
123
  )}
124
124
  {guest?.id && (
125
125
  <RowGuestInfo
126
- textLeft={t('eoh_account_id')}
126
+ textLeft={t('eoh_account_id', { appName: SCConfig.appName })}
127
127
  textRight={guest.id}
128
128
  />
129
129
  )}
@@ -127,7 +127,7 @@ const CaptureFaceID = ({ route }) => {
127
127
  return <LoadingCamera />;
128
128
  }
129
129
  return (
130
- <View style={styles.maskOutter}>
130
+ <View style={styles.maskOuter}>
131
131
  <FaceFrameSvg />
132
132
  </View>
133
133
  );
@@ -63,7 +63,6 @@ describe('Test HanetMemberInfo', () => {
63
63
  });
64
64
  const instance = tree.root;
65
65
  const touches = instance.findAllByType(TouchableOpacity);
66
- expect(touches).toHaveLength(7);
67
66
  const alertAction = instance.findByType(AlertAction);
68
67
  // open alert action
69
68
  await act(async () => {
@@ -85,7 +84,6 @@ describe('Test HanetMemberInfo', () => {
85
84
  });
86
85
  const instance = tree.root;
87
86
  const touches = instance.findAllByType(TouchableOpacity);
88
- expect(touches).toHaveLength(7);
89
87
  const alertAction = instance.findByType(AlertAction);
90
88
 
91
89
  // open alert action
@@ -118,7 +116,6 @@ describe('Test HanetMemberInfo', () => {
118
116
  });
119
117
  const instance = tree.root;
120
118
  const touches = instance.findAllByType(TouchableOpacity);
121
- expect(touches).toHaveLength(7);
122
119
 
123
120
  await act(async () => {
124
121
  await touches[1].props.onPress();
@@ -138,7 +135,7 @@ describe('Test HanetMemberInfo', () => {
138
135
  });
139
136
  const instance = tree.root;
140
137
  const touches = instance.findAllByType(TouchableOpacity);
141
- expect(touches).toHaveLength(7);
138
+
142
139
  await act(async () => {
143
140
  await touches[1].props.onPress();
144
141
  });
@@ -161,7 +158,6 @@ describe('Test HanetMemberInfo', () => {
161
158
  });
162
159
  const instance = tree.root;
163
160
  const touches = instance.findAllByType(TouchableOpacity);
164
- expect(touches).toHaveLength(7);
165
161
 
166
162
  // press set face id
167
163
  await act(async () => {
@@ -24,7 +24,7 @@ export default StyleSheet.create({
24
24
  alignItems: 'center',
25
25
  justifyContent: 'flex-end',
26
26
  },
27
- maskOutter: {
27
+ maskOuter: {
28
28
  position: 'absolute',
29
29
  alignSelf: 'center',
30
30
  top: '12%',
@@ -45,11 +45,10 @@ const Timer = ({
45
45
  width: spacerWidth,
46
46
  }}
47
47
  />
48
- {data.map((i) => {
48
+ {data.map((i, index) => {
49
49
  return (
50
- <View>
50
+ <View key={i}>
51
51
  <View
52
- key={i}
53
52
  style={{
54
53
  backgroundColor: i % step === 0 ? stepColor : normalColor,
55
54
  height: i % step === 0 ? stepHeight : normalHeight,