@eohjsc/react-native-smart-city 0.5.9 → 0.6.0-rc2

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 (305) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +8 -10
  3. package/package.json +52 -69
  4. package/src/commons/Action/__test__/ItemQuickAction.test.js +2 -2
  5. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
  6. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +3 -3
  7. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +3 -3
  8. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
  9. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
  10. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +0 -15
  11. package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +2 -2
  12. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -2
  13. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +2 -2
  14. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +5 -5
  15. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +3 -3
  16. package/src/commons/ActionGroup/TerminalBoxTemplate.js +2 -2
  17. package/src/commons/ActionGroup/TextBoxTemplate.js +2 -2
  18. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonTemplate.test.js +4 -4
  19. package/src/commons/ActionGroup/TimerActionTemplate.js +3 -4
  20. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
  21. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +2 -9
  22. package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +4 -11
  23. package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +2 -9
  24. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +4 -18
  25. package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +2 -2
  26. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +1 -8
  27. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +0 -7
  28. package/src/commons/ActionGroup/__test__/SwitchButtonTemplate.test.js +4 -15
  29. package/src/commons/ActionGroup/__test__/TerminalBoxTemplate.test.js +0 -7
  30. package/src/commons/ActionGroup/__test__/TextBoxTemplate.test.js +1 -8
  31. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +1 -8
  32. package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +1 -8
  33. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +2 -9
  34. package/src/commons/ActionGroup/__test__/index.test.js +14 -21
  35. package/src/commons/ActionTemplate/__test__/index.test.js +2 -0
  36. package/src/commons/ActionTemplate/__test__/utils.js +21 -0
  37. package/src/commons/ActionTemplate/index.js +1 -2
  38. package/src/commons/BackDefault/index.js +2 -2
  39. package/src/commons/ButtonPopup/index.js +2 -2
  40. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +1 -12
  41. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +27 -20
  42. package/src/commons/Dashboard/MyUnit/index.js +0 -1
  43. package/src/commons/DateTimeRangeChange/DateTimeButton.js +2 -2
  44. package/src/commons/Device/ConnectedViewHeader.js +2 -2
  45. package/src/commons/Device/DisconnectedView.js +2 -2
  46. package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
  47. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +2 -2
  48. package/src/commons/Device/FlatListItems.js +3 -3
  49. package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
  50. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -11
  51. package/src/commons/Device/HorizontalBarChart.js +1 -1
  52. package/src/commons/Device/ItemAddNew/index.js +2 -2
  53. package/src/commons/Device/ItemDevice.js +2 -2
  54. package/src/commons/Device/PowerConsumptionChart.js +154 -0
  55. package/src/commons/Device/SonosSpeaker/index.js +3 -3
  56. package/src/commons/Device/WaterPurifierStatus/AlertStatusMachine.js +2 -2
  57. package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +2 -6
  58. package/src/commons/DisplayChecking/index.js +2 -2
  59. package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
  60. package/src/commons/EmergencyButton/AlertSent.js +2 -2
  61. package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
  62. package/src/commons/Form/CurrencyInput.js +1 -15
  63. package/src/commons/Header/HeaderCustom.js +3 -3
  64. package/src/commons/HeaderAni/index.js +2 -2
  65. package/src/commons/IconComponent/index.js +3 -3
  66. package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +1 -1
  67. package/src/commons/MenuActionList/__test__/MenuActionList.test.js +1 -0
  68. package/src/commons/NavBar/index.js +2 -2
  69. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
  70. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +1 -13
  71. package/src/commons/Processing/__test__/Connecting.test.js +3 -14
  72. package/src/commons/SearchLocation/index.js +2 -2
  73. package/src/commons/SelectActionCard/index.js +2 -2
  74. package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +1 -18
  75. package/src/commons/SelectSubUnit/index.js +2 -2
  76. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +1 -13
  77. package/src/commons/Sharing/BtnRemoveMember.js +2 -2
  78. package/src/commons/Sharing/StationDevicePermissions.js +2 -2
  79. package/src/commons/Sharing/WrapHeaderScrollable.js +1 -1
  80. package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -1
  81. package/src/commons/SubUnit/DeviceTemplate/ConfigAndEvaluation/ConfigAndEvaluation.js +2 -2
  82. package/src/commons/SubUnit/DeviceTemplate/ConfigValue/ConfigValue.js +2 -2
  83. package/src/commons/SubUnit/DeviceTemplate/EvaluationOverConfig/EvaluationOverConfig.js +2 -2
  84. package/src/commons/SubUnit/Item/index.js +2 -2
  85. package/src/commons/SubUnit/OneTap/ItemOneTap.js +2 -2
  86. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +11 -8
  87. package/src/commons/SubUnit/__test__/Favorites.test.js +1 -13
  88. package/src/commons/SubUnit/__test__/ShortDetail.test.js +5 -16
  89. package/src/commons/Tabbar/__test__/index.test.js +0 -11
  90. package/src/commons/Unit/HeaderUnit/index.js +4 -4
  91. package/src/commons/Unit/SharedUnit.js +5 -5
  92. package/src/commons/Unit/__test__/HeaderUnit.test.js +3 -15
  93. package/src/commons/Unit/__test__/SharedUnit.test.js +94 -105
  94. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +11 -30
  95. package/src/commons/UnitSummary/ConfigHistoryChart/index.js +6 -61
  96. package/src/commons/Widgets/IFrame/IFrame.js +54 -0
  97. package/src/commons/Widgets/IFrame/IFrameStyles.js +35 -0
  98. package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +74 -0
  99. package/src/commons/Widgets/IFrame/index.js +0 -0
  100. package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +163 -0
  101. package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfigStyles.js +9 -0
  102. package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +284 -0
  103. package/src/commons/Widgets/IFrameWithConfig/index.js +0 -0
  104. package/src/commons/Widgets/Widget.js +0 -0
  105. package/src/commons/Widgets/index.js +0 -0
  106. package/src/configs/Constants.js +5 -0
  107. package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +4 -15
  108. package/src/hooks/Common/useDevicesStatus.js +23 -23
  109. package/src/hooks/IoT/__test__/useRemoteControl.test.js +1 -1
  110. package/src/hooks/IoT/__test__/useWatchConfigs.test.js +0 -7
  111. package/src/iot/RemoteControl/HomeAssistant.js +1 -1
  112. package/src/iot/RemoteControl/__test__/Bluetooth.test.js +234 -232
  113. package/src/navigations/AutomateStack.js +2 -2
  114. package/src/navigations/EmergencyContactsStack.js +2 -2
  115. package/src/navigations/SharedStack.js +2 -2
  116. package/src/navigations/UnitStack.js +2 -2
  117. package/src/screens/ActivityLog/hooks/index.js +7 -4
  118. package/src/screens/ActivityLog/index.js +2 -2
  119. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +4 -21
  120. package/src/screens/AddCommon/__test__/SelectUnit.test.js +7 -19
  121. package/src/screens/AddLocationMaps/__test__/index.test.js +3 -13
  122. package/src/screens/AddLocationMaps/index.js +4 -4
  123. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +3 -20
  124. package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +11 -18
  125. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +4 -21
  126. package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
  127. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +3 -3
  128. package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +0 -17
  129. package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +4 -19
  130. package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +3 -15
  131. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +31 -51
  132. package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +9 -22
  133. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +12 -19
  134. package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +6 -16
  135. package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +4 -15
  136. package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +3 -3
  137. package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +18 -10
  138. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +1 -1
  139. package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +12 -9
  140. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +12 -9
  141. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +7 -21
  142. package/src/screens/AddNewGateway/hooks/__Tests__/index.test.js +1 -10
  143. package/src/screens/AllGateway/DetailConfigActionInternal/__test__/index.test.js +0 -20
  144. package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +7 -24
  145. package/src/screens/AllGateway/DeviceGatewayInfo/__test__/index.test.js +0 -17
  146. package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +84 -100
  147. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +64 -82
  148. package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +36 -55
  149. package/src/screens/AllGateway/GatewayConnectionMethods/__test__/index.test.js +9 -18
  150. package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +10 -37
  151. package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +7 -32
  152. package/src/screens/AllGateway/__test__/index.test.js +1 -14
  153. package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +0 -12
  154. package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +1 -13
  155. package/src/screens/AllGateway/components/TabPaneCT/index.js +1 -1
  156. package/src/screens/AllGateway/hooks/__test__/index.test.js +1 -8
  157. package/src/screens/AllGateway/test-utils.js +1 -1
  158. package/src/screens/Automate/AddNewAction/NewActionWrapper.js +2 -2
  159. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +27 -28
  160. package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +3 -3
  161. package/src/screens/Automate/AddNewAction/__test__/ChooseConfig.test.js +8 -5
  162. package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +2 -2
  163. package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +1 -18
  164. package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +17 -15
  165. package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +4 -4
  166. package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +38 -55
  167. package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +0 -18
  168. package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +1 -19
  169. package/src/screens/Automate/EditActionsList/__tests__/index.test.js +14 -11
  170. package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +3 -3
  171. package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +2 -2
  172. package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +2 -2
  173. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +33 -25
  174. package/src/screens/Automate/ScriptDetail/index.js +5 -6
  175. package/src/screens/Automate/SetSchedule/__test__/index.test.js +4 -4
  176. package/src/screens/Automate/SetSchedule/components/RowItem.js +3 -3
  177. package/src/screens/Automate/__test__/MultiUnits.test.js +5 -5
  178. package/src/screens/Automate/__test__/index.test.js +6 -6
  179. package/src/screens/Automate/index.js +2 -2
  180. package/src/screens/ChangePosition/__test__/index.test.js +1 -14
  181. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +0 -12
  182. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +1 -11
  183. package/src/screens/Device/EditDevice/index.js +2 -2
  184. package/src/screens/Device/__test__/detail.test.js +11 -11
  185. package/src/screens/Device/__test__/sensorDisplayItem.test.js +3 -15
  186. package/src/screens/Device/components/SensorDisplayItem.js +23 -5
  187. package/src/screens/Device/components/__test__/VisualChart.test.js +2 -9
  188. package/src/screens/Device/detail.js +11 -10
  189. package/src/screens/Drawer/Drawer.test.js +3 -11
  190. package/src/screens/Drawer/index.js +3 -4
  191. package/src/screens/EmergencyContacts/EmergencyContactsList.js +4 -8
  192. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -3
  193. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +4 -17
  194. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +3 -14
  195. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +0 -10
  196. package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
  197. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +4 -17
  198. package/src/screens/GuestInfo/__test__/index.test.js +0 -11
  199. package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
  200. package/src/screens/GuestInfo/index.js +2 -2
  201. package/src/screens/HanetCamera/Detail.js +2 -2
  202. package/src/screens/HanetCamera/ManageAccess.js +3 -4
  203. package/src/screens/HanetCamera/MemberInfo.js +4 -4
  204. package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +2 -16
  205. package/src/screens/HanetCamera/__test__/Detail.test.js +1 -12
  206. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +5 -16
  207. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +5 -18
  208. package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
  209. package/src/screens/ManageAccess/__test__/ManageAccess.test.js +3 -19
  210. package/src/screens/ManageAccess/index.js +3 -3
  211. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +5 -5
  212. package/src/screens/Notification/__test__/NotificationItem.test.js +9 -19
  213. package/src/screens/Notification/index.js +3 -3
  214. package/src/screens/PlayBackCamera/Styles/index.js +2 -4
  215. package/src/screens/PlayBackCamera/Timer.js +65 -47
  216. package/src/screens/PlayBackCamera/__test__/index.test.js +32 -33
  217. package/src/screens/PlayBackCamera/index.js +115 -112
  218. package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +0 -11
  219. package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
  220. package/src/screens/SelectUnit/__test__/index.test.js +1 -21
  221. package/src/screens/SelectUnit/index.js +2 -2
  222. package/src/screens/SharedUnit/TabHeader.js +2 -2
  223. package/src/screens/Sharing/Components/EndDevice.js +3 -3
  224. package/src/screens/Sharing/UnitMemberList.js +2 -2
  225. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +9 -4
  226. package/src/screens/Sharing/__test__/SelectShareDevice.test.js +2 -15
  227. package/src/screens/Sharing/__test__/SelectUser.test.js +2 -22
  228. package/src/screens/Sharing/__test__/UnitMemberList.test.js +2 -2
  229. package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +4 -17
  230. package/src/screens/Sharing/hooks/__test__/index.test.js +2 -13
  231. package/src/screens/SmartAccount/Connecting/index.js +0 -2
  232. package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +3 -18
  233. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +11 -21
  234. package/src/screens/SmartAccount/SuccessfullyConnected/index.js +3 -4
  235. package/src/screens/SmartAccount/__test__/Connecting.test.js +30 -36
  236. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +12 -21
  237. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +7 -17
  238. package/src/screens/SmartIr/__test__/SelectBrand.test.js +1 -11
  239. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +1 -12
  240. package/src/screens/SmartIr/__test__/SmartIr.test.js +3 -11
  241. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +3 -3
  242. package/src/screens/SmartIr/components/SelectBrand.js +2 -2
  243. package/src/screens/SubUnit/AddSubUnit.js +1 -0
  244. package/src/screens/SubUnit/EditSubUnit.js +3 -2
  245. package/src/screens/SubUnit/ManageSubUnit.js +4 -5
  246. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -31
  247. package/src/screens/SubUnit/__test__/Detail.test.js +4 -28
  248. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +12 -30
  249. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +2 -2
  250. package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +0 -12
  251. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +7 -20
  252. package/src/screens/Template/__test__/EditTemplate.test.js +2 -13
  253. package/src/screens/Template/__test__/GatewayList.test.js +0 -9
  254. package/src/screens/Template/__test__/detail.test.js +4 -4
  255. package/src/screens/Template/__test__/index.test.js +1 -12
  256. package/src/screens/Template/detail.js +2 -2
  257. package/src/screens/Unit/SelectAddToFavorites.js +2 -2
  258. package/src/screens/Unit/SelectAddress.js +4 -4
  259. package/src/screens/Unit/SmartAccountItem.js +2 -2
  260. package/src/screens/Unit/Summaries.js +3 -2
  261. package/src/screens/Unit/__test__/AddMenu.test.js +5 -2
  262. package/src/screens/Unit/__test__/CheckSendEmail.test.js +0 -12
  263. package/src/screens/Unit/__test__/ChooseLocation.test.js +1 -4
  264. package/src/screens/Unit/__test__/Detail.test.js +5 -5
  265. package/src/screens/Unit/__test__/ManageUnit.test.js +2 -17
  266. package/src/screens/Unit/__test__/MoreMenu.test.js +1 -11
  267. package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +3 -14
  268. package/src/screens/Unit/__test__/SelectAddress.test.js +4 -17
  269. package/src/screens/Unit/__test__/SmartAccount.test.js +14 -11
  270. package/src/screens/Unit/__test__/SmartAccountItem.test.js +0 -11
  271. package/src/screens/Unit/__test__/Summaries.test.js +2 -14
  272. package/src/screens/Unit/components/AutomateScript/index.js +2 -2
  273. package/src/screens/Unit/components/ButtonWrapper/index.js +3 -4
  274. package/src/screens/Unit/components/Header/index.js +3 -3
  275. package/src/screens/Unit/components/SharedUnit/index.js +5 -5
  276. package/src/screens/Unit/components/__test__/Header.test.js +1 -14
  277. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +1 -11
  278. package/src/screens/Unit/components/__test__/SharedUnit.test.js +1 -11
  279. package/src/screens/UnitSummary/__test__/index.test.js +51 -17
  280. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +0 -12
  281. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +10 -23
  282. package/src/screens/UnitSummary/components/AirQuality/__test__/index.test.js +1 -7
  283. package/src/screens/UnitSummary/components/AirQuality/index.js +3 -3
  284. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +38 -14
  285. package/src/screens/UnitSummary/components/PowerConsumption/index.js +21 -30
  286. package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +1 -16
  287. package/src/screens/UnitSummary/components/Temperature/index.js +5 -1
  288. package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +0 -8
  289. package/src/screens/UnitSummary/components/UvIndex/index.js +2 -2
  290. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +2 -2
  291. package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +14 -18
  292. package/src/screens/UnitSummary/index.js +4 -8
  293. package/src/utils/Converter/__test__/timer.test.js +8 -0
  294. package/src/utils/Functions/preloadImages.js +13 -14
  295. package/src/utils/Monitor.js +4 -4
  296. package/src/utils/Storage.js +1 -1
  297. package/src/commons/Device/HistoryChart.js +0 -225
  298. package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +0 -48
  299. package/src/commons/Device/WindSpeed/LinearChart/index.js +0 -155
  300. package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +0 -289
  301. package/src/screens/Device/__test__/DetailHistoryChart.test.js +0 -69
  302. package/src/screens/Device/components/DetailHistoryChart.js +0 -118
  303. package/src/screens/UnitSummary/components/Temperature/ChartAverage/index.js +0 -62
  304. package/src/screens/UnitSummary/components/Temperature/__test__/ChartAverage.test.js +0 -17
  305. package/src/utils/dateHelper/getTickValues.js +0 -22
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { create, act } from 'react-test-renderer';
3
3
  import Toast from 'react-native-toast-message';
