@eohjsc/react-native-smart-city 0.6.2-rc9 → 0.7.0

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 (304) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +10 -19
  3. package/package.json +53 -70
  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__/ItemPasscode.test.js +2 -2
  8. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +3 -3
  9. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
  10. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
  11. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +0 -15
  12. package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +2 -2
  13. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -2
  14. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +2 -2
  15. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +5 -5
  16. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +5 -5
  17. package/src/commons/ActionGroup/TerminalBoxTemplate.js +2 -2
  18. package/src/commons/ActionGroup/TextBoxTemplate.js +2 -2
  19. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonTemplate.test.js +4 -4
  20. package/src/commons/ActionGroup/TimerActionTemplate.js +4 -5
  21. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
  22. package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +4 -9
  23. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +2 -9
  24. package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +4 -11
  25. package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +2 -9
  26. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +4 -18
  27. package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +2 -2
  28. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +1 -8
  29. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +0 -7
  30. package/src/commons/ActionGroup/__test__/SwitchButtonTemplate.test.js +4 -15
  31. package/src/commons/ActionGroup/__test__/TerminalBoxTemplate.test.js +0 -7
  32. package/src/commons/ActionGroup/__test__/TextBoxTemplate.test.js +1 -8
  33. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +8 -15
  34. package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +2 -10
  35. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +3 -20
  36. package/src/commons/ActionGroup/__test__/index.test.js +15 -23
  37. package/src/commons/ActionTemplate/__test__/index.test.js +2 -0
  38. package/src/commons/ActionTemplate/__test__/utils.js +21 -0
  39. package/src/commons/ActionTemplate/index.js +1 -2
  40. package/src/commons/BackDefault/index.js +2 -2
  41. package/src/commons/ButtonPopup/index.js +2 -2
  42. package/src/commons/Calendar/__test__/Calendar.test.js +0 -7
  43. package/src/commons/CircleButton/__test__/CircleButton.test.js +2 -2
  44. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +11 -25
  45. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +27 -20
  46. package/src/commons/Dashboard/MyUnit/index.js +0 -1
  47. package/src/commons/DateTimeRangeChange/DateTimeButton.js +2 -2
  48. package/src/commons/DateTimeRangeChange/__test__/DateTimeButton.test.js +4 -4
  49. package/src/commons/DateTimeRangeChange/index.js +2 -2
  50. package/src/commons/Device/ConnectedViewHeader.js +2 -2
  51. package/src/commons/Device/DisconnectedView.js +2 -2
  52. package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
  53. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +2 -2
  54. package/src/commons/Device/FlatListItems.js +3 -3
  55. package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
  56. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -11
  57. package/src/commons/Device/ItemAddNew/index.js +2 -2
  58. package/src/commons/Device/ItemDevice.js +2 -2
  59. package/src/commons/Device/SonosSpeaker/index.js +3 -3
  60. package/src/commons/Device/WaterPurifierStatus/AlertStatusMachine.js +2 -2
  61. package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +2 -6
  62. package/src/commons/DisplayChecking/index.js +2 -2
  63. package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
  64. package/src/commons/EmergencyButton/AlertSent.js +6 -2
  65. package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
  66. package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +5 -5
  67. package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +9 -9
  68. package/src/commons/Form/CurrencyInput.js +1 -15
  69. package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +1 -22
  70. package/src/commons/Header/HeaderCustom.js +8 -3
  71. package/src/commons/HeaderAni/index.js +2 -2
  72. package/src/commons/IconComponent/index.js +3 -3
  73. package/src/commons/MediaPlayerDetail/MediaPlayerFull.js +1 -1
  74. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerFull.test.js +12 -48
  75. package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +1 -1
  76. package/src/commons/MenuActionList/__test__/MenuActionList.test.js +1 -0
  77. package/src/commons/NavBar/index.js +2 -2
  78. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
  79. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +1 -13
  80. package/src/commons/Processing/__test__/Connecting.test.js +3 -14
  81. package/src/commons/SearchLocation/index.js +3 -3
  82. package/src/commons/SelectActionCard/index.js +2 -2
  83. package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +1 -18
  84. package/src/commons/SelectSubUnit/index.js +2 -2
  85. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +1 -13
  86. package/src/commons/Sharing/BtnRemoveMember.js +2 -2
  87. package/src/commons/Sharing/StationDevicePermissions.js +2 -2
  88. package/src/commons/Sharing/WrapHeaderScrollable.js +1 -1
  89. package/src/commons/Sharing/__test__/ButtonRemoveMember.test.js +2 -2
  90. package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -1
  91. package/src/commons/SubUnit/DeviceTemplate/ConfigAndEvaluation/ConfigAndEvaluation.js +2 -2
  92. package/src/commons/SubUnit/DeviceTemplate/ConfigValue/ConfigValue.js +2 -2
  93. package/src/commons/SubUnit/DeviceTemplate/EvaluationOverConfig/EvaluationOverConfig.js +2 -2
  94. package/src/commons/SubUnit/Item/index.js +3 -3
  95. package/src/commons/SubUnit/OneTap/ItemOneTap.js +2 -2
  96. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +11 -8
  97. package/src/commons/SubUnit/__test__/Favorites.test.js +1 -13
  98. package/src/commons/SubUnit/__test__/ShortDetail.test.js +5 -16
  99. package/src/commons/SummaryItem/index.js +22 -23
  100. package/src/commons/Tabbar/__test__/index.test.js +0 -11
  101. package/src/commons/Unit/HeaderUnit/index.js +84 -84
  102. package/src/commons/Unit/SharedUnit.js +7 -7
  103. package/src/commons/Unit/__test__/HeaderUnit.test.js +29 -52
  104. package/src/commons/Unit/__test__/SharedUnit.test.js +94 -105
  105. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +11 -30
  106. package/src/commons/WrapParallaxScrollView/index.js +21 -50
  107. package/src/configs/API.js +1 -2
  108. package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +4 -15
  109. package/src/hooks/Common/useIsOwnerOfUnit.js +1 -1
  110. package/src/hooks/IoT/__test__/useRemoteControl.test.js +1 -1
  111. package/src/hooks/IoT/__test__/useWatchConfigs.test.js +6 -21
  112. package/src/iot/RemoteControl/HomeAssistant.js +1 -1
  113. package/src/iot/RemoteControl/__test__/Bluetooth.test.js +234 -232
  114. package/src/navigations/AutomateStack.js +2 -2
  115. package/src/navigations/EmergencyContactsStack.js +2 -2
  116. package/src/navigations/SharedStack.js +6 -4
  117. package/src/navigations/UnitStack.js +2 -10
  118. package/src/screens/ActivityLog/hooks/index.js +7 -4
  119. package/src/screens/ActivityLog/index.js +2 -2
  120. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +4 -21
  121. package/src/screens/AddCommon/__test__/SelectUnit.test.js +7 -19
  122. package/src/screens/AddLocationMaps/__test__/index.test.js +3 -13
  123. package/src/screens/AddLocationMaps/index.js +11 -6
  124. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +3 -20
  125. package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +11 -18
  126. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +4 -21
  127. package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
  128. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +3 -3
  129. package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +0 -17
  130. package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +4 -19
  131. package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +3 -15
  132. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +31 -51
  133. package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +9 -22
  134. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +12 -19
  135. package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +6 -16
  136. package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +4 -15
  137. package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +3 -3
  138. package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +18 -10
  139. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +1 -1
  140. package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +12 -9
  141. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +12 -9
  142. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +7 -21
  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 +6 -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 +7 -7
  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 +1 -23
  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 +0 -12
  186. package/src/screens/Device/detail.js +14 -12
  187. package/src/screens/Drawer/Drawer.test.js +3 -11
  188. package/src/screens/Drawer/index.js +3 -4
  189. package/src/screens/EmergencyContacts/EmergencyContactsList.js +4 -8
  190. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -3
  191. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +4 -17
  192. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +3 -14
  193. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +0 -10
  194. package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
  195. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +4 -17
  196. package/src/screens/GuestInfo/__test__/index.test.js +0 -11
  197. package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
  198. package/src/screens/GuestInfo/index.js +2 -2
  199. package/src/screens/HanetCamera/Detail.js +6 -2
  200. package/src/screens/HanetCamera/ManageAccess.js +3 -4
  201. package/src/screens/HanetCamera/MemberInfo.js +4 -4
  202. package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +2 -16
  203. package/src/screens/HanetCamera/__test__/Detail.test.js +1 -12
  204. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +5 -16
  205. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +5 -18
  206. package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
  207. package/src/screens/ManageAccess/__test__/ManageAccess.test.js +3 -19
  208. package/src/screens/ManageAccess/index.js +3 -3
  209. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +7 -7
  210. package/src/screens/Notification/__test__/Notification.test.js +5 -15
  211. package/src/screens/Notification/__test__/NotificationItem.test.js +9 -19
  212. package/src/screens/Notification/index.js +5 -5
  213. package/src/screens/PlayBackCamera/__test__/index.test.js +13 -22
  214. package/src/screens/PlayBackCamera/index.js +2 -2
  215. package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +0 -11
  216. package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
  217. package/src/screens/SelectUnit/__test__/index.test.js +9 -29
  218. package/src/screens/SelectUnit/index.js +2 -2
  219. package/src/screens/SharedUnit/TabHeader.js +2 -2
  220. package/src/screens/Sharing/Components/EndDevice.js +3 -3
  221. package/src/screens/Sharing/SelectUser.js +5 -4
  222. package/src/screens/Sharing/UnitMemberList.js +7 -6
  223. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +9 -4
  224. package/src/screens/Sharing/__test__/SelectShareDevice.test.js +2 -15
  225. package/src/screens/Sharing/__test__/SelectUser.test.js +2 -22
  226. package/src/screens/Sharing/__test__/UnitMemberList.test.js +2 -2
  227. package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +4 -17
  228. package/src/screens/Sharing/hooks/__test__/index.test.js +2 -13
  229. package/src/screens/SmartAccount/Connecting/index.js +0 -2
  230. package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +3 -18
  231. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +11 -21
  232. package/src/screens/SmartAccount/SuccessfullyConnected/index.js +3 -4
  233. package/src/screens/SmartAccount/__test__/Connecting.test.js +30 -36
  234. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +12 -21
  235. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +8 -17
  236. package/src/screens/SmartIr/__test__/SelectBrand.test.js +1 -11
  237. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +1 -12
  238. package/src/screens/SmartIr/__test__/SmartIr.test.js +3 -11
  239. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +6 -5
  240. package/src/screens/SmartIr/components/SelectBrand.js +2 -2
  241. package/src/screens/SubUnit/AddSubUnit.js +1 -0
  242. package/src/screens/SubUnit/EditSubUnit.js +3 -2
  243. package/src/screens/SubUnit/ManageSubUnit.js +5 -5
  244. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -31
  245. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +12 -30
  246. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +2 -2
  247. package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +0 -12
  248. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +7 -20
  249. package/src/screens/Template/__test__/EditTemplate.test.js +4 -15
  250. package/src/screens/Template/__test__/GatewayList.test.js +0 -9
  251. package/src/screens/Template/__test__/detail.test.js +8 -8
  252. package/src/screens/Template/__test__/index.test.js +3 -14
  253. package/src/screens/Template/detail.js +2 -2
  254. package/src/screens/Unit/Detail.js +12 -53
  255. package/src/screens/Unit/SelectAddToFavorites.js +2 -2
  256. package/src/screens/Unit/SelectAddress.js +9 -4
  257. package/src/screens/Unit/SmartAccountItem.js +2 -2
  258. package/src/screens/Unit/Station/__test__/index.test.js +2 -2
  259. package/src/screens/Unit/Summaries.js +24 -29
  260. package/src/screens/Unit/__test__/AddMenu.test.js +5 -2
  261. package/src/screens/Unit/__test__/CheckSendEmail.test.js +0 -12
  262. package/src/screens/Unit/__test__/ChooseLocation.test.js +1 -4
  263. package/src/screens/Unit/__test__/Detail.test.js +14 -12
  264. package/src/screens/Unit/__test__/ManageUnit.test.js +2 -17
  265. package/src/screens/Unit/__test__/MoreMenu.test.js +1 -11
  266. package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +3 -14
  267. package/src/screens/Unit/__test__/SelectAddress.test.js +4 -17
  268. package/src/screens/Unit/__test__/SmartAccount.test.js +14 -11
  269. package/src/screens/Unit/__test__/SmartAccountItem.test.js +0 -11
  270. package/src/screens/Unit/__test__/Summaries.test.js +2 -14
  271. package/src/screens/Unit/components/AutomateScript/index.js +2 -2
  272. package/src/screens/Unit/components/ButtonWrapper/index.js +3 -4
  273. package/src/screens/Unit/components/Header/index.js +5 -4
  274. package/src/screens/Unit/components/SharedUnit/index.js +5 -5
  275. package/src/screens/Unit/components/__test__/Header.test.js +1 -14
  276. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +1 -11
  277. package/src/screens/Unit/components/__test__/SharedUnit.test.js +1 -11
  278. package/src/screens/UnitSummary/__test__/index.test.js +51 -17
  279. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +8 -25
  280. package/src/screens/UnitSummary/components/AirQuality/__test__/index.test.js +1 -7
  281. package/src/screens/UnitSummary/components/AirQuality/index.js +8 -3
  282. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +0 -11
  283. package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +1 -16
  284. package/src/screens/UnitSummary/components/Temperature/index.js +5 -1
  285. package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +0 -8
  286. package/src/screens/UnitSummary/components/UvIndex/index.js +6 -2
  287. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +2 -2
  288. package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +14 -18
  289. package/src/screens/UnitSummary/components/__test__/UnitSummary.test.js +8 -8
  290. package/src/screens/UnitSummary/index.js +4 -8
  291. package/src/utils/Converter/__test__/timer.test.js +8 -0
  292. package/src/utils/Functions/preloadImages.js +13 -14
  293. package/src/utils/Monitor.js +2 -3
  294. package/src/utils/Route/index.js +0 -1
  295. package/src/utils/Storage.js +1 -1
  296. package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +0 -48
  297. package/src/commons/Device/WindSpeed/LinearChart/index.js +0 -155
  298. package/src/screens/AddNewGateway/hooks/__Tests__/index.test.js +0 -27
  299. package/src/screens/AddNewGateway/hooks/index.js +0 -31
  300. package/src/screens/SubUnit/Detail.js +0 -150
  301. package/src/screens/SubUnit/__test__/Detail.test.js +0 -125
  302. package/src/screens/UnitSummary/components/Temperature/ChartAverage/index.js +0 -62
  303. package/src/screens/UnitSummary/components/Temperature/__test__/ChartAverage.test.js +0 -17
  304. package/src/utils/dateHelper/getTickValues.js +0 -22
