@eohjsc/react-native-smart-city 0.6.2 → 0.7.3-rc1

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 (338) hide show
  1. package/README.md +3 -3
  2. package/android/build.gradle +7 -10
  3. package/assets/images/Automation-fill.svg +85 -0
  4. package/assets/images/Scenario-filled.svg +22 -0
  5. package/assets/images/schedule-fill.svg +48 -0
  6. package/package.json +53 -70
  7. package/src/commons/Action/ItemQuickAction.js +1 -1
  8. package/src/commons/Action/__test__/ItemQuickAction.test.js +2 -2
  9. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
  10. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +3 -3
  11. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/ItemPasscode.test.js +2 -2
  12. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +3 -3
  13. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
  14. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
  15. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +0 -15
  16. package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +2 -2
  17. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -2
  18. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +2 -2
  19. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +5 -5
  20. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +5 -5
  21. package/src/commons/ActionGroup/TerminalBoxTemplate.js +2 -2
  22. package/src/commons/ActionGroup/TextBoxTemplate.js +2 -2
  23. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonTemplate.test.js +4 -4
  24. package/src/commons/ActionGroup/TimerActionTemplate.js +4 -5
  25. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
  26. package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +4 -9
  27. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +2 -9
  28. package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +4 -11
  29. package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +2 -9
  30. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +4 -18
  31. package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +2 -2
  32. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +1 -8
  33. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +0 -7
  34. package/src/commons/ActionGroup/__test__/SwitchButtonTemplate.test.js +4 -15
  35. package/src/commons/ActionGroup/__test__/TerminalBoxTemplate.test.js +0 -7
  36. package/src/commons/ActionGroup/__test__/TextBoxTemplate.test.js +1 -8
  37. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +8 -15
  38. package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +2 -10
  39. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +3 -20
  40. package/src/commons/ActionGroup/__test__/index.test.js +15 -23
  41. package/src/commons/ActionTemplate/__test__/index.test.js +2 -0
  42. package/src/commons/ActionTemplate/__test__/utils.js +21 -0
  43. package/src/commons/ActionTemplate/index.js +1 -2
  44. package/src/commons/BackDefault/index.js +2 -2
  45. package/src/commons/ButtonPopup/index.js +2 -2
  46. package/src/commons/Calendar/__test__/Calendar.test.js +0 -7
  47. package/src/commons/CircleButton/__test__/CircleButton.test.js +2 -2
  48. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +11 -25
  49. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +27 -20
  50. package/src/commons/Dashboard/MyUnit/index.js +0 -1
  51. package/src/commons/DateTimeRangeChange/DateTimeButton.js +2 -2
  52. package/src/commons/DateTimeRangeChange/__test__/DateTimeButton.test.js +4 -4
  53. package/src/commons/DateTimeRangeChange/index.js +3 -3
  54. package/src/commons/Device/ConnectedViewHeader.js +2 -2
  55. package/src/commons/Device/DisconnectedView.js +2 -2
  56. package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
  57. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +2 -2
  58. package/src/commons/Device/FlatListItems.js +3 -3
  59. package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
  60. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -11
  61. package/src/commons/Device/ItemAddNew/index.js +2 -2
  62. package/src/commons/Device/ItemDevice.js +5 -21
  63. package/src/commons/Device/SonosSpeaker/index.js +3 -3
  64. package/src/commons/Device/WaterPurifierStatus/AlertStatusMachine.js +2 -2
  65. package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +2 -6
  66. package/src/commons/DisplayChecking/index.js +2 -2
  67. package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
  68. package/src/commons/EmergencyButton/AlertSent.js +6 -2
  69. package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
  70. package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +5 -5
  71. package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +9 -9
  72. package/src/commons/Form/CurrencyInput.js +1 -15
  73. package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +1 -22
  74. package/src/commons/Header/HeaderCustom.js +8 -3
  75. package/src/commons/HeaderAni/index.js +2 -2
  76. package/src/commons/IconComponent/index.js +3 -3
  77. package/src/commons/MediaPlayerDetail/MediaPlayerFull.js +1 -1
  78. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerFull.test.js +12 -48
  79. package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +1 -1
  80. package/src/commons/MenuActionList/__test__/MenuActionList.test.js +1 -0
  81. package/src/commons/MenuActionMore/MenuActionMoreStyles.js +2 -1
  82. package/src/commons/MenuActionMore/index.js +1 -1
  83. package/src/commons/NavBar/NavBarStyles.js +1 -1
  84. package/src/commons/NavBar/index.js +2 -2
  85. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
  86. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +1 -13
  87. package/src/commons/Processing/__test__/Connecting.test.js +3 -14
  88. package/src/commons/SearchLocation/index.js +3 -3
  89. package/src/commons/SelectActionCard/index.js +2 -2
  90. package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +1 -18
  91. package/src/commons/SelectSubUnit/index.js +2 -2
  92. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +1 -13
  93. package/src/commons/Sharing/BtnRemoveMember.js +2 -2
  94. package/src/commons/Sharing/StationDevicePermissions.js +2 -2
  95. package/src/commons/Sharing/WrapHeaderScrollable.js +1 -1
  96. package/src/commons/Sharing/__test__/ButtonRemoveMember.test.js +2 -2
  97. package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -1
  98. package/src/commons/SubUnit/DeviceTemplate/ConfigAndEvaluation/ConfigAndEvaluation.js +2 -2
  99. package/src/commons/SubUnit/DeviceTemplate/ConfigValue/ConfigValue.js +2 -2
  100. package/src/commons/SubUnit/DeviceTemplate/EvaluationOverConfig/EvaluationOverConfig.js +2 -2
  101. package/src/commons/SubUnit/Item/index.js +3 -3
  102. package/src/commons/SubUnit/OneTap/ItemOneTap.js +5 -5
  103. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +11 -8
  104. package/src/commons/SubUnit/__test__/Favorites.test.js +1 -13
  105. package/src/commons/SubUnit/__test__/ShortDetail.test.js +5 -16
  106. package/src/commons/SummaryItem/index.js +22 -23
  107. package/src/commons/Tabbar/__test__/index.test.js +0 -11
  108. package/src/commons/Unit/HeaderUnit/index.js +93 -85
  109. package/src/commons/Unit/SharedUnit.js +7 -7
  110. package/src/commons/Unit/__test__/HeaderUnit.test.js +29 -52
  111. package/src/commons/Unit/__test__/SharedUnit.test.js +94 -105
  112. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +11 -30
  113. package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +44 -1
  114. package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +69 -0
  115. package/src/commons/WrapParallaxScrollView/index.js +20 -50
  116. package/src/configs/API.js +1 -2
  117. package/src/configs/Constants.js +3 -3
  118. package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +4 -15
  119. package/src/hooks/Common/useIsOwnerOfUnit.js +1 -1
  120. package/src/hooks/IoT/__test__/useRemoteControl.test.js +1 -1
  121. package/src/hooks/IoT/__test__/useWatchConfigs.test.js +6 -21
  122. package/src/iot/RemoteControl/HomeAssistant.js +1 -1
  123. package/src/iot/RemoteControl/__test__/Bluetooth.test.js +234 -232
  124. package/src/navigations/AddDeviceStack.js +2 -2
  125. package/src/navigations/AddGatewayStack.js +2 -2
  126. package/src/navigations/AddLGDeviceStack.js +2 -2
  127. package/src/navigations/AddMemberStack.js +2 -2
  128. package/src/navigations/AddSubUnitStack.js +2 -2
  129. package/src/navigations/AddUnitStack.js +2 -2
  130. package/src/navigations/AllGatewayStack.js +2 -2
  131. package/src/navigations/AutomateStack.js +4 -4
  132. package/src/navigations/EmergencyContactsStack.js +4 -4
  133. package/src/navigations/GatewayStack.js +2 -2
  134. package/src/navigations/HanetCameraStack.js +2 -2
  135. package/src/navigations/Main.js +2 -2
  136. package/src/navigations/NotificationStack.js +2 -2
  137. package/src/navigations/SharedStack.js +8 -6
  138. package/src/navigations/SmartAccountStack.js +2 -2
  139. package/src/navigations/SmartIrStack.js +2 -2
  140. package/src/navigations/SmartLockStack.js +2 -2
  141. package/src/navigations/SmartStack.js +2 -2
  142. package/src/navigations/TemplateStack.js +2 -2
  143. package/src/navigations/UnitStack.js +4 -12
  144. package/src/navigations/utils.js +1 -4
  145. package/src/screens/ActivityLog/hooks/index.js +7 -4
  146. package/src/screens/ActivityLog/index.js +2 -2
  147. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +4 -21
  148. package/src/screens/AddCommon/__test__/SelectUnit.test.js +7 -19
  149. package/src/screens/AddLocationMaps/__test__/index.test.js +3 -13
  150. package/src/screens/AddLocationMaps/index.js +11 -6
  151. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +3 -20
  152. package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +11 -18
  153. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +4 -21
  154. package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
  155. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +3 -3
  156. package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +0 -17
  157. package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +4 -19
  158. package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +3 -15
  159. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +31 -51
  160. package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +9 -22
  161. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +12 -19
  162. package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +6 -16
  163. package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +4 -15
  164. package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +3 -3
  165. package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +18 -10
  166. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +1 -1
  167. package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +12 -9
  168. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +12 -9
  169. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +7 -21
  170. package/src/screens/AllGateway/DetailConfigActionInternal/__test__/index.test.js +0 -20
  171. package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +7 -24
  172. package/src/screens/AllGateway/DeviceGatewayInfo/__test__/index.test.js +0 -17
  173. package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +84 -100
  174. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +64 -82
  175. package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +36 -55
  176. package/src/screens/AllGateway/GatewayConnectionMethods/__test__/index.test.js +9 -18
  177. package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +10 -37
  178. package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +7 -32
  179. package/src/screens/AllGateway/__test__/index.test.js +1 -14
  180. package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +0 -12
  181. package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +1 -13
  182. package/src/screens/AllGateway/components/TabPaneCT/index.js +1 -1
  183. package/src/screens/AllGateway/hooks/__test__/index.test.js +1 -8
  184. package/src/screens/AllGateway/test-utils.js +1 -1
  185. package/src/screens/Automate/AddNewAction/NewActionWrapper.js +2 -2
  186. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +27 -28
  187. package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +3 -3
  188. package/src/screens/Automate/AddNewAction/__test__/ChooseConfig.test.js +8 -5
  189. package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +2 -2
  190. package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +1 -18
  191. package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +17 -15
  192. package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +4 -4
  193. package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +38 -55
  194. package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +0 -18
  195. package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +1 -19
  196. package/src/screens/Automate/EditActionsList/__tests__/index.test.js +14 -11
  197. package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +3 -3
  198. package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +2 -2
  199. package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +2 -2
  200. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +33 -25
  201. package/src/screens/Automate/ScriptDetail/index.js +6 -6
  202. package/src/screens/Automate/SetSchedule/__test__/index.test.js +4 -4
  203. package/src/screens/Automate/SetSchedule/components/RowItem.js +3 -3
  204. package/src/screens/Automate/Styles/indexStyles.js +6 -0
  205. package/src/screens/Automate/__test__/MultiUnits.test.js +7 -7
  206. package/src/screens/Automate/__test__/index.test.js +9 -34
  207. package/src/screens/Automate/index.js +50 -33
  208. package/src/screens/ChangePosition/__test__/index.test.js +1 -14
  209. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +1 -23
  210. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +1 -11
  211. package/src/screens/Device/EditDevice/index.js +2 -2
  212. package/src/screens/Device/__test__/detail.test.js +11 -11
  213. package/src/screens/Device/__test__/sensorDisplayItem.test.js +0 -12
  214. package/src/screens/Device/detail.js +14 -12
  215. package/src/screens/Drawer/Drawer.test.js +3 -11
  216. package/src/screens/Drawer/index.js +3 -4
  217. package/src/screens/EmergencyContacts/EmergencyContactsList.js +4 -8
  218. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -3
  219. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +4 -17
  220. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +3 -14
  221. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +0 -10
  222. package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
  223. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +4 -17
  224. package/src/screens/GuestInfo/__test__/index.test.js +0 -11
  225. package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
  226. package/src/screens/GuestInfo/index.js +2 -2
  227. package/src/screens/HanetCamera/Detail.js +6 -2
  228. package/src/screens/HanetCamera/ManageAccess.js +3 -4
  229. package/src/screens/HanetCamera/MemberInfo.js +4 -4
  230. package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +2 -16
  231. package/src/screens/HanetCamera/__test__/Detail.test.js +1 -12
  232. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +5 -16
  233. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +5 -18
  234. package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
  235. package/src/screens/ManageAccess/__test__/ManageAccess.test.js +3 -19
  236. package/src/screens/ManageAccess/index.js +3 -3
  237. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +7 -7
  238. package/src/screens/Notification/__test__/Notification.test.js +5 -15
  239. package/src/screens/Notification/__test__/NotificationItem.test.js +9 -19
  240. package/src/screens/Notification/index.js +5 -5
  241. package/src/screens/PlayBackCamera/__test__/index.test.js +13 -22
  242. package/src/screens/PlayBackCamera/index.js +2 -2
  243. package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +0 -11
  244. package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
  245. package/src/screens/SelectUnit/__test__/index.test.js +9 -29
  246. package/src/screens/SelectUnit/index.js +2 -2
  247. package/src/screens/SharedUnit/TabHeader.js +2 -2
  248. package/src/screens/SharedUnit/index.js +5 -0
  249. package/src/screens/Sharing/Components/EndDevice.js +3 -3
  250. package/src/screens/Sharing/SelectUser.js +5 -4
  251. package/src/screens/Sharing/UnitMemberList.js +7 -6
  252. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +9 -4
  253. package/src/screens/Sharing/__test__/SelectShareDevice.test.js +2 -15
  254. package/src/screens/Sharing/__test__/SelectUser.test.js +2 -22
  255. package/src/screens/Sharing/__test__/UnitMemberList.test.js +2 -2
  256. package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +4 -17
  257. package/src/screens/Sharing/hooks/__test__/index.test.js +2 -13
  258. package/src/screens/SmartAccount/Connecting/index.js +0 -2
  259. package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +3 -18
  260. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +11 -21
  261. package/src/screens/SmartAccount/SuccessfullyConnected/index.js +3 -4
  262. package/src/screens/SmartAccount/__test__/Connecting.test.js +30 -36
  263. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +12 -21
  264. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +8 -17
  265. package/src/screens/SmartIr/__test__/SelectBrand.test.js +1 -11
  266. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +1 -12
  267. package/src/screens/SmartIr/__test__/SmartIr.test.js +3 -11
  268. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +6 -5
  269. package/src/screens/SmartIr/components/SelectBrand.js +2 -2
  270. package/src/screens/SubUnit/AddSubUnit.js +1 -0
  271. package/src/screens/SubUnit/EditSubUnit.js +3 -2
  272. package/src/screens/SubUnit/ManageSubUnit.js +5 -5
  273. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -31
  274. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +12 -30
  275. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +2 -2
  276. package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +0 -12
  277. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +7 -20
  278. package/src/screens/Template/__test__/EditTemplate.test.js +4 -15
  279. package/src/screens/Template/__test__/GatewayList.test.js +0 -9
  280. package/src/screens/Template/__test__/detail.test.js +8 -8
  281. package/src/screens/Template/__test__/index.test.js +3 -14
  282. package/src/screens/Template/detail.js +2 -2
  283. package/src/screens/Unit/Detail.js +10 -55
  284. package/src/screens/Unit/MoreMenu.js +6 -5
  285. package/src/screens/Unit/SelectAddToFavorites.js +2 -2
  286. package/src/screens/Unit/SelectAddress.js +9 -4
  287. package/src/screens/Unit/SmartAccountItem.js +2 -2
  288. package/src/screens/Unit/Station/__test__/index.test.js +2 -2
  289. package/src/screens/Unit/Summaries.js +24 -29
  290. package/src/screens/Unit/__test__/AddMenu.test.js +5 -2
  291. package/src/screens/Unit/__test__/CheckSendEmail.test.js +0 -12
  292. package/src/screens/Unit/__test__/ChooseLocation.test.js +1 -4
  293. package/src/screens/Unit/__test__/Detail.test.js +14 -12
  294. package/src/screens/Unit/__test__/ManageUnit.test.js +2 -17
  295. package/src/screens/Unit/__test__/MoreMenu.test.js +6 -12
  296. package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +3 -14
  297. package/src/screens/Unit/__test__/SelectAddress.test.js +4 -17
  298. package/src/screens/Unit/__test__/SmartAccount.test.js +14 -11
  299. package/src/screens/Unit/__test__/SmartAccountItem.test.js +0 -11
  300. package/src/screens/Unit/__test__/Summaries.test.js +2 -14
  301. package/src/screens/Unit/components/AutomateScript/index.js +5 -5
  302. package/src/screens/Unit/components/ButtonWrapper/index.js +3 -4
  303. package/src/screens/Unit/components/Header/index.js +5 -4
  304. package/src/screens/Unit/components/SharedUnit/index.js +5 -5
  305. package/src/screens/Unit/components/__test__/Header.test.js +1 -14
  306. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +1 -11
  307. package/src/screens/Unit/components/__test__/SharedUnit.test.js +1 -11
  308. package/src/screens/UnitSummary/__test__/index.test.js +51 -17
  309. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +8 -25
  310. package/src/screens/UnitSummary/components/AirQuality/__test__/index.test.js +1 -7
  311. package/src/screens/UnitSummary/components/AirQuality/index.js +8 -3
  312. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +0 -11
  313. package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +1 -16
  314. package/src/screens/UnitSummary/components/Temperature/index.js +5 -1
  315. package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +0 -8
  316. package/src/screens/UnitSummary/components/UvIndex/index.js +6 -2
  317. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +3 -3
  318. package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +14 -18
  319. package/src/screens/UnitSummary/components/__test__/UnitSummary.test.js +8 -8
  320. package/src/screens/UnitSummary/index.js +6 -6
  321. package/src/utils/Apis/axios.js +4 -2
  322. package/src/utils/Converter/__test__/timer.test.js +8 -0
  323. package/src/utils/Functions/preloadImages.js +13 -14
  324. package/src/utils/Monitor.js +2 -3
  325. package/src/utils/Route/index.js +0 -1
  326. package/src/utils/Storage.js +1 -1
  327. package/assets/images/OneTap.svg +0 -14
  328. package/assets/images/Schedule.svg +0 -39
  329. package/assets/images/ValueChange.svg +0 -49
  330. package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +0 -48
  331. package/src/commons/Device/WindSpeed/LinearChart/index.js +0 -155
  332. package/src/screens/AddNewGateway/hooks/__Tests__/index.test.js +0 -27
  333. package/src/screens/AddNewGateway/hooks/index.js +0 -31
  334. package/src/screens/SubUnit/Detail.js +0 -150
  335. package/src/screens/SubUnit/__test__/Detail.test.js +0 -125
  336. package/src/screens/UnitSummary/components/Temperature/ChartAverage/index.js +0 -62
  337. package/src/screens/UnitSummary/components/Temperature/__test__/ChartAverage.test.js +0 -17
  338. package/src/utils/dateHelper/getTickValues.js +0 -22