4
- import SegmentedControl from '@react-native-community/segmented-control';
4
+ import SegmentedControl from '@react-native-segmented-control/segmented-control';
5
5
  import { useRoute } from '@react-navigation/native';
6
6
  import MockAdapter from 'axios-mock-adapter';
7
7
 
@@ -28,33 +28,6 @@ const wrapComponent = () => (
28
28
  </SCProvider>
29
29
  );
30
30
 
31
- jest.mock('react-native', () => {
32
- const RN = jest.requireActual('react-native');
33
- return Object.setPrototypeOf(
34
- {
35
- Alert: {
36
- ...RN.Alert,
37
- alert: jest.fn(),
38
- },
39
- },
40
- RN
41
- );
42
- });
43
-
44
- const mockPop = jest.fn();
45
- const mockNavigate = jest.fn();
46
- jest.mock('@react-navigation/native', () => {
47
- return {
48
- ...jest.requireActual('@react-navigation/native'),
49
- useNavigation: () => ({
50
- navigate: mockNavigate,
51
- pop: mockPop,
52
- }),
53
- useRoute: jest.fn(),
54
- useIsFocused: () => true,
55
- };
56
- });
57
-
58
31
  const headerCustomOnPressMore = async (instance) => {
59
32
  const headerCustom = instance?.findAllByType(HeaderCustom);
60
33
  const buttonMore = headerCustom[0].findByProps({
@@ -124,7 +97,6 @@ describe('Test GatewayDetail', () => {
124
97
  afterEach(() => {
125
98
  mock.reset();
126
99
  mock.resetHistory();
127
- mockNavigate.mockClear();
128
100
  Toast.show.mockClear();
129
101
  });
130
102
 
@@ -155,7 +127,7 @@ describe('Test GatewayDetail', () => {
155
127
  await act(async () => {
156
128
  menuActionMore[0].props.listMenuItem[0].doAction();
157
129
  });
158
- expect(mockNavigate).toHaveBeenCalledWith(Routes.GatewayInfo, {
130
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.GatewayInfo, {
159
131
  chipId: 1,
160
132
  });
161
133
  });
@@ -177,7 +149,7 @@ describe('Test GatewayDetail', () => {
177
149
  await act(async () => {
178
150
  await modal.props.onPressConfirm();
179
151
  });
180
- expect(mockPop).toBeCalledWith(1);
152
+ expect(global.mockedPop).toBeCalledWith(1);
181
153
  });
182
154
 
183
155
  it('test render GatewayDetail onPress more and onPress Delete', async () => {
@@ -193,11 +165,12 @@ describe('Test GatewayDetail', () => {
193
165
  menuActionMore.props.listMenuItem[2].doAction();
194
166
  });
195
167
  const modal = instance.findByType(ModalPopupCT);
168
+
169
+ mock.onDelete(API.DEV_MODE.GATEWAY.DETAIL(1)).reply(200);
196
170
  await act(async () => {
197
171
  await modal.props.onPressConfirm();
198
172
  });
199
- mock.onDelete(API.DEV_MODE.GATEWAY.DETAIL(1)).reply(200);
200
- expect(mockPop).toBeCalledWith(1);
173
+ expect(global.mockedPop).toBeCalledWith(1);
201
174
  });
202
175
 
203
176
  it('test render GatewayDetail onPress TabPanel internal', async () => {
@@ -248,7 +221,7 @@ describe('Test GatewayDetail', () => {
248
221
  await act(async () => {
249
222
  await detail.props.onPressRow(1);
250
223
  });
251
- expect(mockNavigate).toBeCalledWith(Routes.DeviceInternalDetail, {
224
+ expect(global.mockedNavigate).toBeCalledWith(Routes.DeviceInternalDetail, {
252
225
  device: 1,
253
226
  gatewayId: 1,
254
227
  isInternal: true,
@@ -262,7 +235,7 @@ describe('Test GatewayDetail', () => {
262
235
  await act(async () => {
263
236
  await detail.props.onPressRow(1);
264
237
  });
265
- expect(mockNavigate).toBeCalledWith(Routes.DeviceZigbeeDetail, {
238
+ expect(global.mockedNavigate).toBeCalledWith(Routes.DeviceZigbeeDetail, {
266
239
  device: 1,
267
240
  gatewayId: 1,
268
241
  isInternal: false,
@@ -277,7 +250,7 @@ describe('Test GatewayDetail', () => {
277
250
  await act(async () => {
278
251
  await detail.props.onPressRow(1);
279
252
  });
280
- expect(mockNavigate).toBeCalledWith(Routes.DeviceModbusDetail, {
253
+ expect(global.mockedNavigate).toBeCalledWith(Routes.DeviceModbusDetail, {
281
254
  device: 1,
282
255
  gatewayId: 1,
283
256
  isInternal: false,
@@ -301,7 +274,7 @@ describe('Test GatewayDetail', () => {
301
274
  await act(async () => {
302
275
  await detail.props.onPressRow(1);
303
276
  });
304
- expect(mockNavigate).toBeCalledWith('', {
277
+ expect(global.mockedNavigate).toBeCalledWith('', {
305
278
  device: 1,
306
279
  gatewayId: null,
307
280
  isInternal: false,
@@ -16,7 +16,6 @@ import t from '../../../../hooks/Common/useTranslations';
16
16
  import ModalPopupCT from '../../../../commons/ModalPopupCT';
17
17
  import { SCConfig } from '../../../../configs';
18
18
 
19
- const mockPop = jest.fn();
20
19
  const mock = new MockAdapter(api.axiosInstance);
21
20
  const wrapComponent = () => (
22
21
  <SCProvider initState={mockSCStore({})}>
@@ -24,32 +23,6 @@ const wrapComponent = () => (
24
23
  </SCProvider>
25
24
  );
26
25
 
27
- jest.mock('react-native', () => {
28
- const RN = jest.requireActual('react-native');
29
- return Object.setPrototypeOf(
30
- {
31
- Alert: {
32
- ...RN.Alert,
33
- alert: jest.fn(),
34
- },
35
- },
36
- RN
37
- );
38
- });
39
-
40
- const mockNavigate = jest.fn();
41
- jest.mock('@react-navigation/native', () => {
42
- return {
43
- ...jest.requireActual('@react-navigation/native'),
44
- useNavigation: () => ({
45
- navigate: mockNavigate,
46
- pop: mockPop,
47
- }),
48
- useIsFocused: () => true,
49
- useRoute: jest.fn(),
50
- };
51
- });
52
-
53
26
  const buttonConnect = (instance) => {
54
27
  return instance?.findByProps({
55
28
  accessibilityLabel:
@@ -70,7 +43,6 @@ describe('Test GatewayInfo', () => {
70
43
  chipId: 1,
71
44
  },
72
45
  });
73
- mockNavigate.mockClear();
74
46
  });
75
47
 
76
48
  it('test render GatewayInfo', async () => {
@@ -120,9 +92,12 @@ describe('Test GatewayInfo', () => {
120
92
  await act(async () => {
121
93
  btnConnect.props.onPress();
122
94
  });
123
- expect(mockNavigate).toBeCalledWith(Routes.GatewayConnectionMethods, {
124
- methodsConnection: [],
125
- });
95
+ expect(global.mockedNavigate).toBeCalledWith(
96
+ Routes.GatewayConnectionMethods,
97
+ {
98
+ methodsConnection: [],
99
+ }
100
+ );
126
101
  });
127
102
 
128
103
  it('test render GatewayInfo onPress delete gateway', async () => {
@@ -141,6 +116,6 @@ describe('Test GatewayInfo', () => {
141
116
  await act(async () => {
142
117
  await modal.props.onPressConfirm();
143
118
  });
144
- expect(mockPop).toBeCalledWith(2);
119
+ expect(global.mockedPop).toBeCalledWith(2);
145
120
  });
146
121
  });
@@ -13,18 +13,6 @@ import Routes from '../../../utils/Route';
13
13
  import Gateway from '..';
14
14
  const mock = new MockAdapter(api.axiosInstance);
15
15
 
16
- const mockNavigate = jest.fn();
17
- jest.mock('@react-navigation/native', () => {
18
- return {
19
- ...jest.requireActual('@react-navigation/native'),
20
- useNavigation: () => ({
21
- navigate: mockNavigate,
22
- }),
23
- useRoute: jest.fn(),
24
- useIsFocused: () => true,
25
- };
26
- });
27
-
28
16
  const wrapComponent = (
29
17
  route = {
30
18
  params: {
@@ -42,7 +30,6 @@ describe('Test Gateway screen', () => {
42
30
  afterEach(() => {
43
31
  mock.reset();
44
32
  mock.resetHistory();
45
- mockNavigate.mockClear();
46
33
  });
47
34
  it('Test render', async () => {
48
35
  await act(async () => {
@@ -71,7 +58,7 @@ describe('Test Gateway screen', () => {
71
58
  await act(async () => {
72
59
  await gatewayItems[0].props.onPress();
73
60
  });
74
- expect(mockNavigate).toBeCalledWith(Routes.AllGatewayStack, {
61
+ expect(global.mockedNavigate).toBeCalledWith(Routes.AllGatewayStack, {
75
62
  params: {
76
63
  item: {
77
64
  id: 1,
@@ -14,17 +14,6 @@ const wrapComponent = (item) => (
14
14
  </SCProvider>
15
15
  );
16
16
 
17
- const mockNavigate = jest.fn();
18
- jest.mock('@react-navigation/native', () => {
19
- return {
20
- ...jest.requireActual('@react-navigation/native'),
21
- useNavigation: () => ({
22
- navigate: mockNavigate,
23
- }),
24
- useIsFocused: jest.fn(),
25
- };
26
- });
27
-
28
17
  describe('Test GatewayItem', () => {
29
18
  let tree;
30
19
  let item;
@@ -35,7 +24,6 @@ describe('Test GatewayItem', () => {
35
24
  is_connected: false,
36
25
  last_healthy: 1,
37
26
  };
38
- mockNavigate.mockClear();
39
27
  });
40
28
 
41
29
  it('test render GatewayItem connect false', async () => {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { create, act } from 'react-test-renderer';
3
- import SegmentedControl from '@react-native-community/segmented-control';
3
+ import SegmentedControl from '@react-native-segmented-control/segmented-control';
4
4
  import Carousel from 'react-native-new-snap-carousel';
5
5
 
6
6
  import { SCProvider } from '../../../../../context';
@@ -15,17 +15,6 @@ const wrapComponent = (item = []) => (
15
15
  </SCProvider>
16
16
  );
17
17
 
18
- const mockNavigate = jest.fn();
19
- jest.mock('@react-navigation/native', () => {
20
- return {
21
- ...jest.requireActual('@react-navigation/native'),
22
- useNavigation: () => ({
23
- navigate: mockNavigate,
24
- }),
25
- useIsFocused: jest.fn(),
26
- };
27
- });
28
-
29
18
  describe('Test TabPaneCT', () => {
30
19
  let tree;
31
20
  let item;
@@ -42,7 +31,6 @@ describe('Test TabPaneCT', () => {
42
31
  devices: [{ id: 1, name: 'device1' }],
43
32
  },
44
33
  ];
45
- mockNavigate.mockClear();
46
34
  });
47
35
 
48
36
  it('test render TabPaneCT', async () => {
@@ -6,7 +6,7 @@ import {
6
6
  ScrollView,
7
7
  RefreshControl,
8
8
  } from 'react-native';
9
- import SegmentedControl from '@react-native-community/segmented-control';
9
+ import SegmentedControl from '@react-native-segmented-control/segmented-control';
10
10
  import Carousel from 'react-native-new-snap-carousel';
11
11
 
12
12
  import { Text, StatusBox } from '../../../../commons';
@@ -7,14 +7,7 @@ import { API } from '../../../../configs';
7
7
  import { useGateway } from '../useGateway';
8
8
 
9
9
  const mock = new MockAdapter(api.axiosInstance);
10
- jest.mock('@react-navigation/native', () => {
11
- return {
12
- ...jest.requireActual('@react-navigation/native'),
13
- useNavigation: () => ({
14
- pop: jest.fn(),
15
- }),
16
- };
17
- });
10
+
18
11
  describe('Test useGateway', () => {
19
12
  let hook;
20
13
 
@@ -1,6 +1,6 @@
1
1
  import Detail from './components/Detail';
2
2
  import TabPaneCT from './components/TabPaneCT';
3
- import SegmentedControl from '@react-native-community/segmented-control';
3
+ import SegmentedControl from '@react-native-segmented-control/segmented-control';
4
4
  import { act } from 'react-test-renderer';
5
5
 
6
6
  export const fetchGatewayCT = async (tree) => {
@@ -3,7 +3,7 @@ import { TouchableOpacity, View } from 'react-native';
3
3
  import { KeyboardAwareScrollView } from '@eohjsc/react-native-keyboard-aware-scroll-view';
4
4
 
5
5
  import styles from './Styles/SelectActionStyles';
6
- import { Icon } from '@ant-design/react-native';
6
+ import AntDesign from 'react-native-vector-icons/AntDesign';
7
7
  import { Colors } from '../../../configs';
8
8
  import { useNavigation, useRoute } from '@react-navigation/native';
9
9
  import BottomButtonView from '../../../commons/BottomButtonView';
@@ -35,7 +35,7 @@ const NewActionWrapper = ({
35
35
  onPress={handleClose}
36
36
  accessibilityLabel={AccessibilityLabel.ICON_CLOSE}
37
37
  >
38
- <Icon name={'close'} size={24} color={Colors.Black} />
38
+ <AntDesign name={'close'} size={24} color={Colors.Black} />
39
39
  </TouchableOpacity>
40
40
  ),
41
41
  [handleClose]
@@ -1,21 +1,17 @@
1
1
  import React, { useMemo, useState } from 'react';
2
- import { View } from 'react-native';
2
+ import { View, TouchableOpacity, FlatList } from 'react-native';
3
3
 
4
4
  import styles from './Styles/SetupSensorStyles';
5
5
  import { useTranslations } from '../../../hooks/Common/useTranslations';
6
6
  import Text from '../../../commons/Text';
7
- import {
8
- Button as AntButton,
9
- InputItem,
10
- List,
11
- Radio,
12
- } from '@ant-design/react-native';
13
7
  import { useNavigation, useRoute } from '@react-navigation/native';
14
8
  import NewActionWrapper from './NewActionWrapper';
15
9
  import GridItem from '../../../commons/Grid/GridItem';
16
10
  import Routes from '../../../utils/Route';
17
11
  import ModalCustom from '../../../commons/Modal/ModalCustom';
18
12
  import { ToastBottomHelper } from '../../../utils/Utils';
13
+ import CheckBox from '@react-native-community/checkbox';
14
+ import TextInput from '../../../commons/Form/TextInput';
19
15
 
20
16
  const valueEvaluationToOptions = (valueEvaluation) => {
21
17
  if (valueEvaluation.template === 'range') {
@@ -137,24 +133,27 @@ const SetupConfigCondition = () => {
137
133
  <Text type="Body">
138
134
  {t('when_value_is', { config_name: config.name })}
139
135
  </Text>
140
- <List renderHeader={t('condition')}>
141
- {normalConditions.map((item) => {
136
+ <FlatList
137
+ renderHeader={t('condition')}
138
+ data={normalConditions}
139
+ renderItem={({ item }) => {
142
140
  return (
143
- <Radio.RadioItem
144
- checked={item.value === customCondition}
145
- key={item.value}
146
- onChange={() => {
147
- automate.condition = item.value;
148
- setCustomCondition(item.value);
149
- }}
150
- >
151
- {item.label}
152
- </Radio.RadioItem>
141
+ <View>
142
+ <Text>{item.label}</Text>
143
+ <CheckBox
144
+ onChange={() => {
145
+ automate.condition = item.value;
146
+ setCustomCondition(item.value);
147
+ }}
148
+ value={item.value === customCondition}
149
+ />
150
+ </View>
153
151
  );
154
- })}
155
- </List>
156
- <List renderHeader={t('value')} style={styles.inputValue}>
157
- <InputItem
152
+ }}
153
+ />
154
+ <View style={styles.inputValue}>
155
+ <Text>{t('value')}</Text>
156
+ <TextInput
158
157
  keyboardType="decimal-pad"
159
158
  type="number"
160
159
  maxLength={10}
@@ -164,9 +163,9 @@ const SetupConfigCondition = () => {
164
163
  }}
165
164
  style={styles.numberInput}
166
165
  />
167
- </List>
168
- <AntButton
169
- type={'primary'}
166
+ </View>
167
+ <TouchableOpacity
168
+ testID={'continue_button'}
170
169
  onPress={() => {
171
170
  if (
172
171
  !automate.value ||
@@ -179,8 +178,8 @@ const SetupConfigCondition = () => {
179
178
  navigate(Routes.ValueChangeName, { automate, closeScreen });
180
179
  }}
181
180
  >
182
- {t('continue')}
183
- </AntButton>
181
+ <Text>{t('continue')}</Text>
182
+ </TouchableOpacity>
184
183
  </View>
185
184
  </ModalCustom>
186
185
  </NewActionWrapper>
@@ -52,7 +52,7 @@ describe('Test ChooseAction', () => {
52
52
  await act(async () => {
53
53
  bottomButton.props.onPressMain();
54
54
  });
55
- expect(mockedNavigate).toHaveBeenCalled();
55
+ expect(global.mockedNavigate).toHaveBeenCalled();
56
56
  });
57
57
 
58
58
  it('test onSave fail not permission', async () => {
@@ -66,7 +66,7 @@ describe('Test ChooseAction', () => {
66
66
  await act(async () => {
67
67
  bottomButton.props.onPressMain();
68
68
  });
69
- expect(mockedNavigate).not.toHaveBeenCalled();
69
+ expect(global.mockedNavigate).not.toHaveBeenCalled();
70
70
  });
71
71
 
72
72
  it('test fetchData', async () => {
@@ -79,7 +79,7 @@ describe('Test ChooseAction', () => {
79
79
  await act(async () => {
80
80
  tree = await renderer.create(wrapComponent(route));
81
81
  });
82
- expect(mockedNavigate).not.toHaveBeenCalled();
82
+ expect(global.mockedNavigate).not.toHaveBeenCalled();
83
83
  });
84
84
 
85
85
  test('test RenderActionItem air conditioner device IR', async () => {
@@ -141,10 +141,13 @@ describe('Test ChooseConfig', () => {
141
141
  conditionTouch.props.onPress();
142
142
  });
143
143
 
144
- expect(mockedNavigate).toHaveBeenCalledWith(Routes.SetupConfigCondition, {
145
- automate: { config: 1 },
146
- config: { id: 1 },
147
- closeScreen: undefined,
148
- });
144
+ expect(global.mockedNavigate).toHaveBeenCalledWith(
145
+ Routes.SetupConfigCondition,
146
+ {
147
+ automate: { config: 1 },
148
+ config: { id: 1 },
149
+ closeScreen: undefined,
150
+ }
151
+ );
149
152
  });
150
153
  });
@@ -76,7 +76,7 @@ describe('Test SelectMonitorDevices', () => {
76
76
  });
77
77
  expect(device[0].props.isSelectDevice).toBeTruthy();
78
78
 
79
- expect(mockedNavigate).toHaveBeenCalled();
79
+ expect(global.mockedNavigate).toHaveBeenCalled();
80
80
  });
81
81
 
82
82
  it('test onSnapItem', async () => {
@@ -108,6 +108,6 @@ describe('Test SelectMonitorDevices', () => {
108
108
  await act(async () => {
109
109
  iconClose[0].props.onPress();
110
110
  });
111
- expect(mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail);
111
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail);
112
112
  });
113
113
  });
@@ -13,22 +13,6 @@ import { useRoute } from '@react-navigation/native';
13
13
 
14
14
  const mock = new MockAdapter(api.axiosInstance);
15
15
 
16
- const mockedNavigate = jest.fn();
17
- const mockedDispatch = jest.fn();
18
- const mockedGoBack = jest.fn();
19
-
20
- jest.mock('@react-navigation/native', () => {
21
- return {
22
- ...jest.requireActual('@react-navigation/native'),
23
- useNavigation: () => ({
24
- navigate: mockedNavigate,
25
- dispatch: mockedDispatch,
26
- goBack: mockedGoBack,
27
- }),
28
- useRoute: jest.fn(),
29
- };
30
- });
31
-
32
16
  const wrapComponent = (route) => (
33
17
  <SCProvider initState={mockSCStore({})}>
34
18
  <SelectMonitorDevices route={route} />
@@ -60,7 +44,6 @@ describe('Test SelectMonitorDevices', () => {
60
44
 
61
45
  beforeEach(() => {
62
46
  useRoute.mockImplementation(() => route);
63
- mockedNavigate.mockClear();
64
47
  });
65
48
 
66
49
  it('test onPressClose', async () => {
@@ -87,6 +70,6 @@ describe('Test SelectMonitorDevices', () => {
87
70
  await act(async () => {
88
71
  iconClose[0].props.onPress();
89
72
  });
90
- expect(mockedNavigate).toHaveBeenCalledWith('closeScreen');
73
+ expect(global.mockedNavigate).toHaveBeenCalledWith('closeScreen');
91
74
  });
92
75
  });
@@ -3,14 +3,16 @@ import { act, create } from 'react-test-renderer';
3
3
  import { SCProvider } from '../../../../context';
4
4
  import { mockSCStore } from '../../../../context/mockStore';
5
5
  import SetupConfigCondition from '../SetupConfigCondition';
6
- import { useNavigation, useRoute } from '@react-navigation/native';
6
+ import { useRoute } from '@react-navigation/native';
7
7
  import { ToastBottomHelper } from '../../../../utils/Utils';
8
8
  import { Text } from '../../../../commons';
9
- import { Button, InputItem, Radio } from '@ant-design/react-native';
10
9
  import GridItem from '../../../../commons/Grid/GridItem';
11
10
  import { TouchableWithoutFeedback } from 'react-native';
12
11
  import Routes from '../../../../utils/Route';
13
12
  import { ModalCustom } from '../../../../commons/Modal';
13
+ import { showAllGridItems } from '../../../../commons/ActionTemplate/__test__/utils';
14
+ import TextInput from '../../../../commons/Form/TextInput';
15
+ import CheckBox from '@react-native-community/checkbox';
14
16
 
15
17
  jest.mock('react', () => {
16
18
  return {
@@ -39,17 +41,12 @@ const wrapComponent = (configuration, onPress) => (
39
41
  );
40
42
 
41
43
  describe('Test SetupConfigCondition', () => {
42
- const mockNavigate = useNavigation().navigate;
43
- const mockGoBack = useNavigation().goBack;
44
44
  const spyToastError = jest.spyOn(ToastBottomHelper, 'error');
45
45
 
46
46
  let tree;
47
47
  beforeEach(() => {
48
48
  tree = null;
49
- mockGoBack.mockReset();
50
- useRoute.mockClear();
51
49
  spyToastError.mockClear();
52
- mockNavigate.mockClear();
53
50
  });
54
51
 
55
52
  it('render range value evaluation', async () => {
@@ -178,7 +175,7 @@ describe('Test SetupConfigCondition', () => {
178
175
  gridItems[0].findByType(TouchableWithoutFeedback).props.onPress();
179
176
  });
180
177
 
181
- expect(mockNavigate).toBeCalledWith(Routes.ValueChangeName, {
178
+ expect(global.mockedNavigate).toBeCalledWith(Routes.ValueChangeName, {
182
179
  automate: {
183
180
  condition: 'value_evaluation',
184
181
  value: [1, 0],
@@ -218,22 +215,24 @@ describe('Test SetupConfigCondition', () => {
218
215
  expect(modal.props.isVisible).toBeFalsy();
219
216
 
220
217
  await act(async () => {
221
- instance.findAllByType(Radio.RadioItem)[0].props.onChange();
218
+ instance.findAllByType(CheckBox)[0].props.onChange();
222
219
  });
223
220
 
224
- const input = instance.findByType(InputItem);
221
+ const input = instance.findByType(TextInput);
225
222
 
226
223
  await act(async () => {
227
224
  input.props.onChange('123');
228
225
  });
229
226
 
230
- const bottomButtonView = instance.findByType(Button);
227
+ const bottomButtonView = instance.findByProps({
228
+ testID: 'continue_button',
229
+ });
231
230
 
232
231
  await act(async () => {
233
232
  bottomButtonView.props.onPress();
234
233
  });
235
234
 
236
- expect(mockNavigate).toBeCalledWith(Routes.ValueChangeName, {
235
+ expect(global.mockedNavigate).toBeCalledWith(Routes.ValueChangeName, {
237
236
  automate: {
238
237
  condition: '<',
239
238
  value: 123,
@@ -259,20 +258,23 @@ describe('Test SetupConfigCondition', () => {
259
258
  tree = await create(wrapComponent());
260
259
  });
261
260
  const instance = tree.root;
262
- const input = instance.findByType(InputItem);
261
+ await showAllGridItems(instance);
262
+ const input = instance.findByType(TextInput);
263
263
 
264
264
  await act(async () => {
265
265
  input.props.onChange(value);
266
266
  });
267
267
 
268
- const bottomButtonView = instance.findByType(Button);
268
+ const bottomButtonView = instance.findByProps({
269
+ testID: 'continue_button',
270
+ });
269
271
 
270
272
  await act(async () => {
271
273
  bottomButtonView.props.onPress();
272
274
  });
273
275
 
274
276
  if (message === null) {
275
- expect(mockNavigate).toBeCalled();
277
+ expect(global.mockedNavigate).toBeCalled();
276
278
  } else {
277
279
  expect(spyToastError).toBeCalledWith(message, '', 3000);
278
280
  }
@@ -21,10 +21,10 @@ describe('test AddNewAutoSmart', () => {
21
21
  automate: { unit: 1 },
22
22
  },
23
23
  };
24
- const mockNavigate = useNavigation().navigate;
24
+ const mockedNavigate = useNavigation().navigate;
25
25
 
26
26
  beforeEach(() => {
27
- mockNavigate.mockClear();
27
+ mockedNavigate.mockClear();
28
28
  });
29
29
 
30
30
  it('AddNewAutoSmart select sensor device', async () => {
@@ -41,7 +41,7 @@ describe('test AddNewAutoSmart', () => {
41
41
  await touchItem.props.onPress();
42
42
  });
43
43
 
44
- expect(mockNavigate).toBeCalledWith(Routes.SelectMonitorDevices, {
44
+ expect(global.mockedNavigate).toBeCalledWith(Routes.SelectMonitorDevices, {
45
45
  automate: { unit: 1, type: 'value_change' },
46
46
  closeScreen: undefined,
47
47
  });
@@ -59,7 +59,7 @@ describe('test AddNewAutoSmart', () => {
59
59
  });
60
60
  expect(items[2].props.isSelected).toBeTruthy();
61
61
 
62
- expect(mockNavigate).toHaveBeenCalledWith(Routes.SetSchedule, {
62
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.SetSchedule, {
63
63
  automate: { type: 'schedule', unit: 1 },
64
64
  closeScreen: undefined,
65
65
  });