@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
@@ -17,19 +17,6 @@ import { SCConfig } from '../../../configs';
17
17
 
18
18
  const mock = new MockAdapter(api.axiosInstance);
19
19
 
20
- const mockedNavigate = jest.fn();
21
- const mockedGoBack = jest.fn();
22
- jest.mock('@react-navigation/native', () => {
23
- return {
24
- ...jest.requireActual('@react-navigation/native'),
25
- useNavigation: () => ({
26
- navigate: mockedNavigate,
27
- goBack: mockedGoBack,
28
- }),
29
- useIsFocused: jest.fn(),
30
- };
31
- });
32
-
33
20
  const wrapComponent = (route) => (
34
21
  <SCProvider initState={mockSCStore({})}>
35
22
  <AddLGDevice route={route} />
@@ -137,7 +124,7 @@ describe('Test Add LG Device', () => {
137
124
  await act(async () => {
138
125
  viewButtonBottom.props.onLeftClick();
139
126
  });
140
- expect(mockedGoBack).toHaveBeenCalled();
127
+ expect(global.mockedGoBack).toHaveBeenCalled();
141
128
  });
142
129
 
143
130
  it('ViewButtonBottom onRightClick without select stationId', async () => {
@@ -149,7 +136,7 @@ describe('Test Add LG Device', () => {
149
136
  await act(async () => {
150
137
  viewButtonBottom.props.onRightClick();
151
138
  });
152
- expect(mockedNavigate).toHaveBeenCalled();
139
+ expect(global.mockedNavigate).toHaveBeenCalled();
153
140
  });
154
141
 
155
142
  it('ViewButtonBottom onRightClick with stationId', async () => {
@@ -201,7 +188,7 @@ describe('Test Add LG Device', () => {
201
188
  text1: getTranslate('en', 'lg_sync_success'),
202
189
  visibilityTime: 1000,
203
190
  });
204
- expect(mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
191
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
205
192
  });
206
193
 
207
194
  it('ViewButtonBottom onRightClick with case sync device fail', async () => {
@@ -253,7 +240,7 @@ describe('Test Add LG Device', () => {
253
240
  text1: getTranslate('en', 'lg_sync_failed'),
254
241
  visibilityTime: 1000,
255
242
  });
256
- expect(mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
243
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
257
244
  });
258
245
 
259
246
  it('ViewButtonBottom onRightClick with stationId but sync failed', async () => {
@@ -299,7 +286,7 @@ describe('Test Add LG Device', () => {
299
286
  text1: getTranslate('en', 'lg_sync_failed'),
300
287
  visibilityTime: 1000,
301
288
  });
302
- expect(mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
289
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
303
290
  });
304
291
 
305
292
  it('ViewButtonBottom onRightClick with stationId but get token failed, wrong data', async () => {
@@ -342,7 +329,7 @@ describe('Test Add LG Device', () => {
342
329
 
343
330
  expect(spyToastSuccess).not.toBeCalled();
344
331
  expect(spyToastError).toBeCalled();
345
- expect(mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
332
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
346
333
 
347
334
  spyToastSuccess.mockReset();
348
335
  spyToastSuccess.mockRestore();
@@ -378,7 +365,7 @@ describe('Test Add LG Device', () => {
378
365
 
379
366
  expect(spyToastSuccess).not.toBeCalled();
380
367
  expect(spyToastError).toBeCalled();
381
- expect(mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
368
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
382
369
 
383
370
  spyToastSuccess.mockReset();
384
371
  spyToastSuccess.mockRestore();
@@ -16,17 +16,7 @@ const wrapComponent = () => (
16
16
  </SCProvider>
17
17
  );
18
18
 
19
- const mockGoBack = jest.fn();
20
19
  const mockSetData = jest.fn();
21
- jest.mock('@react-navigation/native', () => {
22
- return {
23
- ...jest.requireActual('@react-navigation/native'),
24
- useNavigation: () => ({
25
- goBack: mockGoBack,
26
- }),
27
- useRoute: jest.fn(),
28
- };
29
- });
30
20
 
31
21
  describe('Test EditTemplate', () => {
32
22
  let tree;
@@ -77,9 +67,8 @@ describe('Test EditTemplate', () => {
77
67
  await firstItem.props.onLongPress();
78
68
  });
79
69
 
80
- expect(mockGoBack).toBeCalled();
70
+ expect(global.mockedGoBack).toBeCalled();
81
71
 
82
- mockGoBack.mockReset();
83
72
  await act(async () => {
84
73
  await DraggableFlatLists[0].props.onDragEnd({
85
74
  data,
@@ -90,6 +79,6 @@ describe('Test EditTemplate', () => {
90
79
  .findByProps({ accessibilityLabel: 'Save' })
91
80
  .props.onPress();
92
81
  });
93
- expect(mockGoBack).toBeCalled();
82
+ expect(global.mockedGoBack).toBeCalled();
94
83
  });
95
84
  });
@@ -3,15 +3,6 @@ import { View } from 'react-native';
3
3
  import { act, create } from 'react-test-renderer';
4
4
  import GatewayList from '../GatewayList';
5
5
 
6
- jest.mock('@react-navigation/native', () => {
7
- return {
8
- ...jest.requireActual('@react-navigation/native'),
9
- useNavigation: () => ({
10
- goBack: jest.fn(),
11
- }),
12
- };
13
- });
14
-
15
6
  describe('Test GatewayList', () => {
16
7
  let tree;
17
8
 
@@ -22,12 +22,12 @@ const wrapComponent = () => (
22
22
 
23
23
  describe('Test Detail', () => {
24
24
  const mockGoBack = useNavigation().goBack;
25
- const mockNavigate = useNavigation().navigate;
25
+ const mockedNavigate = useNavigation().navigate;
26
26
  let tree;
27
27
 
28
28
  beforeEach(() => {
29
29
  mockGoBack.mockReset();
30
- mockNavigate.mockReset();
30
+ mockedNavigate.mockReset();
31
31
  useRoute.mockReturnValue({
32
32
  params: {
33
33
  item: {
@@ -59,7 +59,7 @@ describe('Test Detail', () => {
59
59
  const instance = tree.root;
60
60
  const TouchableOpacities = instance.findAllByType(TouchableOpacity);
61
61
  await TouchableOpacities[0].props.onPress();
62
- expect(mockGoBack).toBeCalled();
62
+ expect(global.mockedGoBack).toBeCalled();
63
63
  });
64
64
 
65
65
  it('Test render onClick more header onPress delete', async () => {
@@ -101,7 +101,7 @@ describe('Test Detail', () => {
101
101
  await act(async () => {
102
102
  await menuActionMore.props.listMenuItem[0].doAction();
103
103
  });
104
- expect(mockNavigate).toHaveBeenCalled();
104
+ expect(global.mockedNavigate).toHaveBeenCalled();
105
105
  await act(async () => {
106
106
  await menuActionMore.props.listMenuItem[3].doAction();
107
107
  });
@@ -9,17 +9,6 @@ import api from '../../../utils/Apis/axios';
9
9
 
10
10
  const mock = new MockAdapter(api.axiosInstance);
11
11
 
12
- const mockNavigate = jest.fn();
13
- jest.mock('@react-navigation/native', () => {
14
- return {
15
- ...jest.requireActual('@react-navigation/native'),
16
- useNavigation: () => ({
17
- navigate: mockNavigate,
18
- }),
19
- useIsFocused: () => true,
20
- };
21
- });
22
-
23
12
  describe('Test Template screen', () => {
24
13
  let tree;
25
14
  it('Test render', async () => {
@@ -38,7 +27,7 @@ describe('Test Template screen', () => {
38
27
  expect(FlatLists).toHaveLength(1);
39
28
  const TouchableOpacities = instance.findAllByType(TouchableOpacity);
40
29
  await TouchableOpacities[0].props.onPress();
41
- expect(mockNavigate).toBeCalled();
30
+ expect(global.mockedNavigate).toBeCalled();
42
31
  });
43
32
 
44
33
  it('Test onSearch', async () => {
@@ -6,7 +6,7 @@ import React, {
6
6
  useState,
7
7
  } from 'react';
8
8
  import { View, TouchableOpacity } from 'react-native';
9
- import { Icon } from '@ant-design/react-native';
9
+ import AntDesign from 'react-native-vector-icons/AntDesign';
10
10
  import { useNavigation, useRoute } from '@react-navigation/native';
11
11
 
12
12
  import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
@@ -163,7 +163,7 @@ const TemplateDetail = () => {
163
163
  ref={refMenuAction}
164
164
  style={styles.headerButton}
165
165
  >
166
- <Icon name={'more'} size={27} color={Colors.Black} />
166
+ <AntDesign name={'more'} size={27} color={Colors.Black} />
167
167
  </TouchableOpacity>
168
168
  </View>
169
169
  );
@@ -8,7 +8,7 @@ import React, {
8
8
  } from 'react';
9
9
  import { View, ScrollView, TouchableOpacity } from 'react-native';
10
10
  import { useNavigation } from '@react-navigation/native';
11
- import { Icon } from '@ant-design/react-native';
11
+ import AntDesign from 'react-native-vector-icons/AntDesign';
12
12
  import { HeaderCustom } from '../../commons/Header';
13
13
  import Text from '../../commons/Text';
14
14
  import NavBar from '../../commons/NavBar';
@@ -142,7 +142,7 @@ const SelectAddToFavorites = memo(({ route }) => {
142
142
  style={styles.buttonClose}
143
143
  onPress={goBack}
144
144
  >
145
- <Icon name={'close'} size={24} color={Colors.Black} />
145
+ <AntDesign name={'close'} size={24} color={Colors.Black} />
146
146
  </TouchableOpacity>
147
147
  ),
148
148
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -2,7 +2,7 @@ import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { TouchableOpacity, View, ScrollView } from 'react-native';
3
3
  import MapView, { Marker, Circle, PROVIDER_GOOGLE } from 'react-native-maps';
4
4
  import { useNavigation } from '@react-navigation/native';
5
- import { IconOutline, IconFill } from '@ant-design/icons-react-native';
5
+ import AntDesign from 'react-native-vector-icons/AntDesign';
6
6
  import { check, RESULTS } from 'react-native-permissions';
7
7
  import { openPromptEnableLocation } from '../../utils/Setting/Location';
8
8
 
@@ -194,7 +194,7 @@ const SelectAddress = memo(({ route }) => {
194
194
  style={styles.button}
195
195
  accessibilityLabel={AccessibilityLabel.BUTTON_YOUR_LOCATION}
196
196
  >
197
- <IconOutline name="aim" size={27} color={Colors.Primary} />
197
+ <AntDesign name="aim" size={27} color={Colors.Primary} />
198
198
  <Text type="Body" color={Colors.Gray9} style={styles.text} bold>
199
199
  {t('your_location')}
200
200
  </Text>
@@ -205,7 +205,7 @@ const SelectAddress = memo(({ route }) => {
205
205
  style={styles.button}
206
206
  accessibilityLabel={AccessibilityLabel.BUTTON_CHOOSE_ON_MAP}
207
207
  >
208
- <IconFill name="environment" size={27} color={Colors.Primary} />
208
+ <AntDesign name="environment" size={27} color={Colors.Primary} />
209
209
  <Text type="Body" color={Colors.Gray9} style={styles.text} bold>
210
210
  {t('choose_on_map')}
211
211
  </Text>
@@ -243,7 +243,7 @@ const SelectAddress = memo(({ route }) => {
243
243
  }}
244
244
  tracksViewChanges={false}
245
245
  >
246
- <IconFill name="environment" size={27} color={Colors.Blue10} />
246
+ <AntDesign name="environment" size={27} color={Colors.Blue10} />
247
247
  </Marker>
248
248
  </>
249
249
  )}
@@ -4,7 +4,7 @@ import React, { memo, useRef } from 'react';
4
4
  import styles from './SmartAccountStyles';
5
5
  import { Colors } from '../../configs';
6
6
  import Text from '../../commons/Text';
7
- import { Icon } from '@ant-design/react-native';
7
+ import AntDesign from 'react-native-vector-icons/AntDesign';
8
8
  import { AccessibilityLabel } from '../../configs/Constants';
9
9
 
10
10
  export const SmartAccountItem = memo(
@@ -44,7 +44,7 @@ export const SmartAccountItem = memo(
44
44
  onPress={onPressMore}
45
45
  ref={buttonMoreRef}
46
46
  >
47
- <Icon name={'more'} size={27} color={Colors.Black} />
47
+ <AntDesign name={'more'} size={27} color={Colors.Black} />
48
48
  </TouchableOpacity>
49
49
  </View>
50
50
  );
@@ -26,10 +26,11 @@ const Summaries = memo(({ unit }) => {
26
26
  {},
27
27
  true
28
28
  );
29
- if (success && data.length) {
29
+ if (success && data?.length) {
30
30
  setUnitSummaries(data);
31
+ return true;
31
32
  }
32
- return success && data.length > 0;
33
+ return false;
33
34
  }, [unit.id]);
34
35
 
35
36
  const goToSummary = useCallback(
@@ -77,7 +77,10 @@ describe('Test AddMenu Unit', () => {
77
77
 
78
78
  expect(menuActionAddnew.props.visible).toBe(true);
79
79
  expect(mockedAfterItemClick).toHaveBeenCalled();
80
- expect(mockedNavigate).toHaveBeenCalledWith('route test', 'data test');
80
+ expect(global.mockedNavigate).toHaveBeenCalledWith(
81
+ 'route test',
82
+ 'data test'
83
+ );
81
84
  });
82
85
 
83
86
  it('add new device but have no permission', async () => {
@@ -201,7 +204,7 @@ describe('Test AddMenu Unit', () => {
201
204
  await act(async () => {
202
205
  menuActionAddnew.props.onItemClick(menuActionAddnew.props.dataActions[3]);
203
206
  });
204
- expect(mockedNavigate).toBeCalledWith(Routes.SmartAccountStack, {
207
+ expect(global.mockedNavigate).toBeCalledWith(Routes.SmartAccountStack, {
205
208
  params: { unitId: 1, unitName: 'Unit 1' },
206
209
  screen: 'SmartAccount',
207
210
  });
@@ -34,18 +34,6 @@ jest.mock('react-native-onesignal', () => {
34
34
  };
35
35
  });
36
36
 
37
- jest.mock('@react-navigation/native', () => {
38
- return {
39
- ...jest.requireActual('@react-navigation/native'),
40
- useNavigation: () => ({
41
- navigate: jest.fn(),
42
- goBack: jest.fn(),
43
- }),
44
- useFocusEffect: jest.fn(),
45
- useIsFocused: () => true,
46
- };
47
- });
48
-
49
37
  const wrapComponent = (route, unitData, account) => (
50
38
  <SCProvider initState={mockSCStore({})}>
51
39
  <UnitDetail
@@ -9,7 +9,6 @@ import ChooseLocation from '../ChooseLocation';
9
9
  import { API } from '../../../configs';
10
10
  import BottomButtonView from '../../../commons/BottomButtonView';
11
11
  import api from '../../../utils/Apis/axios';
12
- import { useNavigation } from '@react-navigation/native';
13
12
 
14
13
  const wrapComponent = (route) => (
15
14
  <SCProvider initState={mockSCStore({})}>
@@ -72,8 +71,6 @@ describe('Test ChooseLocation', () => {
72
71
  });
73
72
 
74
73
  it('test done choose location', async () => {
75
- const mockGoBack = useNavigation().goBack;
76
-
77
74
  await act(async () => {
78
75
  tree = await create(wrapComponent(route));
79
76
  });
@@ -108,6 +105,6 @@ describe('Test ChooseLocation', () => {
108
105
  latitude: 20,
109
106
  longitude: 20,
110
107
  });
111
- expect(mockGoBack).toBeCalled();
108
+ expect(global.mockedGoBack).toBeCalled();
112
109
  });
113
110
  });
@@ -9,7 +9,7 @@ import {
9
9
  useNavigation,
10
10
  useFocusEffect,
11
11
  } from '@react-navigation/native';
12
- import AsyncStorage from '@react-native-community/async-storage';
12
+ import AsyncStorage from '@react-native-async-storage/async-storage';
13
13
  import UnitDetail from '../Detail';
14
14
  import { API } from '../../../configs';
15
15
  import { AccessibilityLabel } from '../../../configs/Constants';
@@ -108,7 +108,7 @@ describe('Test UnitDetail', () => {
108
108
  await act(async () => {
109
109
  CameraDeviceViews[0].props.goToPlayBack();
110
110
  });
111
- expect(mockedNavigate).toBeCalledWith(Routes.PlaybackCamera, {
111
+ expect(global.mockedNavigate).toBeCalledWith(Routes.PlaybackCamera, {
112
112
  item: undefined,
113
113
  thumbnail: undefined,
114
114
  });
@@ -430,7 +430,7 @@ describe('Test UnitDetail', () => {
430
430
  await act(async () => {
431
431
  await goDetailButton[1].props.onPress();
432
432
  });
433
- expect(mockedNavigate).toHaveBeenCalled();
433
+ expect(global.mockedNavigate).toHaveBeenCalled();
434
434
  });
435
435
 
436
436
  it('render subunit favorites', async () => {
@@ -513,7 +513,7 @@ describe('Test UnitDetail', () => {
513
513
  await act(async () => {
514
514
  await TouchableOpacities[0].props.onPress();
515
515
  });
516
- expect(mockedNavigate).toBeCalled();
516
+ expect(global.mockedNavigate).toBeCalled();
517
517
  });
518
518
 
519
519
  it('test onPress goBack with routeName', async () => {
@@ -527,6 +527,6 @@ describe('Test UnitDetail', () => {
527
527
  await act(async () => {
528
528
  await TouchableOpacities[0].props.onPress();
529
529
  });
530
- expect(mockedNavigate).toBeCalled();
530
+ expect(global.mockedNavigate).toBeCalled();
531
531
  });
532
532
  });
@@ -16,17 +16,6 @@ import { AlertAction } from '../../../commons';
16
16
 
17
17
  const mock = new MockAdapter(api.axiosInstance);
18
18
 
19
- const mockNavigate = jest.fn();
20
- jest.mock('@react-navigation/native', () => {
21
- return {
22
- ...jest.requireActual('@react-navigation/native'),
23
- useRoute: jest.fn(),
24
- useNavigation: () => ({
25
- navigate: mockNavigate,
26
- }),
27
- };
28
- });
29
-
30
19
  jest.mock('../../../hooks/Common', () => {
31
20
  return {
32
21
  useIsOwnerOfUnit: () => ({ isOwner: true }),
@@ -52,10 +41,6 @@ describe('Test Manage Unit', () => {
52
41
  },
53
42
  };
54
43
 
55
- beforeEach(() => {
56
- mockNavigate.mockClear();
57
- });
58
-
59
44
  const getElement = async (instance) => {
60
45
  const changeName = instance.findAll(
61
46
  (item) =>
@@ -241,7 +226,7 @@ describe('Test Manage Unit', () => {
241
226
  await act(async () => {
242
227
  buttonWrapper.props.onPress();
243
228
  });
244
- expect(mockNavigate).toBeCalled();
229
+ expect(global.mockedNavigate).toBeCalled();
245
230
  });
246
231
 
247
232
  it('test onPress goToManageSubUnit', async () => {
@@ -259,6 +244,6 @@ describe('Test Manage Unit', () => {
259
244
  await act(async () => {
260
245
  buttonWrapper.props.onPress();
261
246
  });
262
- expect(mockNavigate).toBeCalled();
247
+ expect(global.mockedNavigate).toBeCalled();
263
248
  });
264
249
  });
@@ -7,16 +7,6 @@ import MoreMenu from '../MoreMenu';
7
7
 
8
8
  const mockHidePopover = jest.fn();
9
9
 
10
- const mockNavigate = jest.fn();
11
- jest.mock('@react-navigation/native', () => {
12
- return {
13
- ...jest.requireActual('@react-navigation/native'),
14
- useNavigation: () => ({
15
- navigate: mockNavigate,
16
- }),
17
- };
18
- });
19
-
20
10
  const wrapComponent = (showingPopover) => (
21
11
  <SCProvider initState={mockSCStore({})}>
22
12
  <MoreMenu showingPopover={showingPopover} hidePopover={mockHidePopover} />
@@ -54,6 +44,6 @@ describe('Test MoreMenu', () => {
54
44
  await menuActionMore.props.onItemClick({ route: 'DeviceDetail' });
55
45
  });
56
46
  expect(mockHidePopover).toBeCalled();
57
- expect(mockNavigate).toBeCalledWith('DeviceDetail', undefined);
47
+ expect(global.mockedNavigate).toBeCalledWith('DeviceDetail', undefined);
58
48
  });
59
49
  });
@@ -20,16 +20,6 @@ const wrapComponent = (route) => (
20
20
 
21
21
  const mock = new MockAdapter(api.axiosInstance);
22
22
 
23
- const mockGoBack = jest.fn();
24
- jest.mock('@react-navigation/native', () => {
25
- return {
26
- ...jest.requireActual('@react-navigation/native'),
27
- useNavigation: () => ({
28
- goBack: mockGoBack,
29
- }),
30
- };
31
- });
32
-
33
23
  describe('Test SelectAddToFavorites', () => {
34
24
  let tree, route;
35
25
  let dataDevice = [
@@ -101,7 +91,6 @@ describe('Test SelectAddToFavorites', () => {
101
91
  ];
102
92
 
103
93
  beforeEach(() => {
104
- mockGoBack.mockClear();
105
94
  mock.resetHistory();
106
95
  route = {
107
96
  params: {
@@ -165,7 +154,7 @@ describe('Test SelectAddToFavorites', () => {
165
154
  await bottomButton.props.onPressMain();
166
155
  });
167
156
  expect(mock.history.post).toHaveLength(2);
168
- expect(mockGoBack).toBeCalled();
157
+ expect(global.mockedGoBack).toBeCalled();
169
158
  });
170
159
 
171
160
  it('test select only devices then click done', async () => {
@@ -198,7 +187,7 @@ describe('Test SelectAddToFavorites', () => {
198
187
  await bottomButton.props.onPressMain();
199
188
  });
200
189
  expect(mock.history.post).toHaveLength(1);
201
- expect(mockGoBack).toBeCalled();
190
+ expect(global.mockedGoBack).toBeCalled();
202
191
  });
203
192
 
204
193
  it('test select only scripts then click done', async () => {
@@ -227,7 +216,7 @@ describe('Test SelectAddToFavorites', () => {
227
216
  await bottomButton.props.onPressMain();
228
217
  });
229
218
  expect(mock.history.post).toHaveLength(1);
230
- expect(mockGoBack).toBeCalled();
219
+ expect(global.mockedGoBack).toBeCalled();
231
220
  });
232
221
 
233
222
  it('test click done call api fail not goBack', async () => {
@@ -28,18 +28,6 @@ const wrapComponent = (route) => (
28
28
 
29
29
  const mock = new MockAdapter(api.axiosInstance);
30
30
 
31
- const mockNavigate = jest.fn();
32
- const mockGoBack = jest.fn();
33
- jest.mock('@react-navigation/native', () => {
34
- return {
35
- ...jest.requireActual('@react-navigation/native'),
36
- useNavigation: () => ({
37
- navigate: mockNavigate,
38
- goBack: mockGoBack,
39
- }),
40
- };
41
- });
42
-
43
31
  jest.mock('react-native-maps', () => {
44
32
  const { forwardRef } = require('react');
45
33
  const { View } = require('react-native');
@@ -105,7 +93,6 @@ describe('Test SelectAddress', () => {
105
93
  },
106
94
  };
107
95
  mockUpdateLocation.mockClear();
108
- mockGoBack.mockClear();
109
96
  mock.resetHistory();
110
97
  });
111
98
 
@@ -119,7 +106,7 @@ describe('Test SelectAddress', () => {
119
106
  await bottomButton.props.onPressMain();
120
107
  });
121
108
  expect(mockUpdateLocation).not.toBeCalled();
122
- expect(mockGoBack).not.toBeCalled();
109
+ expect(global.mockedGoBack).not.toBeCalled();
123
110
  });
124
111
 
125
112
  it('test search location', async () => {
@@ -176,7 +163,7 @@ describe('Test SelectAddress', () => {
176
163
  await bottomButton.props.onPressMain();
177
164
  });
178
165
  expect(mockUpdateLocation).toBeCalledWith('1');
179
- expect(mockGoBack).toBeCalled();
166
+ expect(global.mockedGoBack).toBeCalled();
180
167
  });
181
168
 
182
169
  it('test chose search result will center map', async () => {
@@ -336,7 +323,7 @@ describe('Test SelectAddress', () => {
336
323
  await act(async () => {
337
324
  await bottomButton.props.onPressMain();
338
325
  });
339
- expect(mockGoBack).toBeCalled();
326
+ expect(global.mockedGoBack).not.toBeCalled();
340
327
  });
341
328
 
342
329
  it('test get current location failed permission denied', async () => {
@@ -469,6 +456,6 @@ describe('Test SelectAddress', () => {
469
456
  await act(async () => {
470
457
  await button.props.onPress();
471
458
  });
472
- expect(mockNavigate).toBeCalled();
459
+ expect(global.mockedNavigate).toBeCalled();
473
460
  });
474
461
  });
@@ -50,9 +50,9 @@ describe('Test SmartAccount', () => {
50
50
  },
51
51
  ],
52
52
  };
53
- const mockNavigate = useNavigation().navigate;
53
+ const mockedNavigate = useNavigation().navigate;
54
54
  beforeEach(() => {
55
- mockNavigate.mockReset();
55
+ mockedNavigate.mockReset();
56
56
  mock.resetHistory();
57
57
  });
58
58
 
@@ -79,15 +79,18 @@ describe('Test SmartAccount', () => {
79
79
  await act(async () => {
80
80
  await alertAction[0].props.leftButtonClick();
81
81
  });
82
- expect(mockNavigate).toHaveBeenCalledWith(Routes.SmartAccountStack, {
83
- screen: Routes.ListDeviceSmartAccount,
84
- params: {
85
- username: response.data[0].username,
86
- brand: response.data[0].brand,
87
- smart_account_id: response.data[0].id,
88
- unit_id: route.params.unitId,
89
- },
90
- });
82
+ expect(global.mockedNavigate).toHaveBeenCalledWith(
83
+ Routes.SmartAccountStack,
84
+ {
85
+ screen: Routes.ListDeviceSmartAccount,
86
+ params: {
87
+ username: response.data[0].username,
88
+ brand: response.data[0].brand,
89
+ smart_account_id: response.data[0].id,
90
+ unit_id: route.params.unitId,
91
+ },
92
+ }
93
+ );
91
94
  const menuActionMore = instance.findByType(MenuActionMore);
92
95
  await act(async () => {
93
96
  menuActionMore.props.onItemClick({ action: 'remove' });
@@ -19,17 +19,6 @@ const wrapComponent = (route) => (
19
19
  </SCProvider>
20
20
  );
21
21
 
22
- const mockedNavigate = jest.fn();
23
-
24
- jest.mock('@react-navigation/native', () => {
25
- return {
26
- ...jest.requireActual('@react-navigation/native'),
27
- useNavigation: () => ({
28
- goBack: mockedNavigate,
29
- }),
30
- };
31
- });
32
-
33
22
  describe('Test SmartAccountItem', () => {
34
23
  let tree;
35
24
  it('test render SmartAccountItem', async () => {