@@ -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') {
@@ -139,24 +135,27 @@ const SetupConfigCondition = () => {
139
135
  <Text type="Body">
140
136
  {t('when_value_is', { config_name: config.name })}
141
137
  </Text>
142
- <List renderHeader={t('condition')}>
143
- {normalConditions.map((item) => {
138
+ <FlatList
139
+ renderHeader={t('condition')}
140
+ data={normalConditions}
141
+ renderItem={({ item }) => {
144
142
  return (
145
- <Radio.RadioItem
146
- checked={item.value === customCondition}
147
- key={item.value}
148
- onChange={() => {
149
- automate.condition = item.value;
150
- setCustomCondition(item.value);
151
- }}
152
- >
153
- {item.label}
154
- </Radio.RadioItem>
143
+ <View>
144
+ <Text>{item.label}</Text>
145
+ <CheckBox
146
+ onChange={() => {
147
+ automate.condition = item.value;
148
+ setCustomCondition(item.value);
149
+ }}
150
+ value={item.value === customCondition}
151
+ />
152
+ </View>
155
153
  );
156
- })}
157
- </List>
158
- <List renderHeader={t('value')} style={styles.inputValue}>
159
- <InputItem
154
+ }}
155
+ />
156
+ <View style={styles.inputValue}>
157
+ <Text>{t('value')}</Text>
158
+ <TextInput
160
159
  keyboardType="decimal-pad"
161
160
  type="number"
162
161
  maxLength={10}
@@ -166,9 +165,9 @@ const SetupConfigCondition = () => {
166
165
  }}