@@ -15,19 +15,6 @@ import Routes from '../../../utils/Route';
15
15
 
16
16
  const mock = new MockAdapter(api.axiosInstance);
17
17
 
18
- const mockedGoBack = jest.fn();
19
- const mockedNavigate = jest.fn();
20
- jest.mock('@react-navigation/native', () => {
21
- return {
22
- ...jest.requireActual('@react-navigation/native'),
23
- useNavigation: () => ({
24
- navigate: mockedNavigate,
25
- goBack: mockedGoBack,
26
- }),
27
- useIsFocused: () => ({}),
28
- };
29
- });
30
-
31
18
  const wrapComponent = (route) => (
32
19
  <SCProvider initState={mockSCStore({})}>
33
20
  <AddCommonSelectSubUnit route={route} />
@@ -35,10 +22,6 @@ const wrapComponent = (route) => (
35
22
  );
36
23
 
37
24
  describe('Test SelectSubUnit', () => {
38
- beforeEach(() => {
39
- mockedNavigate.mockClear();
40
- mockedGoBack.mockClear();
41
- });
42
25
  let tree;
43
26
 
44
27
  it('test ViewButtonBottom onRightClick', async () => {
@@ -51,14 +34,14 @@ describe('Test SelectSubUnit', () => {
51
34
  await act(async () => {
52
35
  viewButtonBottom.props.onRightClick();
53
36
  });
54
- expect(mockedNavigate).toHaveBeenCalled();
37
+ expect(global.mockedNavigate).toHaveBeenCalled();
55
38
  });
56
39
  });
57
40
 
58
41
  describe('Test SelectSubUnit container', () => {
59
42
  beforeEach(() => {
60
- mockedNavigate.mockClear();
61
- mockedGoBack.mockClear();
43
+ global.mockedNavigate.mockClear();
44
+ global.mockedGoBack.mockClear();
62
45
  });
63
46
  let tree;
64
47
  const list_type = ['AddHassiDevice'];
@@ -109,7 +92,7 @@ describe('Test SelectSubUnit container', () => {
109
92
 
110
93
  switch (type) {
111
94
  case 'AddHassiDevice':
112
- expect(mockedNavigate).toHaveBeenCalledWith(
95
+ expect(global.mockedNavigate).toHaveBeenCalledWith(
113
96
  Routes.SmartAccountStack,
114
97
  {
115
98
  screen: Routes.SmartAccountConnecting,
@@ -14,18 +14,6 @@ import SelectUnit from '../../../commons/SelectUnit';
14
14
 
15
15
  const mock = new MockAdapter(api.axiosInstance);
16
16
 
17
- const mockedGoBack = jest.fn();
18
- const mockedNavigate = jest.fn();
19
- jest.mock('@react-navigation/native', () => {
20
- return {
21
- ...jest.requireActual('@react-navigation/native'),
22
- useNavigation: () => ({
23
- navigate: mockedNavigate,
24
- goBack: mockedGoBack,
25
- }),
26
- };
27
- });
28
-
29
17
  const wrapComponent = (route) => (
30
18
  <SCProvider initState={mockSCStore({})}>
31
19
  <AddCommonSelectUnit route={route} />
@@ -34,8 +22,8 @@ const wrapComponent = (route) => (
34
22
 
35
23
  describe('Test SelectUnit container', () => {
36
24
  beforeEach(() => {
37
- mockedNavigate.mockClear();
38
- mockedGoBack.mockClear();
25
+ global.mockedNavigate.mockClear();
26
+ global.mockedGoBack.mockClear();
39
27
  });
40
28
 
41
29
  beforeEach(() => {
@@ -115,12 +103,12 @@ describe('Test SelectUnit container', () => {
115
103
 
116
104
  switch (type) {
117
105
  case 'AddSubUnit':
118
- expect(mockedNavigate).toBeCalledWith('AddSubUnit', {
106
+ expect(global.mockedNavigate).toBeCalledWith('AddSubUnit', {
119
107
  unit: { id: 1, name: 'Unit 1' },
120
108
  });
121
109
  break;
122
110
  case 'AddDevice':
123
- expect(mockedNavigate).toBeCalledWith('AddGatewayStack', {
111
+ expect(global.mockedNavigate).toBeCalledWith('AddGatewayStack', {
124
112
  screen: 'SelectDeviceType',
125
113
  params: {
126
114
  unit: {
@@ -131,12 +119,12 @@ describe('Test SelectUnit container', () => {
131
119
  });
132
120
  break;
133
121
  case 'AddMember':
134
- expect(mockedNavigate).toBeCalledWith('SelectShareDevice', {
122
+ expect(global.mockedNavigate).toBeCalledWith('SelectShareDevice', {
135
123
  unit: { id: 1, name: 'Unit 1' },
136
124
  });
137
125
  break;
138
126
  case 'AddLGDevice':
139
- expect(mockedNavigate).toBeCalledWith('AddLGDevice', {
127
+ expect(global.mockedNavigate).toBeCalledWith('AddLGDevice', {
140
128
  code: 'CODE',
141
129
  backend_url: 'https://doamin.com/',
142
130
  unit_id: 1,
@@ -237,6 +225,6 @@ describe('test single SelectUnit', () => {
237
225
  await act(async () => {
238
226
  goBack.props.onPress();
239
227
  });
240
- expect(mockedGoBack).toBeCalled();
228
+ expect(global.mockedGoBack).toBeCalled();
241
229
  });
242
230
  });
@@ -16,6 +16,7 @@ import {
16
16
  OpenSetting,
17
17
  } from '../../../utils/Permission/common';
18
18
  import { RESULTS } from 'react-native-permissions';
19
+ import { useNavigation } from '@react-navigation/native';
19
20
 
20
21
  const wrapComponent = (route) => (
21
22
  <SCProvider initState={mockSCStore({})}>
@@ -25,18 +26,6 @@ const wrapComponent = (route) => (
25
26
 
26
27
  const mock = new MockAdapter(api.axiosInstance);
27
28
 
28
- const mockNavigate = jest.fn();
29
- const mockGoBack = jest.fn();
30
- jest.mock('@react-navigation/native', () => {
31
- return {
32
- ...jest.requireActual('@react-navigation/native'),
33
- useNavigation: () => ({
34
- navigate: mockNavigate,
35
- goBack: mockGoBack,
36
- }),
37
- };
38
- });
39
-
40
29
  jest.mock('react-native-maps', () => {
41
30
  const { forwardRef } = require('react');
42
31
  const { View } = require('react-native');
@@ -83,6 +72,7 @@ jest.mock('react-native-permissions', () => {
83
72
  describe('Test SelectAddress', () => {
84
73
  let tree, route, Platform;
85
74
  const mockUpdateLocation = jest.fn();
75
+ const { navigate } = useNavigation();
86
76
 
87
77
  beforeAll(() => {
88
78
  Platform = require('react-native').Platform;
@@ -259,6 +249,6 @@ describe('Test SelectAddress', () => {
259
249
  await act(async () => {
260
250
  await button.props.onPress();
261
251
  });
262
- expect(mockNavigate).toBeCalled();
252
+ expect(navigate).toBeCalled();
263
253
  });
264
254
  });
@@ -2,7 +2,8 @@ import React, { memo, useState, useCallback, useRef, useEffect } from 'react';
2
2
  import { View, ScrollView, TouchableOpacity } 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
+ import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
6
7
  import { check, RESULTS } from 'react-native-permissions';
7
8
  import { useTranslations } from '../../hooks/Common/useTranslations';
8
9
 
@@ -204,7 +205,11 @@ const AddLocationMaps = memo(() => {
204
205
  style={styles.button}
205
206
  accessibilityLabel={AccessibilityLabel.BUTTON_YOUR_LOCATION}
206
207
  >
207
- <IconOutline name="aim" size={27} color={Colors.Primary} />
208
+ <MaterialIcons
209
+ name="my-location"
210
+ size={27}
211
+ color={Colors.Primary}
212
+ />
208
213
  <Text
209
214
  type="Body"
210
215
  color={Colors.Gray9}
@@ -220,8 +225,8 @@ const AddLocationMaps = memo(() => {
220
225
  style={styles.button}
221
226
  accessibilityLabel={AccessibilityLabel.BUTTON_CHOOSE_ON_MAP}
222
227
  >
223
- <IconFill
224
- name="environment"
228
+ <AntDesign
229
+ name="enviroment"
225
230
  size={27}
226
231
  color={Colors.Primary}
227
232
  />
@@ -269,8 +274,8 @@ const AddLocationMaps = memo(() => {
269
274
  }}
270
275
  tracksViewChanges={false}
271
276
  >
272
- <IconFill
273
- name="environment"
277
+ <AntDesign
278
+ name="enviroment"
274
279
  size={27}
275
280
  color={Colors.Blue10}
276
281
  />
@@ -22,27 +22,10 @@ const wrapComponent = (route) => (
22
22
 
23
23
  const mock = new MockAdapter(api.axiosInstance);
24
24
 
25
- const mockedNavigate = jest.fn();
26
- const mockedGoBack = jest.fn();
27
-
28
- jest.mock('@react-navigation/native', () => {
29
- return {
30
- ...jest.requireActual('@react-navigation/native'),
31
- useNavigation: () => ({
32
- navigate: mockedNavigate,
33
- goBack: mockedGoBack,
34
- }),
35
- };
36
- });
37
-
38
25
  describe('Test AddNewDevice', () => {
39
26
  let tree;
40
27
  let route;
41
28
 
42
- afterEach(() => {
43
- mockedNavigate.mockClear();
44
- });
45
-
46
29
  beforeEach(() => {
47
30
  route = {
48
31
  params: {
@@ -145,7 +128,7 @@ describe('Test AddNewDevice', () => {
145
128
  await act(async () => {
146
129
  viewButtonBottom.props.onLeftClick();
147
130
  });
148
- expect(mockedGoBack).toHaveBeenCalled();
131
+ expect(global.mockedGoBack).toHaveBeenCalled();
149
132
  });
150
133
 
151
134
  it('ViewButtonBottom onRightClick without select stationId', async () => {
@@ -157,7 +140,7 @@ describe('Test AddNewDevice', () => {
157
140
  await act(async () => {
158
141
  viewButtonBottom.props.onRightClick();
159
142
  });
160
- expect(mockedNavigate).toHaveBeenCalled();
143
+ expect(global.mockedNavigate).toHaveBeenCalled();
161
144
  });
162
145
 
163
146
  it('ViewButtonBottom onRightClick with stationId', async () => {
@@ -181,7 +164,7 @@ describe('Test AddNewDevice', () => {
181
164
  await act(async () => {
182
165
  viewButtonBottom.props.onRightClick();
183
166
  });
184
- expect(mockedNavigate).toHaveBeenCalledWith(Routes.ScanSensorQR, {
167
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScanSensorQR, {
185
168
  station_id: 2,
186
169
  unit_id: 1,
187
170
  unit_name: 'Unit name',
@@ -9,19 +9,6 @@ import { mockSCStore } from '../../../../context/mockStore';
9
9
  import { ViewButtonBottom } from '../../../../commons';
10
10
  import Routes from '../../../../utils/Route';
11
11
 
12
- const mockedGoBack = jest.fn();
13
- const mockedNavigate = jest.fn();
14
- jest.mock('@react-navigation/native', () => {
15
- return {
16
- ...jest.requireActual('@react-navigation/native'),
17
- useNavigation: () => ({
18
- navigate: mockedNavigate,
19
- goBack: mockedGoBack,
20
- }),
21
- useIsFocused: () => ({}),
22
- };
23
- });
24
-
25
12
  const wrapComponent = (route) => (
26
13
  <SCProvider initState={mockSCStore({})}>
27
14
  <FirstWarning route={route} />
@@ -32,7 +19,7 @@ describe('Test FirstWarning', () => {
32
19
  let tree;
33
20
 
34
21
  beforeEach(async () => {
35
- mockedNavigate.mockClear();
22
+ global.mockedNavigate.mockClear();
36
23
  });
37
24
 
38
25
  it('create', async () => {
@@ -58,21 +45,27 @@ describe('Test FirstWarning', () => {
58
45
  await act(async () => {
59
46
  viewButtonBottom.props.onRightClick();
60
47
  });
61
- expect(mockedNavigate).toHaveBeenCalled();
48
+ expect(global.mockedNavigate).toHaveBeenCalled();
62
49
  };
63
50
 
64
51
  it('test ViewButtonBottom onRightClick from dashboard', async () => {
65
52
  await rightClick({});
66
- expect(mockedNavigate.mock.calls[0][0]).toEqual(Routes.SelectDeviceUnit);
53
+ expect(global.mockedNavigate.mock.calls[0][0]).toEqual(
54
+ Routes.SelectDeviceUnit
55
+ );
67
56
  });
68
57
 
69
58
  it('test ViewButtonBottom onRightClick from unit', async () => {
70
59
  await rightClick({ unitId: 1 });
71
- expect(mockedNavigate.mock.calls[0][0]).toEqual(Routes.SelectDeviceType);
60
+ expect(global.mockedNavigate.mock.calls[0][0]).toEqual(
61
+ Routes.SelectDeviceType
62
+ );
72
63
  });
73
64
 
74
65
  it('test ViewButtonBottom onRightClick from sub-unit', async () => {
75
66
  await rightClick({ unitId: 1, stationId: 1 });
76
- expect(mockedNavigate.mock.calls[0][0]).toEqual(Routes.SelectDeviceType);
67
+ expect(global.mockedNavigate.mock.calls[0][0]).toEqual(
68
+ Routes.SelectDeviceType
69
+ );
77
70
  });
78
71
  });
@@ -8,19 +8,7 @@ import { SCProvider } from '../../../../context';
8
8
  import { mockSCStore } from '../../../../context/mockStore';
9
9
  import { ViewButtonBottom } from '../../../../commons';
10
10
  import Routes from '../../../../utils/Route';
11
-
12
- const mockedGoBack = jest.fn();
13
- const mockedNavigate = jest.fn();
14
- jest.mock('@react-navigation/native', () => {
15
- return {
16
- ...jest.requireActual('@react-navigation/native'),
17
- useNavigation: () => ({
18
- navigate: mockedNavigate,
19
- goBack: mockedGoBack,
20
- }),
21
- useIsFocused: () => ({}),
22
- };
23
- });
11
+ import { useNavigation } from '@react-navigation/native';
24
12
 
25
13
  const wrapComponent = (route) => (
26
14
  <SCProvider initState={mockSCStore({})}>
@@ -30,10 +18,7 @@ const wrapComponent = (route) => (
30
18
 
31
19
  describe('Test ZigbeeDeviceConnectGuide', () => {
32
20
  let tree;
33
-
34
- beforeEach(async () => {
35
- mockedNavigate.mockClear();
36
- });
21
+ const { navigate } = useNavigation();
37
22
 
38
23
  it('create', async () => {
39
24
  await act(async () => {
@@ -58,13 +43,11 @@ describe('Test ZigbeeDeviceConnectGuide', () => {
58
43
  await act(async () => {
59
44
  viewButtonBottom.props.onRightClick();
60
45
  });
61
- expect(mockedNavigate).toHaveBeenCalled();
46
+ expect(navigate).toHaveBeenCalled();
62
47
  };
63
48
 
64
49
  it('test click next', async () => {
65
50
  await rightClick();
66
- expect(mockedNavigate.mock.calls[0][0]).toEqual(
67
- Routes.ConnectingZigbeeDevice
68
- );
51
+ expect(navigate.mock.calls[0][0]).toEqual(Routes.ConnectingZigbeeDevice);
69
52
  });
70
53
  });
@@ -1,6 +1,6 @@
1
1
  import React, { memo, useCallback, useEffect, useState, useMemo } from 'react';
2
2
  import { ScrollView, TouchableOpacity, View } from 'react-native';
3
- import { IconOutline } from '@ant-design/icons-react-native';
3
+ import AntDesign from 'react-native-vector-icons/AntDesign';
4
4
  import { CommonActions, useNavigation } from '@react-navigation/native';
5
5
  import { useTranslations } from '../../hooks/Common/useTranslations';
6
6
  import { Colors } from '../../configs';
@@ -357,7 +357,7 @@ const RenameNewDevices = memo(({ route }) => {
357
357
  />
358
358
  <View style={styles.content}>
359
359
  <View style={styles.viewIconSuccess}>
360
- <IconOutline name="check-circle" size={28} color={Colors.Green6} />
360
+ <AntDesign name="check-circle" size={28} color={Colors.Green6} />
361
361
  <Text
362
362
  semibold
363
363
  color={Colors.Black}
@@ -112,7 +112,7 @@ describe('Test AddNewGateway', () => {
112
112
  await act(async () => {
113
113
  viewButtonBottom.props.onLeftClick();
114
114
  });
115
- expect(mockedGoBack).toHaveBeenCalled();
115
+ expect(global.mockedGoBack).toHaveBeenCalled();
116
116
  });
117
117
 
118
118
  it('ViewButtonBottom onRightClick without select stationId', async () => {
@@ -124,7 +124,7 @@ describe('Test AddNewGateway', () => {
124
124
  await act(async () => {
125
125
  viewButtonBottom.props.onRightClick();
126
126
  });
127
- expect(mockedNavigate).not.toHaveBeenCalled();
127
+ expect(global.mockedNavigate).not.toHaveBeenCalled();
128
128
  });
129
129
 
130
130
  it('ViewButtonBottom onRightClick with stationId', async () => {
@@ -147,6 +147,6 @@ describe('Test AddNewGateway', () => {
147
147
  await act(async () => {
148
148
  viewButtonBottom.props.onRightClick();
149
149
  });
150
- expect(mockedNavigate).not.toBeCalled();
150
+ expect(global.mockedNavigate).not.toBeCalled();
151
151
  });
152
152
  });
@@ -15,27 +15,10 @@ const wrapComponent = (route) => (
15
15
 
16
16
  const mock = new MockAdapter(api.axiosInstance);
17
17
 
18
- const mockedNavigate = jest.fn();
19
- const mockedGoBack = jest.fn();
20
-
21
- jest.mock('@react-navigation/native', () => {
22
- return {
23
- ...jest.requireActual('@react-navigation/native'),
24
- useNavigation: () => ({
25
- navigate: mockedNavigate,
26
- goBack: mockedGoBack,
27
- }),
28
- };
29
- });
30
-
31
18
  describe('Test connecting modbus device', () => {
32
19
  let tree;
33
20
  let route;
34
21
 
35
- afterEach(() => {
36
- mockedNavigate.mockClear();
37
- });
38
-
39
22
  beforeEach(() => {
40
23
  route = {
41
24
  params: {
@@ -11,6 +11,7 @@ import api from '../../../utils/Apis/axios';
11
11
  import Processing from '../../../commons/Processing';
12
12
  import ConnectingDevice from '../ConnectingDevice';
13
13
  import { API } from '../../../configs';
14
+ import { useNavigation } from '@react-navigation/native';
14
15
 
15
16
  const wrapComponent = (route) => (
16
17
  <SCProvider initState={mockSCStore({})}>
@@ -20,31 +21,15 @@ const wrapComponent = (route) => (
20
21
 
21
22
  const mock = new MockAdapter(api.axiosInstance);
22
23
  jest.spyOn(Alert, 'alert').mockImplementation(() => {});
23
- const mockedNavigate = jest.fn();
24
- const mockedGoBack = jest.fn();
25
-
26
- jest.mock('@react-navigation/native', () => {
27
- return {
28
- ...jest.requireActual('@react-navigation/native'),
29
- useNavigation: () => ({
30
- navigate: mockedNavigate,
31
- goBack: mockedGoBack,
32
- }),
33
- };
34
- });
35
24
 
36
25
  describe('Test connecting wifi device', () => {
37
26
  let tree;
38
27
  let route;
28
+ const { goBack } = useNavigation();
39
29
 
40
- afterEach(() => {
41
- mockedNavigate.mockClear();
42
- mockedGoBack.mockClear();
30
+ beforeEach(() => {
43
31
  Alert.alert.mockReset();
44
32
  mock.reset();
45
- });
46
-
47
- beforeEach(() => {
48
33
  jest.useFakeTimers();
49
34
  route = {
50
35
  params: {
@@ -96,6 +81,6 @@ describe('Test connecting wifi device', () => {
96
81
  await act(async () => {
97
82
  Alert.alert.mock.calls[1][2][0].onPress();
98
83
  });
99
- expect(mockedGoBack).toBeCalled();
84
+ expect(goBack).toBeCalled();
100
85
  });
101
86
  });
@@ -10,19 +10,7 @@ import ConnectingWifiGuide from '../ConnectingWifiGuide';
10
10
  import InteractSmartphoneIcon from '../../../../assets/images/AddNewDevice/interact-smartphone-icon.svg';
11
11
  import AccessibilityLabel from '../../../configs/AccessibilityLabel';
12
12
 
13
- const mockedGoBack = jest.fn();
14
- const mockedNavigate = jest.fn();
15
13
  jest.spyOn(Alert, 'alert').mockImplementation(() => {});
16
- jest.mock('@react-navigation/native', () => {
17
- return {
18
- ...jest.requireActual('@react-navigation/native'),
19
- useNavigation: () => ({
20
- navigate: mockedNavigate,
21
- goBack: mockedGoBack,
22
- }),
23
- useIsFocused: () => true,
24
- };
25
- });
26
14
 
27
15
  const wrapComponent = (route) => (
28
16
  <SCProvider initState={mockSCStore({})}>
@@ -146,7 +134,7 @@ describe('test share wifi password', () => {
146
134
  await act(async () => {
147
135
  Alert.alert.mock.calls[0][2][0].onPress();
148
136
  });
149
- expect(mockedGoBack).toBeCalled();
137
+ expect(global.mockedGoBack).toBeCalled();
150
138
  });
151
139
 
152
140
  it('fail connect to wifi android show error push retry', async () => {
@@ -244,7 +232,7 @@ describe('test share wifi password', () => {
244
232
  });
245
233
  // todo Bang should test wifi display
246
234
  expect(socket.close).toBeCalled();
247
- expect(mockedNavigate).toBeCalledWith(
235
+ expect(global.mockedNavigate).toBeCalledWith(
248
236
  'ShareWifiPassword',
249
237
  expect.objectContaining({
250
238
  qrData: {
@@ -262,7 +250,7 @@ describe('test share wifi password', () => {
262
250
  })
263
251
  );
264
252
 
265
- // expect(mockedNavigate.mock.calls[0][0]).toEqual(Routes.ShareWifiPassword);
253
+ // expect(global.mockedNavigate.mock.calls[0][0]).toEqual(Routes.ShareWifiPassword);
266
254
  });
267
255
 
268
256
  it('got error while request wifi list from device', async () => {
@@ -18,38 +18,12 @@ const wrapComponent = (route) => (
18
18
 
19
19
  const mock = new MockAdapter(api.axiosInstance);
20
20
 
21
- jest.mock('react-native', () => {
22
- const RN = jest.requireActual('react-native');
23
- return Object.setPrototypeOf(
24
- {
25
- Alert: {
26
- ...RN.Alert,
27
- alert: jest.fn(),
28
- },
29
- },
30
- RN
31
- );
32
- });
33
-
34
- const mockedNavigate = jest.fn();
35
- const mockedGoBack = jest.fn();
36
- jest.mock('@react-navigation/native', () => {
37
- return {
38
- ...jest.requireActual('@react-navigation/native'),
39
- useNavigation: () => ({
40
- navigate: mockedNavigate,
41
- goBack: mockedGoBack,
42
- }),
43
- };
44
- });
45
-
46
21
  describe('Test connecting modbus device', () => {
47
22
  let tree;
48
23
  let route;
49
24
 
50
25
  beforeEach(() => {
51
26
  getPusher().resetMock();
52
- mockedNavigate.mockClear();
53
27
  });
54
28
 
55
29
  beforeEach(() => {
@@ -108,18 +82,21 @@ describe('Test connecting modbus device', () => {
108
82
  await act(async () => {
109
83
  await channel.trigger('progress', { success: 1 });
110
84
  });
111
- expect(mockedNavigate).toHaveBeenCalledWith(Routes.RenameNewDevices, {
112
- addDeviceType: undefined,
113
- unit: {
114
- id: 1,
115
- },
116
- subUnit: {
117
- id: 2,
118
- station: 'Station 2',
119
- },
120
- chipId: 3,
121
- sensorId: 1,
122
- });
85
+ expect(global.mockedNavigate).toHaveBeenCalledWith(
86
+ Routes.RenameNewDevices,
87
+ {
88
+ addDeviceType: undefined,
89
+ unit: {
90
+ id: 1,
91
+ },
92
+ subUnit: {
93
+ id: 2,
94
+ station: 'Station 2',
95
+ },
96
+ chipId: 3,
97
+ sensorId: 1,
98
+ }
99
+ );
123
100
  });
124
101
 
125
102
  it('receive sensor from channel after rejoin zigbee', async () => {
@@ -142,18 +119,21 @@ describe('Test connecting modbus device', () => {
142
119
  await act(async () => {
143
120
  await channel.trigger('progress', { success: 1 });
144
121
  });
145
- expect(mockedNavigate).toHaveBeenCalledWith(Routes.RenameNewDevices, {
146
- addDeviceType: undefined,
147
- unit: {
148
- id: 1,
149
- },
150
- subUnit: {
151
- id: 2,
152
- station: 'Station 2',
153
- },
154
- chipId: 3,
155
- sensorId: 1,
156
- isRejoin: true,
157
- });
122
+ expect(global.mockedNavigate).toHaveBeenCalledWith(
123
+ Routes.RenameNewDevices,
124
+ {
125
+ addDeviceType: undefined,
126
+ unit: {
127
+ id: 1,
128
+ },
129
+ subUnit: {
130
+ id: 2,
131
+ station: 'Station 2',
132
+ },
133
+ chipId: 3,
134
+ sensorId: 1,
135
+ isRejoin: true,
136
+ }
137
+ );
158
138
  });
159
139
  });