@eohjsc/react-native-smart-city 0.6.2 → 0.7.3
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.
- package/README.md +3 -3
- package/android/build.gradle +7 -10
- package/package.json +53 -70
- package/src/commons/Action/__test__/ItemQuickAction.test.js +2 -2
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/ItemPasscode.test.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +0 -15
- package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +2 -2
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -2
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +2 -2
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +5 -5
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +5 -5
- package/src/commons/ActionGroup/TerminalBoxTemplate.js +2 -2
- package/src/commons/ActionGroup/TextBoxTemplate.js +2 -2
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonTemplate.test.js +4 -4
- package/src/commons/ActionGroup/TimerActionTemplate.js +4 -5
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
- package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +4 -9
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +2 -9
- package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +4 -11
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +2 -9
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +4 -18
- package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +2 -2
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +1 -8
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +0 -7
- package/src/commons/ActionGroup/__test__/SwitchButtonTemplate.test.js +4 -15
- package/src/commons/ActionGroup/__test__/TerminalBoxTemplate.test.js +0 -7
- package/src/commons/ActionGroup/__test__/TextBoxTemplate.test.js +1 -8
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +8 -15
- package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +2 -10
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +3 -20
- package/src/commons/ActionGroup/__test__/index.test.js +15 -23
- package/src/commons/ActionTemplate/__test__/index.test.js +2 -0
- package/src/commons/ActionTemplate/__test__/utils.js +21 -0
- package/src/commons/ActionTemplate/index.js +1 -2
- package/src/commons/BackDefault/index.js +2 -2
- package/src/commons/ButtonPopup/index.js +2 -2
- package/src/commons/Calendar/__test__/Calendar.test.js +0 -7
- package/src/commons/CircleButton/__test__/CircleButton.test.js +2 -2
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +11 -25
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +27 -20
- package/src/commons/Dashboard/MyUnit/index.js +0 -1
- package/src/commons/DateTimeRangeChange/DateTimeButton.js +2 -2
- package/src/commons/DateTimeRangeChange/__test__/DateTimeButton.test.js +4 -4
- package/src/commons/DateTimeRangeChange/index.js +2 -2
- package/src/commons/Device/ConnectedViewHeader.js +2 -2
- package/src/commons/Device/DisconnectedView.js +2 -2
- package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
- package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +2 -2
- package/src/commons/Device/FlatListItems.js +3 -3
- package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -11
- package/src/commons/Device/ItemAddNew/index.js +2 -2
- package/src/commons/Device/ItemDevice.js +2 -2
- package/src/commons/Device/SonosSpeaker/index.js +3 -3
- package/src/commons/Device/WaterPurifierStatus/AlertStatusMachine.js +2 -2
- package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +2 -6
- package/src/commons/DisplayChecking/index.js +2 -2
- package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
- package/src/commons/EmergencyButton/AlertSent.js +6 -2
- package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +5 -5
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +9 -9
- package/src/commons/Form/CurrencyInput.js +1 -15
- package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +1 -22
- package/src/commons/Header/HeaderCustom.js +8 -3
- package/src/commons/HeaderAni/index.js +2 -2
- package/src/commons/IconComponent/index.js +3 -3
- package/src/commons/MediaPlayerDetail/MediaPlayerFull.js +1 -1
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerFull.test.js +12 -48
- package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +1 -1
- package/src/commons/MenuActionList/__test__/MenuActionList.test.js +1 -0
- package/src/commons/NavBar/index.js +2 -2
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
- package/src/commons/PreventAccess/__test__/PreventAccess.test.js +1 -13
- package/src/commons/Processing/__test__/Connecting.test.js +3 -14
- package/src/commons/SearchLocation/index.js +3 -3
- package/src/commons/SelectActionCard/index.js +2 -2
- package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +1 -18
- package/src/commons/SelectSubUnit/index.js +2 -2
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +1 -13
- package/src/commons/Sharing/BtnRemoveMember.js +2 -2
- package/src/commons/Sharing/StationDevicePermissions.js +2 -2
- package/src/commons/Sharing/WrapHeaderScrollable.js +1 -1
- package/src/commons/Sharing/__test__/ButtonRemoveMember.test.js +2 -2
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -1
- package/src/commons/SubUnit/DeviceTemplate/ConfigAndEvaluation/ConfigAndEvaluation.js +2 -2
- package/src/commons/SubUnit/DeviceTemplate/ConfigValue/ConfigValue.js +2 -2
- package/src/commons/SubUnit/DeviceTemplate/EvaluationOverConfig/EvaluationOverConfig.js +2 -2
- package/src/commons/SubUnit/Item/index.js +3 -3
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +2 -2
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +11 -8
- package/src/commons/SubUnit/__test__/Favorites.test.js +1 -13
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +5 -16
- package/src/commons/SummaryItem/index.js +22 -23
- package/src/commons/Tabbar/__test__/index.test.js +0 -11
- package/src/commons/Unit/HeaderUnit/index.js +84 -84
- package/src/commons/Unit/SharedUnit.js +7 -7
- package/src/commons/Unit/__test__/HeaderUnit.test.js +29 -52
- package/src/commons/Unit/__test__/SharedUnit.test.js +94 -105
- package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +11 -30
- package/src/commons/WrapParallaxScrollView/index.js +21 -50
- package/src/configs/API.js +1 -2
- package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +4 -15
- package/src/hooks/Common/useIsOwnerOfUnit.js +1 -1
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +1 -1
- package/src/hooks/IoT/__test__/useWatchConfigs.test.js +6 -21
- package/src/iot/RemoteControl/HomeAssistant.js +1 -1
- package/src/iot/RemoteControl/__test__/Bluetooth.test.js +234 -232
- package/src/navigations/AddDeviceStack.js +2 -2
- package/src/navigations/AddGatewayStack.js +2 -2
- package/src/navigations/AddLGDeviceStack.js +2 -2
- package/src/navigations/AddMemberStack.js +2 -2
- package/src/navigations/AddSubUnitStack.js +2 -2
- package/src/navigations/AddUnitStack.js +2 -2
- package/src/navigations/AllGatewayStack.js +2 -2
- package/src/navigations/AutomateStack.js +4 -4
- package/src/navigations/EmergencyContactsStack.js +4 -4
- package/src/navigations/GatewayStack.js +2 -2
- package/src/navigations/HanetCameraStack.js +2 -2
- package/src/navigations/Main.js +2 -2
- package/src/navigations/NotificationStack.js +2 -2
- package/src/navigations/SharedStack.js +8 -6
- package/src/navigations/SmartAccountStack.js +2 -2
- package/src/navigations/SmartIrStack.js +2 -2
- package/src/navigations/SmartLockStack.js +2 -2
- package/src/navigations/SmartStack.js +2 -2
- package/src/navigations/TemplateStack.js +2 -2
- package/src/navigations/UnitStack.js +4 -12
- package/src/navigations/utils.js +1 -4
- package/src/screens/ActivityLog/hooks/index.js +7 -4
- package/src/screens/ActivityLog/index.js +2 -2
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +4 -21
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +7 -19
- package/src/screens/AddLocationMaps/__test__/index.test.js +3 -13
- package/src/screens/AddLocationMaps/index.js +11 -6
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +3 -20
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +11 -18
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +4 -21
- package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +3 -3
- package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +0 -17
- package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +4 -19
- package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +3 -15
- package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +31 -51
- package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +9 -22
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +12 -19
- package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +6 -16
- package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +4 -15
- package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +3 -3
- package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +18 -10
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +1 -1
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +12 -9
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +12 -9
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +7 -21
- package/src/screens/AllGateway/DetailConfigActionInternal/__test__/index.test.js +0 -20
- package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +7 -24
- package/src/screens/AllGateway/DeviceGatewayInfo/__test__/index.test.js +0 -17
- package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +84 -100
- package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +64 -82
- package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +36 -55
- package/src/screens/AllGateway/GatewayConnectionMethods/__test__/index.test.js +9 -18
- package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +10 -37
- package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +7 -32
- package/src/screens/AllGateway/__test__/index.test.js +1 -14
- package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +0 -12
- package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +1 -13
- package/src/screens/AllGateway/components/TabPaneCT/index.js +1 -1
- package/src/screens/AllGateway/hooks/__test__/index.test.js +1 -8
- package/src/screens/AllGateway/test-utils.js +1 -1
- package/src/screens/Automate/AddNewAction/NewActionWrapper.js +2 -2
- package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +27 -28
- package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +3 -3
- package/src/screens/Automate/AddNewAction/__test__/ChooseConfig.test.js +8 -5
- package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +2 -2
- package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +1 -18
- package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +17 -15
- package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +4 -4
- package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +38 -55
- package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +0 -18
- package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +1 -19
- package/src/screens/Automate/EditActionsList/__tests__/index.test.js +14 -11
- package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +3 -3
- package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +2 -2
- package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +2 -2
- package/src/screens/Automate/ScriptDetail/__test__/index.test.js +33 -25
- package/src/screens/Automate/ScriptDetail/index.js +6 -6
- package/src/screens/Automate/SetSchedule/__test__/index.test.js +4 -4
- package/src/screens/Automate/SetSchedule/components/RowItem.js +3 -3
- package/src/screens/Automate/Styles/indexStyles.js +6 -0
- package/src/screens/Automate/__test__/MultiUnits.test.js +7 -7
- package/src/screens/Automate/__test__/index.test.js +9 -34
- package/src/screens/Automate/index.js +50 -33
- package/src/screens/ChangePosition/__test__/index.test.js +1 -14
- package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +1 -23
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +1 -11
- package/src/screens/Device/EditDevice/index.js +2 -2
- package/src/screens/Device/__test__/detail.test.js +11 -11
- package/src/screens/Device/__test__/sensorDisplayItem.test.js +0 -12
- package/src/screens/Device/detail.js +14 -12
- package/src/screens/Drawer/Drawer.test.js +3 -11
- package/src/screens/Drawer/index.js +3 -4
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +4 -8
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -3
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +4 -17
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +3 -14
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +0 -10
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +4 -17
- package/src/screens/GuestInfo/__test__/index.test.js +0 -11
- package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
- package/src/screens/GuestInfo/index.js +2 -2
- package/src/screens/HanetCamera/Detail.js +6 -2
- package/src/screens/HanetCamera/ManageAccess.js +3 -4
- package/src/screens/HanetCamera/MemberInfo.js +4 -4
- package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +2 -16
- package/src/screens/HanetCamera/__test__/Detail.test.js +1 -12
- package/src/screens/HanetCamera/__test__/ManageAccess.test.js +5 -16
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +5 -18
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
- package/src/screens/ManageAccess/__test__/ManageAccess.test.js +3 -19
- package/src/screens/ManageAccess/index.js +3 -3
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +7 -7
- package/src/screens/Notification/__test__/Notification.test.js +5 -15
- package/src/screens/Notification/__test__/NotificationItem.test.js +9 -19
- package/src/screens/Notification/index.js +5 -5
- package/src/screens/PlayBackCamera/__test__/index.test.js +13 -22
- package/src/screens/PlayBackCamera/index.js +2 -2
- package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +0 -11
- package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
- package/src/screens/SelectUnit/__test__/index.test.js +9 -29
- package/src/screens/SelectUnit/index.js +2 -2
- package/src/screens/SharedUnit/TabHeader.js +2 -2
- package/src/screens/SharedUnit/index.js +5 -0
- package/src/screens/Sharing/Components/EndDevice.js +3 -3
- package/src/screens/Sharing/SelectUser.js +5 -4
- package/src/screens/Sharing/UnitMemberList.js +7 -6
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +9 -4
- package/src/screens/Sharing/__test__/SelectShareDevice.test.js +2 -15
- package/src/screens/Sharing/__test__/SelectUser.test.js +2 -22
- package/src/screens/Sharing/__test__/UnitMemberList.test.js +2 -2
- package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +4 -17
- package/src/screens/Sharing/hooks/__test__/index.test.js +2 -13
- package/src/screens/SmartAccount/Connecting/index.js +0 -2
- package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +3 -18
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +11 -21
- package/src/screens/SmartAccount/SuccessfullyConnected/index.js +3 -4
- package/src/screens/SmartAccount/__test__/Connecting.test.js +30 -36
- package/src/screens/SmartAccount/__test__/SmartAccount.test.js +12 -21
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +8 -17
- package/src/screens/SmartIr/__test__/SelectBrand.test.js +1 -11
- package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +1 -12
- package/src/screens/SmartIr/__test__/SmartIr.test.js +3 -11
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +6 -5
- package/src/screens/SmartIr/components/SelectBrand.js +2 -2
- package/src/screens/SubUnit/AddSubUnit.js +1 -0
- package/src/screens/SubUnit/EditSubUnit.js +3 -2
- package/src/screens/SubUnit/ManageSubUnit.js +5 -5
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -31
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +12 -30
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +2 -2
- package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +0 -12
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +7 -20
- package/src/screens/Template/__test__/EditTemplate.test.js +4 -15
- package/src/screens/Template/__test__/GatewayList.test.js +0 -9
- package/src/screens/Template/__test__/detail.test.js +8 -8
- package/src/screens/Template/__test__/index.test.js +3 -14
- package/src/screens/Template/detail.js +2 -2
- package/src/screens/Unit/Detail.js +12 -53
- package/src/screens/Unit/SelectAddToFavorites.js +2 -2
- package/src/screens/Unit/SelectAddress.js +9 -4
- package/src/screens/Unit/SmartAccountItem.js +2 -2
- package/src/screens/Unit/Station/__test__/index.test.js +2 -2
- package/src/screens/Unit/Summaries.js +24 -29
- package/src/screens/Unit/__test__/AddMenu.test.js +5 -2
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +0 -12
- package/src/screens/Unit/__test__/ChooseLocation.test.js +1 -4
- package/src/screens/Unit/__test__/Detail.test.js +14 -12
- package/src/screens/Unit/__test__/ManageUnit.test.js +2 -17
- package/src/screens/Unit/__test__/MoreMenu.test.js +1 -11
- package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +3 -14
- package/src/screens/Unit/__test__/SelectAddress.test.js +4 -17
- package/src/screens/Unit/__test__/SmartAccount.test.js +14 -11
- package/src/screens/Unit/__test__/SmartAccountItem.test.js +0 -11
- package/src/screens/Unit/__test__/Summaries.test.js +2 -14
- package/src/screens/Unit/components/AutomateScript/index.js +2 -2
- package/src/screens/Unit/components/ButtonWrapper/index.js +3 -4
- package/src/screens/Unit/components/Header/index.js +5 -4
- package/src/screens/Unit/components/SharedUnit/index.js +5 -5
- package/src/screens/Unit/components/__test__/Header.test.js +1 -14
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +1 -11
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +1 -11
- package/src/screens/UnitSummary/__test__/index.test.js +51 -17
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +8 -25
- package/src/screens/UnitSummary/components/AirQuality/__test__/index.test.js +1 -7
- package/src/screens/UnitSummary/components/AirQuality/index.js +8 -3
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +0 -11
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +1 -16
- package/src/screens/UnitSummary/components/Temperature/index.js +5 -1
- package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +0 -8
- package/src/screens/UnitSummary/components/UvIndex/index.js +6 -2
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +2 -2
- package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +14 -18
- package/src/screens/UnitSummary/components/__test__/UnitSummary.test.js +8 -8
- package/src/screens/UnitSummary/index.js +4 -8
- package/src/utils/Apis/axios.js +4 -2
- package/src/utils/Converter/__test__/timer.test.js +8 -0
- package/src/utils/Functions/preloadImages.js +13 -14
- package/src/utils/Monitor.js +2 -3
- package/src/utils/Route/index.js +0 -1
- package/src/utils/Storage.js +1 -1
- package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +0 -48
- package/src/commons/Device/WindSpeed/LinearChart/index.js +0 -155
- package/src/screens/AddNewGateway/hooks/__Tests__/index.test.js +0 -27
- package/src/screens/AddNewGateway/hooks/index.js +0 -31
- package/src/screens/SubUnit/Detail.js +0 -150
- package/src/screens/SubUnit/__test__/Detail.test.js +0 -125
- package/src/screens/UnitSummary/components/Temperature/ChartAverage/index.js +0 -62
- package/src/screens/UnitSummary/components/Temperature/__test__/ChartAverage.test.js +0 -17
- package/src/utils/dateHelper/getTickValues.js +0 -22
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { create, act } from 'react-test-renderer';
|
|
3
3
|
import MockAdapter from 'axios-mock-adapter';
|
|
4
4
|
import Toast from 'react-native-toast-message';
|
|
5
|
-
import SegmentedControl from '@react-native-
|
|
5
|
+
import SegmentedControl from '@react-native-segmented-control/segmented-control';
|
|
6
6
|
import { useRoute } from '@react-navigation/native';
|
|
7
7
|
|
|
8
8
|
import { SCProvider } from '../../../../context';
|
|
@@ -44,33 +44,6 @@ const makeDetail = async () => {
|
|
|
44
44
|
return { detail, tabPaneCT };
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
jest.mock('react-native', () => {
|
|
48
|
-
const RN = jest.requireActual('react-native');
|
|
49
|
-
return Object.setPrototypeOf(
|
|
50
|
-
{
|
|
51
|
-
Alert: {
|
|
52
|
-
...RN.Alert,
|
|
53
|
-
alert: jest.fn(),
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
RN
|
|
57
|
-
);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const mockPop = jest.fn();
|
|
61
|
-
const mockNavigate = jest.fn();
|
|
62
|
-
jest.mock('@react-navigation/native', () => {
|
|
63
|
-
return {
|
|
64
|
-
...jest.requireActual('@react-navigation/native'),
|
|
65
|
-
useNavigation: () => ({
|
|
66
|
-
navigate: mockNavigate,
|
|
67
|
-
pop: mockPop,
|
|
68
|
-
}),
|
|
69
|
-
useRoute: jest.fn(),
|
|
70
|
-
useIsFocused: () => true,
|
|
71
|
-
};
|
|
72
|
-
});
|
|
73
|
-
|
|
74
47
|
const headerCustomOnPressMore = async (instance) => {
|
|
75
48
|
const headerCustom = instance?.findAllByType(HeaderCustom);
|
|
76
49
|
const buttonMore = headerCustom[0].findByProps({
|
|
@@ -92,7 +65,6 @@ describe('Test DeviceZigbeeDetail', () => {
|
|
|
92
65
|
});
|
|
93
66
|
mock.reset();
|
|
94
67
|
mock.resetHistory();
|
|
95
|
-
mockNavigate.mockClear();
|
|
96
68
|
Toast.show.mockClear();
|
|
97
69
|
});
|
|
98
70
|
|
|
@@ -125,11 +97,14 @@ describe('Test DeviceZigbeeDetail', () => {
|
|
|
125
97
|
await act(async () => {
|
|
126
98
|
menuActionMore[0].props.listMenuItem[0].doAction();
|
|
127
99
|
});
|
|
128
|
-
expect(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
100
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
101
|
+
Routes.DeviceGatewayInfo,
|
|
102
|
+
{
|
|
103
|
+
device: { id: 1, name: 'abc' },
|
|
104
|
+
isDevice: true,
|
|
105
|
+
isZigbee: true,
|
|
106
|
+
}
|
|
107
|
+
);
|
|
133
108
|
});
|
|
134
109
|
|
|
135
110
|
it('test render DeviceZigbeeDetail onPress more and onPress Delete zigbee', async () => {
|
|
@@ -152,7 +127,7 @@ describe('Test DeviceZigbeeDetail', () => {
|
|
|
152
127
|
await modal.props.onPressConfirm();
|
|
153
128
|
});
|
|
154
129
|
|
|
155
|
-
expect(
|
|
130
|
+
expect(global.mockedPop).toBeCalledWith(1);
|
|
156
131
|
expect(Toast.show).toBeCalledWith({
|
|
157
132
|
position: 'bottom',
|
|
158
133
|
text1: 'Delete successfully!',
|
|
@@ -209,16 +184,19 @@ describe('Test DeviceZigbeeDetail', () => {
|
|
|
209
184
|
await act(async () => {
|
|
210
185
|
await detail.props.onPressRow(1);
|
|
211
186
|
});
|
|
212
|
-
expect(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
187
|
+
expect(global.mockedNavigate).toBeCalledWith(
|
|
188
|
+
Routes.DetailConfigActionZigbee,
|
|
189
|
+
{
|
|
190
|
+
gatewayId: 1,
|
|
191
|
+
device: {
|
|
192
|
+
id: 1,
|
|
193
|
+
name: 'abc',
|
|
194
|
+
},
|
|
195
|
+
isAction: false,
|
|
196
|
+
isConfig: true,
|
|
197
|
+
itemActionConfig: 1,
|
|
198
|
+
}
|
|
199
|
+
);
|
|
222
200
|
});
|
|
223
201
|
|
|
224
202
|
it('test render GatewayDetail onPress TabPanel action onPressRow', async () => {
|
|
@@ -233,16 +211,19 @@ describe('Test DeviceZigbeeDetail', () => {
|
|
|
233
211
|
await act(async () => {
|
|
234
212
|
await detail.props.onPressRow(1);
|
|
235
213
|
});
|
|
236
|
-
expect(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
214
|
+
expect(global.mockedNavigate).toBeCalledWith(
|
|
215
|
+
Routes.DetailConfigActionZigbee,
|
|
216
|
+
{
|
|
217
|
+
gatewayId: 1,
|
|
218
|
+
device: {
|
|
219
|
+
id: 1,
|
|
220
|
+
name: 'abc',
|
|
221
|
+
},
|
|
222
|
+
isAction: true,
|
|
223
|
+
isConfig: false,
|
|
224
|
+
itemActionConfig: 1,
|
|
225
|
+
}
|
|
226
|
+
);
|
|
246
227
|
});
|
|
247
228
|
|
|
248
229
|
it('test render GatewayDetail onPress TabPanel zigbee config onRefresh', async () => {
|
|
@@ -13,24 +13,6 @@ import api from '../../../../utils/Apis/axios';
|
|
|
13
13
|
import { API } from '../../../../configs';
|
|
14
14
|
|
|
15
15
|
const mock = new MockAdapter(api.axiosInstance);
|
|
16
|
-
jest.mock('@react-navigation/native', () => {
|
|
17
|
-
return {
|
|
18
|
-
...jest.requireActual('@react-navigation/native'),
|
|
19
|
-
useNavigation: () => ({
|
|
20
|
-
navigate: jest.fn(),
|
|
21
|
-
pop: jest.fn(),
|
|
22
|
-
}),
|
|
23
|
-
useRoute: jest.fn().mockReturnValue({
|
|
24
|
-
params: {
|
|
25
|
-
methodsConnection: [
|
|
26
|
-
{ zigbee_gateway: 1 },
|
|
27
|
-
{ modbus_gateway: 1 },
|
|
28
|
-
{ arduino_gateway: 1 },
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
}),
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
16
|
|
|
35
17
|
const wrapComponent = () => (
|
|
36
18
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -40,6 +22,15 @@ const wrapComponent = () => (
|
|
|
40
22
|
|
|
41
23
|
describe('Test GatewayConnectionMethods', () => {
|
|
42
24
|
let tree;
|
|
25
|
+
global.mockedUseRoute.mockReturnValue({
|
|
26
|
+
params: {
|
|
27
|
+
methodsConnection: [
|
|
28
|
+
{ zigbee_gateway: 1 },
|
|
29
|
+
{ modbus_gateway: 1 },
|
|
30
|
+
{ arduino_gateway: 1 },
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
});
|
|
43
34
|
|
|
44
35
|
it('test render GatewayConnectionMethods', async () => {
|
|
45
36
|
mock.onGet(API.DEV_MODE.MODBUS.DETAIL(1)).reply(200, { baud_speed: 9600 });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { create, act } from 'react-test-renderer';
|
|
3
3
|
import Toast from 'react-native-toast-message';
|
|
4
|
-
import SegmentedControl from '@react-native-
|
|
4
|
+
import SegmentedControl from '@react-native-segmented-control/segmented-control';
|
|
5
5
|
import { useRoute } from '@react-navigation/native';
|
|
6
6
|
import MockAdapter from 'axios-mock-adapter';
|
|
7
7
|
|
|
@@ -28,33 +28,6 @@ const wrapComponent = () => (
|
|
|
28
28
|
</SCProvider>
|
|
29
29
|
);
|
|
30
30
|
|
|
31
|
-
jest.mock('react-native', () => {
|
|
32
|
-
const RN = jest.requireActual('react-native');
|
|
33
|
-
return Object.setPrototypeOf(
|
|
34
|
-
{
|
|
35
|
-
Alert: {
|
|
36
|
-
...RN.Alert,
|
|
37
|
-
alert: jest.fn(),
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
RN
|
|
41
|
-
);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const mockPop = jest.fn();
|
|
45
|
-
const mockNavigate = jest.fn();
|
|
46
|
-
jest.mock('@react-navigation/native', () => {
|
|
47
|
-
return {
|
|
48
|
-
...jest.requireActual('@react-navigation/native'),
|
|
49
|
-
useNavigation: () => ({
|
|
50
|
-
navigate: mockNavigate,
|
|
51
|
-
pop: mockPop,
|
|
52
|
-
}),
|
|
53
|
-
useRoute: jest.fn(),
|
|
54
|
-
useIsFocused: () => true,
|
|
55
|
-
};
|
|
56
|
-
});
|
|
57
|
-
|
|
58
31
|
const headerCustomOnPressMore = async (instance) => {
|
|
59
32
|
const headerCustom = instance?.findAllByType(HeaderCustom);
|
|
60
33
|
const buttonMore = headerCustom[0].findByProps({
|
|
@@ -124,7 +97,6 @@ describe('Test GatewayDetail', () => {
|
|
|
124
97
|
afterEach(() => {
|
|
125
98
|
mock.reset();
|
|
126
99
|
mock.resetHistory();
|
|
127
|
-
mockNavigate.mockClear();
|
|
128
100
|
Toast.show.mockClear();
|
|
129
101
|
});
|
|
130
102
|
|
|
@@ -155,7 +127,7 @@ describe('Test GatewayDetail', () => {
|
|
|
155
127
|
await act(async () => {
|
|
156
128
|
menuActionMore[0].props.listMenuItem[0].doAction();
|
|
157
129
|
});
|
|
158
|
-
expect(
|
|
130
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.GatewayInfo, {
|
|
159
131
|
chipId: 1,
|
|
160
132
|
});
|
|
161
133
|
});
|
|
@@ -177,7 +149,7 @@ describe('Test GatewayDetail', () => {
|
|
|
177
149
|
await act(async () => {
|
|
178
150
|
await modal.props.onPressConfirm();
|
|
179
151
|
});
|
|
180
|
-
expect(
|
|
152
|
+
expect(global.mockedPop).toBeCalledWith(1);
|
|
181
153
|
});
|
|
182
154
|
|
|
183
155
|
it('test render GatewayDetail onPress more and onPress Delete', async () => {
|
|
@@ -193,11 +165,12 @@ describe('Test GatewayDetail', () => {
|
|
|
193
165
|
menuActionMore.props.listMenuItem[2].doAction();
|
|
194
166
|
});
|
|
195
167
|
const modal = instance.findByType(ModalPopupCT);
|
|
168
|
+
|
|
169
|
+
mock.onDelete(API.DEV_MODE.GATEWAY.DETAIL(1)).reply(200);
|
|
196
170
|
await act(async () => {
|
|
197
171
|
await modal.props.onPressConfirm();
|
|
198
172
|
});
|
|
199
|
-
|
|
200
|
-
expect(mockPop).toBeCalledWith(1);
|
|
173
|
+
expect(global.mockedPop).toBeCalledWith(1);
|
|
201
174
|
});
|
|
202
175
|
|
|
203
176
|
it('test render GatewayDetail onPress TabPanel internal', async () => {
|
|
@@ -248,7 +221,7 @@ describe('Test GatewayDetail', () => {
|
|
|
248
221
|
await act(async () => {
|
|
249
222
|
await detail.props.onPressRow(1);
|
|
250
223
|
});
|
|
251
|
-
expect(
|
|
224
|
+
expect(global.mockedNavigate).toBeCalledWith(Routes.DeviceInternalDetail, {
|
|
252
225
|
device: 1,
|
|
253
226
|
gatewayId: 1,
|
|
254
227
|
isInternal: true,
|
|
@@ -262,7 +235,7 @@ describe('Test GatewayDetail', () => {
|
|
|
262
235
|
await act(async () => {
|
|
263
236
|
await detail.props.onPressRow(1);
|
|
264
237
|
});
|
|
265
|
-
expect(
|
|
238
|
+
expect(global.mockedNavigate).toBeCalledWith(Routes.DeviceZigbeeDetail, {
|
|
266
239
|
device: 1,
|
|
267
240
|
gatewayId: 1,
|
|
268
241
|
isInternal: false,
|
|
@@ -277,7 +250,7 @@ describe('Test GatewayDetail', () => {
|
|
|
277
250
|
await act(async () => {
|
|
278
251
|
await detail.props.onPressRow(1);
|
|
279
252
|
});
|
|
280
|
-
expect(
|
|
253
|
+
expect(global.mockedNavigate).toBeCalledWith(Routes.DeviceModbusDetail, {
|
|
281
254
|
device: 1,
|
|
282
255
|
gatewayId: 1,
|
|
283
256
|
isInternal: false,
|
|
@@ -301,7 +274,7 @@ describe('Test GatewayDetail', () => {
|
|
|
301
274
|
await act(async () => {
|
|
302
275
|
await detail.props.onPressRow(1);
|
|
303
276
|
});
|
|
304
|
-
expect(
|
|
277
|
+
expect(global.mockedNavigate).toBeCalledWith('', {
|
|
305
278
|
device: 1,
|
|
306
279
|
gatewayId: null,
|
|
307
280
|
isInternal: false,
|
|
@@ -16,7 +16,6 @@ import t from '../../../../hooks/Common/useTranslations';
|
|
|
16
16
|
import ModalPopupCT from '../../../../commons/ModalPopupCT';
|
|
17
17
|
import { SCConfig } from '../../../../configs';
|
|
18
18
|
|
|
19
|
-
const mockPop = jest.fn();
|
|
20
19
|
const mock = new MockAdapter(api.axiosInstance);
|
|
21
20
|
const wrapComponent = () => (
|
|
22
21
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -24,32 +23,6 @@ const wrapComponent = () => (
|
|
|
24
23
|
</SCProvider>
|
|
25
24
|
);
|
|
26
25
|
|
|
27
|
-
jest.mock('react-native', () => {
|
|
28
|
-
const RN = jest.requireActual('react-native');
|
|
29
|
-
return Object.setPrototypeOf(
|
|
30
|
-
{
|
|
31
|
-
Alert: {
|
|
32
|
-
...RN.Alert,
|
|
33
|
-
alert: jest.fn(),
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
RN
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const mockNavigate = jest.fn();
|
|
41
|
-
jest.mock('@react-navigation/native', () => {
|
|
42
|
-
return {
|
|
43
|
-
...jest.requireActual('@react-navigation/native'),
|
|
44
|
-
useNavigation: () => ({
|
|
45
|
-
navigate: mockNavigate,
|
|
46
|
-
pop: mockPop,
|
|
47
|
-
}),
|
|
48
|
-
useIsFocused: () => true,
|
|
49
|
-
useRoute: jest.fn(),
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
|
|
53
26
|
const buttonConnect = (instance) => {
|
|
54
27
|
return instance?.findByProps({
|
|
55
28
|
accessibilityLabel:
|
|
@@ -70,7 +43,6 @@ describe('Test GatewayInfo', () => {
|
|
|
70
43
|
chipId: 1,
|
|
71
44
|
},
|
|
72
45
|
});
|
|
73
|
-
mockNavigate.mockClear();
|
|
74
46
|
});
|
|
75
47
|
|
|
76
48
|
it('test render GatewayInfo', async () => {
|
|
@@ -120,9 +92,12 @@ describe('Test GatewayInfo', () => {
|
|
|
120
92
|
await act(async () => {
|
|
121
93
|
btnConnect.props.onPress();
|
|
122
94
|
});
|
|
123
|
-
expect(
|
|
124
|
-
|
|
125
|
-
|
|
95
|
+
expect(global.mockedNavigate).toBeCalledWith(
|
|
96
|
+
Routes.GatewayConnectionMethods,
|
|
97
|
+
{
|
|
98
|
+
methodsConnection: [],
|
|
99
|
+
}
|
|
100
|
+
);
|
|
126
101
|
});
|
|
127
102
|
|
|
128
103
|
it('test render GatewayInfo onPress delete gateway', async () => {
|
|
@@ -141,6 +116,6 @@ describe('Test GatewayInfo', () => {
|
|
|
141
116
|
await act(async () => {
|
|
142
117
|
await modal.props.onPressConfirm();
|
|
143
118
|
});
|
|
144
|
-
expect(
|
|
119
|
+
expect(global.mockedPop).toBeCalledWith(2);
|
|
145
120
|
});
|
|
146
121
|
});
|
|
@@ -13,18 +13,6 @@ import Routes from '../../../utils/Route';
|
|
|
13
13
|
import Gateway from '..';
|
|
14
14
|
const mock = new MockAdapter(api.axiosInstance);
|
|
15
15
|
|
|
16
|
-
const mockNavigate = jest.fn();
|
|
17
|
-
jest.mock('@react-navigation/native', () => {
|
|
18
|
-
return {
|
|
19
|
-
...jest.requireActual('@react-navigation/native'),
|
|
20
|
-
useNavigation: () => ({
|
|
21
|
-
navigate: mockNavigate,
|
|
22
|
-
}),
|
|
23
|
-
useRoute: jest.fn(),
|
|
24
|
-
useIsFocused: () => true,
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
|
|
28
16
|
const wrapComponent = (
|
|
29
17
|
route = {
|
|
30
18
|
params: {
|
|
@@ -42,7 +30,6 @@ describe('Test Gateway screen', () => {
|
|
|
42
30
|
afterEach(() => {
|
|
43
31
|
mock.reset();
|
|
44
32
|
mock.resetHistory();
|
|
45
|
-
mockNavigate.mockClear();
|
|
46
33
|
});
|
|
47
34
|
it('Test render', async () => {
|
|
48
35
|
await act(async () => {
|
|
@@ -71,7 +58,7 @@ describe('Test Gateway screen', () => {
|
|
|
71
58
|
await act(async () => {
|
|
72
59
|
await gatewayItems[0].props.onPress();
|
|
73
60
|
});
|
|
74
|
-
expect(
|
|
61
|
+
expect(global.mockedNavigate).toBeCalledWith(Routes.AllGatewayStack, {
|
|
75
62
|
params: {
|
|
76
63
|
item: {
|
|
77
64
|
id: 1,
|
|
@@ -14,17 +14,6 @@ const wrapComponent = (item) => (
|
|
|
14
14
|
</SCProvider>
|
|
15
15
|
);
|
|
16
16
|
|
|
17
|
-
const mockNavigate = jest.fn();
|
|
18
|
-
jest.mock('@react-navigation/native', () => {
|
|
19
|
-
return {
|
|
20
|
-
...jest.requireActual('@react-navigation/native'),
|
|
21
|
-
useNavigation: () => ({
|
|
22
|
-
navigate: mockNavigate,
|
|
23
|
-
}),
|
|
24
|
-
useIsFocused: jest.fn(),
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
|
|
28
17
|
describe('Test GatewayItem', () => {
|
|
29
18
|
let tree;
|
|
30
19
|
let item;
|
|
@@ -35,7 +24,6 @@ describe('Test GatewayItem', () => {
|
|
|
35
24
|
is_connected: false,
|
|
36
25
|
last_healthy: 1,
|
|
37
26
|
};
|
|
38
|
-
mockNavigate.mockClear();
|
|
39
27
|
});
|
|
40
28
|
|
|
41
29
|
it('test render GatewayItem connect false', async () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { create, act } from 'react-test-renderer';
|
|
3
|
-
import SegmentedControl from '@react-native-
|
|
3
|
+
import SegmentedControl from '@react-native-segmented-control/segmented-control';
|
|
4
4
|
import Carousel from 'react-native-new-snap-carousel';
|
|
5
5
|
|
|
6
6
|
import { SCProvider } from '../../../../../context';
|
|
@@ -15,17 +15,6 @@ const wrapComponent = (item = []) => (
|
|
|
15
15
|
</SCProvider>
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
const mockNavigate = jest.fn();
|
|
19
|
-
jest.mock('@react-navigation/native', () => {
|
|
20
|
-
return {
|
|
21
|
-
...jest.requireActual('@react-navigation/native'),
|
|
22
|
-
useNavigation: () => ({
|
|
23
|
-
navigate: mockNavigate,
|
|
24
|
-
}),
|
|
25
|
-
useIsFocused: jest.fn(),
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
|
|
29
18
|
describe('Test TabPaneCT', () => {
|
|
30
19
|
let tree;
|
|
31
20
|
let item;
|
|
@@ -42,7 +31,6 @@ describe('Test TabPaneCT', () => {
|
|
|
42
31
|
devices: [{ id: 1, name: 'device1' }],
|
|
43
32
|
},
|
|
44
33
|
];
|
|
45
|
-
mockNavigate.mockClear();
|
|
46
34
|
});
|
|
47
35
|
|
|
48
36
|
it('test render TabPaneCT', async () => {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
ScrollView,
|
|
7
7
|
RefreshControl,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
import SegmentedControl from '@react-native-
|
|
9
|
+
import SegmentedControl from '@react-native-segmented-control/segmented-control';
|
|
10
10
|
import Carousel from 'react-native-new-snap-carousel';
|
|
11
11
|
|
|
12
12
|
import { Text, StatusBox } from '../../../../commons';
|
|
@@ -7,14 +7,7 @@ import { API } from '../../../../configs';
|
|
|
7
7
|
import { useGateway } from '../useGateway';
|
|
8
8
|
|
|
9
9
|
const mock = new MockAdapter(api.axiosInstance);
|
|
10
|
-
|
|
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-
|
|
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
|
|
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
|
-
<
|
|
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
|
-
<
|
|
143
|
-
{
|
|
138
|
+
<FlatList
|
|
139
|
+
renderHeader={t('condition')}
|
|
140
|
+
data={normalConditions}
|
|
141
|
+
renderItem={({ item }) => {
|
|
144
142
|
return (
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
</
|
|
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
|
-
|
|
158
|
-
<
|
|
159
|
-
<
|
|
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
|
-
</
|
|
170
|
-
<
|
|
171
|
-
|
|
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
|
-
</
|
|
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(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
});
|