167
166
  style={styles.numberInput}
168
167
  />
169
- </List>
170
- <AntButton
171
- type={'primary'}
168
+ </View>
169
+ <TouchableOpacity
170
+ testID={'continue_button'}
172
171
  onPress={() => {
173
172
  if (
174
173
  !automate.value ||
@@ -181,8 +180,8 @@ const SetupConfigCondition = () => {
181
180
  navigate(Routes.ValueChangeName, { automate, closeScreen });
182
181
  }}
183
182
  >
184
- {t('continue')}
185
- </AntButton>
183
+ <Text>{t('continue')}</Text>
184
+ </TouchableOpacity>
186
185
  </View>
187
186
  </ModalCustom>
188
187
  </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
  });
@@ -12,24 +12,12 @@ import { ToastBottomHelper } from '../../../../utils/Utils';
12
12
  import UpdateActionScript from '../UpdateActionScript';
13
13
  import { TouchableOpacity } from 'react-native';
14
14
  import { useRoute } from '@react-navigation/native';
15
+ import RenderActionItem from '../../AddNewAction/RenderActionItem';
16
+ import { showAllCards } from '../../../../commons/ActionTemplate/__test__/utils';
15
17
 
16
18
  const mock = new MockAdapter(api.axiosInstance);
17
- const mockedNavigate = jest.fn();
18
- const mockedDispatch = jest.fn();
19
- const mockedGoBack = jest.fn();
20
19
  const mockedPermission = jest.fn();
21
20
 
22
- jest.mock('@react-navigation/native', () => {
23
- return {
24
- ...jest.requireActual('@react-navigation/native'),
25
- useNavigation: () => ({
26
- navigate: mockedNavigate,
27
- dispatch: mockedDispatch,
28
- goBack: mockedGoBack,
29
- }),
30
- useRoute: jest.fn(),
31
- };
32
- });
33
21
  jest.mock('../../../../utils/Permission/backend', () => ({
34
22
  useBackendPermission: () => ({
35
23
  max_actions_per_automation: 1,
@@ -73,7 +61,6 @@ describe('Test UpdateActionScript', () => {
73
61
  useRoute.mockReturnValue({
74
62
  params: {},
75
63
  });
76
- mockedNavigate.mockClear();
77
64
  mockedPermission.mockClear();
78
65
  });
79
66
 
@@ -85,14 +72,14 @@ describe('Test UpdateActionScript', () => {
85
72
  tree = await renderer.create(wrapComponent(route));
86
73
  });
87
74
  const instance = tree.root;
88
- const buttonOn = instance.findAll(
89
- (el) =>
90
- el.props.accessibilityLabel === AccessibilityLabel.ON_BUTTON &&
91
- el.type === TouchableOpacity
92
- );
93
- await act(async () => {
94
- buttonOn[0].props.onPress();
95
- });
75
+ await showAllCards(instance);
76
+ await selectActionOn(instance);
77
+ await pressSaveButton(instance);
78
+
79
+ expect(global.mockedNavigate).toHaveBeenCalled();
80
+ });
81
+
82
+ const pressSaveButton = async (instance) => {
96
83
  const buttonSave = instance.find(
97
84
  (el) =>
98
85
  el.props.accessibilityLabel ===
@@ -101,8 +88,7 @@ describe('Test UpdateActionScript', () => {
101
88
  await act(async () => {
102
89
  buttonSave.props.onNext();
103
90
  });
104
- expect(mockedNavigate).toHaveBeenCalled();
105
- });
91
+ };
106
92
 
107
93
  it('test update action script fail', async () => {
108
94
  mock.onGet(API.DEVICE.DISPLAY_ACTIONS(1)).reply(200, response);
@@ -111,32 +97,14 @@ describe('Test UpdateActionScript', () => {
111
97
  tree = await renderer.create(wrapComponent(route));
112
98
  });
113
99
  const instance = tree.root;
114
- const buttonOn = instance.findAll(
115
- (el) =>
116
- el.props.accessibilityLabel === AccessibilityLabel.ON_BUTTON &&
117
- el.type === TouchableOpacity
118
- );
119
- await act(async () => {
120
- buttonOn[0].props.onPress();
121
- });
122
- const buttonSave = instance.find(
123
- (el) =>
124
- el.props.accessibilityLabel ===
125
- AccessibilityLabel.BUTTON_UPDATE_SCRIPT_ITEM
126
- );
127
- await act(async () => {
128
- buttonSave.props.onNext();
129
- });
130
- expect(mockedNavigate).not.toHaveBeenCalled();
100
+ await showAllCards(instance);
101
+ await selectActionOn(instance);
102
+ await pressSaveButton(instance);
103
+
104
+ expect(global.mockedNavigate).not.toHaveBeenCalled();
131
105
  });
132
106
 
133
- it('test can not update because adding too many times allowed', async () => {
134
- mock.onGet(API.DEVICE.DISPLAY_ACTIONS(1)).reply(200, response);
135
- const spyToast = jest.spyOn(ToastBottomHelper, 'error');
136
- await act(async () => {
137
- tree = await renderer.create(wrapComponent(route));
138
- });
139
- const instance = tree.root;
107
+ const selectActionOn = async (instance) => {
140
108
  const buttonOn = instance.findAll(
141
109
  (el) =>
142
110
  el.props.accessibilityLabel === AccessibilityLabel.ON_BUTTON &&
@@ -145,6 +113,9 @@ describe('Test UpdateActionScript', () => {
145
113
  await act(async () => {
146
114
  buttonOn[0].props.onPress();
147
115
  });
116
+ };
117
+
118
+ const selectActionOff = async (instance) => {
148
119
  const buttonOff = instance.findAll(
149
120
  (el) =>
150
121
  el.props.accessibilityLabel === AccessibilityLabel.OFF_BUTTON &&
@@ -153,6 +124,9 @@ describe('Test UpdateActionScript', () => {
153
124
  await act(async () => {
154
125
  buttonOff[0].props.onPress();
155
126
  });
127
+ };
128
+
129
+ const selectActionOne = async (instance) => {
156
130
  const buttonOne = instance.findAll(
157
131
  (el) =>
158
132
  el.props.accessibilityLabel === AccessibilityLabel.ONE_BUTTON &&
@@ -161,14 +135,23 @@ describe('Test UpdateActionScript', () => {
161
135
  await act(async () => {
162
136
  buttonOne[0].props.onPress();
163
137
  });
164
- const buttonSave = instance.find(
165
- (el) =>
166
- el.props.accessibilityLabel ===
167
- AccessibilityLabel.BUTTON_UPDATE_SCRIPT_ITEM
168
- );
138
+ };
139
+
140
+ it('test can not update because adding too many times allowed', async () => {
141
+ mock.onGet(API.DEVICE.DISPLAY_ACTIONS(1)).reply(200, response);
142
+ const spyToast = jest.spyOn(ToastBottomHelper, 'error');
169
143
  await act(async () => {
170
- buttonSave.props.onNext();
144
+ tree = await renderer.create(wrapComponent(route));
171
145
  });
146
+
147
+ const instance = tree.root;
148
+ expect(instance.findAllByType(RenderActionItem).length).toBe(2);
149
+ await showAllCards(instance);
150
+ await selectActionOn(instance);
151
+ await selectActionOff(instance);
152
+ await selectActionOne(instance);
153
+ await pressSaveButton(instance);
154
+
172
155
  expect(spyToast).toBeCalled();
173
156
  });
174
157
  });
@@ -14,24 +14,10 @@ import { ToastBottomHelper } from '../../../../utils/Utils';
14
14
  import UpdateDelayScript from '../UpdateDelayScript';
15
15
 
16
16
  const mock = new MockAdapter(api.axiosInstance);
17
- const mockedNavigate = jest.fn();
18
- const mockedDispatch = jest.fn();
19
- const mockedGoBack = jest.fn();
20
17
  const mockerOnClosePopup = jest.fn();
21
18
  const mockedSetActionList = jest.fn();
22
19
  const mockedSetNeedRefresh = jest.fn();
23
20
 
24
- jest.mock('@react-navigation/native', () => {
25
- return {
26
- ...jest.requireActual('@react-navigation/native'),
27
- useNavigation: () => ({
28
- navigate: mockedNavigate,
29
- dispatch: mockedDispatch,
30
- goBack: mockedGoBack,
31
- }),
32
- useRoute: jest.fn(),
33
- };
34
- });
35
21
  let actionsList = [
36
22
  {
37
23
  id: 1,
@@ -74,10 +60,6 @@ const wrapComponent = () => (
74
60
  describe('Test UpdateDelayScript', () => {
75
61
  let tree;
76
62
 
77
- beforeEach(() => {
78
- mockedNavigate.mockClear();
79
- });
80
-
81
63
  it('test update delay', async () => {
82
64
  mock.onPut(API.AUTOMATE.UPDATE_SCRIPT_DELAY(1)).reply(200);
83
65
  const spyToast = jest.spyOn(ToastBottomHelper, 'success');
@@ -14,24 +14,10 @@ import BottomButtonView from '../../../../commons/BottomButtonView';
14
14
  import { ToastBottomHelper } from '../../../../utils/Utils';
15
15
 
16
16
  const mock = new MockAdapter(api.axiosInstance);
17
- const mockedNavigate = jest.fn();
18
- const mockedDispatch = jest.fn();
19
- const mockedGoBack = jest.fn();
20
17
  const mockerOnClosePopup = jest.fn();
21
18
  const mockedSetActionList = jest.fn();
22
19
  const mockedSetNeedRefresh = jest.fn();
23
20
 
24
- jest.mock('@react-navigation/native', () => {
25
- return {
26
- ...jest.requireActual('@react-navigation/native'),
27
- useNavigation: () => ({
28
- navigate: mockedNavigate,
29
- dispatch: mockedDispatch,
30
- goBack: mockedGoBack,
31
- }),
32
- useRoute: jest.fn(),
33
- };
34
- });
35
21
  let actionsList = [
36
22
  {
37
23
  id: 1,
@@ -74,10 +60,6 @@ const wrapComponent = () => (
74
60
  describe('Test UpdateNotifyScript', () => {
75
61
  let tree;
76
62
 
77
- beforeEach(() => {
78
- mockedNavigate.mockClear();
79
- });
80
-
81
63
  it('test update title and message', async () => {
82
64
  mock.onPut(API.AUTOMATE.UPDATE_SCRIPT_NOTIFY(1)).reply(200);
83
65
  const spyToast = jest.spyOn(ToastBottomHelper, 'success');
@@ -108,7 +90,7 @@ describe('Test UpdateNotifyScript', () => {
108
90
  button.props.onPressMain();
109
91
  });
110
92
  expect(spyToast).toBeCalled();
111
- // expect(mockedNavigate).toHaveBeenCalledWith('closeScreen');
93
+ // expect(global.mockedNavigate).toHaveBeenCalledWith('closeScreen');
112
94
  });
113
95
  it('test can not update title and message', async () => {
114
96
  await act(async () => {
@@ -97,7 +97,7 @@ describe('EditActionsList', () => {
97
97
  await act(async () => {
98
98
  headerCustom[0].props.onGoBack();
99
99
  });
100
- expect(mockedNavigate).toHaveBeenCalled();
100
+ expect(global.mockedNavigate).toHaveBeenCalled();
101
101
  });
102
102
 
103
103
  it('EditActionsList onPress remove action', async () => {
@@ -152,16 +152,19 @@ describe('EditActionsList', () => {
152
152
  await act(async () => {
153
153
  modalCustom[0].props.onBackButtonPress();
154
154
  });
155
- expect(mockedNavigate).toHaveBeenCalledWith(Routes.UpdateActionScript, {
156
- automateId: 1,
157
- closeScreen: Routes.EditActionsList,
158
- device: {
159
- id: 1,
160
- },
161
- numberActionAdded: 3,
162
- scriptItemId: 1,
163
- unitId: undefined,
164
- });
155
+ expect(global.mockedNavigate).toHaveBeenCalledWith(
156
+ Routes.UpdateActionScript,
157
+ {
158
+ automateId: 1,
159
+ closeScreen: Routes.EditActionsList,
160
+ device: {
161
+ id: 1,
162
+ },
163
+ numberActionAdded: 3,
164
+ scriptItemId: 1,
165
+ unitId: undefined,
166
+ }
167
+ );
165
168
  });
166
169
 
167
170
  it('EditActionsList update script notify', async () => {
@@ -77,7 +77,7 @@ describe('test OneTap', () => {
77
77
  await item.props.onPress();
78
78
  });
79
79
 
80
- expect(mockedNavigate).toHaveBeenCalledWith({
80
+ expect(global.mockedNavigate).toHaveBeenCalledWith({
81
81
  merge: true,
82
82
  name: Routes.ScriptDetail,
83
83
  params: {
@@ -114,7 +114,7 @@ describe('test OneTap', () => {
114
114
  await act(async () => {
115
115
  await item[0].props.onPress();
116
116
  });
117
- expect(mockedNavigate).not.toBeCalled();
117
+ expect(global.mockedNavigate).not.toBeCalled();
118
118
  });
119
119
 
120
120
  it('test onClose have automateId', async () => {
@@ -136,6 +136,6 @@ describe('test OneTap', () => {
136
136
  await act(async () => {
137
137
  header.props.onPress();
138
138
  });
139
- expect(mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail);
139
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail);
140
140
  });
141
141
  });