@eohjsc/react-native-smart-city 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- 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/AutomateStack.js +2 -2
- package/src/navigations/EmergencyContactsStack.js +2 -2
- package/src/navigations/SharedStack.js +6 -4
- package/src/navigations/UnitStack.js +2 -10
- 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/__test__/MultiUnits.test.js +7 -7
- package/src/screens/Automate/__test__/index.test.js +6 -6
- package/src/screens/Automate/index.js +2 -2
- 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/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/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
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import { Switch, TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
4
4
|
import DateTimePickerModal from 'react-native-modal-datetime-picker';
|
|
5
5
|
import moment from 'moment';
|
|
6
|
-
import { IconOutline } from '@ant-design/icons-react-native';
|
|
7
6
|
import { watchMultiConfigs } from '../../iot/Monitor';
|
|
8
7
|
|
|
9
8
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
@@ -184,7 +183,7 @@ const TimerActionTemplate = ({ item = {}, doAction, sensor = {} }) => {
|
|
|
184
183
|
<Text>{title}</Text>
|
|
185
184
|
{configuration.config_hour && configuration.config_minute && (
|
|
186
185
|
<View style={styles.wrapTimer}>
|
|
187
|
-
<
|
|
186
|
+
<AntDesign style={styles.iconClockCircle} name={'clock-circle'} />
|
|
188
187
|
<Text type="Label" color={Colors.Gray7}>
|
|
189
188
|
{textTimer ? textTimer : t('set_time')}
|
|
190
189
|
</Text>
|
|
@@ -194,7 +193,7 @@ const TimerActionTemplate = ({ item = {}, doAction, sensor = {} }) => {
|
|
|
194
193
|
{configuration.config_hour && !configuration.config_minute && (
|
|
195
194
|
<View style={styles.timerButton}>
|
|
196
195
|
<Text style={styles.textTimerEndLine}>{textTimer}</Text>
|
|
197
|
-
<
|
|
196
|
+
<AntDesign name="right" size={20} />
|
|
198
197
|
</View>
|
|
199
198
|
)}
|
|
200
199
|
</TouchableOpacity>
|
|
@@ -210,7 +209,7 @@ const TimerActionTemplate = ({ item = {}, doAction, sensor = {} }) => {
|
|
|
210
209
|
)}
|
|
211
210
|
<DateTimePickerModal
|
|
212
211
|
isVisible={showTime}
|
|
213
|
-
date={dataTime ? dataTime.valueOf() : moment().valueOf()}
|
|
212
|
+
date={new Date(dataTime ? dataTime.valueOf() : moment().valueOf())}
|
|
214
213
|
mode="time"
|
|
215
214
|
onConfirm={onConfirmTime}
|
|
216
215
|
onCancel={onHideTime}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
2
2
|
import React, { memo, useState, useCallback, useEffect } from 'react';
|
|
3
3
|
import { TouchableOpacity, View } from 'react-native';
|
|
4
4
|
|
|
@@ -122,7 +122,7 @@ const TwoButtonTemplate = memo(({ item = {}, doAction, sensor = {} }) => {
|
|
|
122
122
|
key={index}
|
|
123
123
|
>
|
|
124
124
|
<View style={styles.smallCircle}>
|
|
125
|
-
<
|
|
125
|
+
<AntDesign
|
|
126
126
|
name={button?.isCheckOnOff ? button?.icon_on : button?.icon_off}
|
|
127
127
|
size={44}
|
|
128
128
|
color={button?.isCheckOnOff ? Colors.Green7 : Colors.Gray6}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
4
|
import ColorPickerTemplate from '../ColorPickerTemplate';
|
|
5
5
|
import { WheelColorPicker } from '../ColorPickerTemplate';
|
|
@@ -10,14 +10,6 @@ import ColorPicker from 'react-native-wheel-color-picker';
|
|
|
10
10
|
import { DEVICE_TYPE } from '../../../configs/Constants';
|
|
11
11
|
|
|
12
12
|
const mockSetAction = jest.fn();
|
|
13
|
-
jest.mock('react', () => {
|
|
14
|
-
return {
|
|
15
|
-
...jest.requireActual('react'),
|
|
16
|
-
useContext: () => ({
|
|
17
|
-
setAction: mockSetAction,
|
|
18
|
-
}),
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
13
|
|
|
22
14
|
jest.mock('../../../iot/Monitor');
|
|
23
15
|
const mockDoAction = jest.fn();
|
|
@@ -55,6 +47,9 @@ describe('Test ColorPickerTemplate', () => {
|
|
|
55
47
|
title: '',
|
|
56
48
|
};
|
|
57
49
|
mockSetAction.mockClear();
|
|
50
|
+
useContext.mockReturnValue({
|
|
51
|
+
setAction: mockSetAction,
|
|
52
|
+
});
|
|
58
53
|
});
|
|
59
54
|
|
|
60
55
|
it('render template ColorPickerTemplate', async () => {
|
|
@@ -13,13 +13,6 @@ jest.mock('../../../iot/states', () => ({
|
|
|
13
13
|
useConfigGlobalState: () => [{ 5: { value: 25 } }, null],
|
|
14
14
|
}));
|
|
15
15
|
|
|
16
|
-
jest.mock('@react-navigation/native', () => {
|
|
17
|
-
return {
|
|
18
|
-
...jest.requireActual('@react-navigation/native'),
|
|
19
|
-
useFocusEffect: jest.fn(),
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
|
|
23
16
|
describe('Test NumberUpDownTemplate', () => {
|
|
24
17
|
const actionData = {
|
|
25
18
|
color: '#00979D',
|
|
@@ -27,7 +20,7 @@ describe('Test NumberUpDownTemplate', () => {
|
|
|
27
20
|
command_prefer_over_googlehome: false,
|
|
28
21
|
command_prefer_over_internet: false,
|
|
29
22
|
googlehome_actions: [],
|
|
30
|
-
icon: '
|
|
23
|
+
icon: 'caretup',
|
|
31
24
|
id: 20,
|
|
32
25
|
key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
33
26
|
};
|
|
@@ -396,7 +389,7 @@ describe('Test NumberUpDownTemplate', () => {
|
|
|
396
389
|
command_prefer_over_googlehome: false,
|
|
397
390
|
command_prefer_over_internet: false,
|
|
398
391
|
googlehome_actions: [],
|
|
399
|
-
icon: '
|
|
392
|
+
icon: 'caretup',
|
|
400
393
|
id: 20,
|
|
401
394
|
key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
402
395
|
},
|
|
@@ -18,13 +18,6 @@ const wrapComponent = (item, mockDoAction) => (
|
|
|
18
18
|
</SCProvider>
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
jest.mock('@react-navigation/native', () => {
|
|
22
|
-
return {
|
|
23
|
-
...jest.requireActual('@react-navigation/native'),
|
|
24
|
-
useFocusEffect: jest.fn(),
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
|
|
28
21
|
describe('Test OneBigButtonTemplate', () => {
|
|
29
22
|
const actionOnData = {
|
|
30
23
|
color: '#00979D',
|
|
@@ -32,7 +25,7 @@ describe('Test OneBigButtonTemplate', () => {
|
|
|
32
25
|
command_prefer_over_googlehome: false,
|
|
33
26
|
command_prefer_over_internet: false,
|
|
34
27
|
googlehome_actions: [],
|
|
35
|
-
icon: '
|
|
28
|
+
icon: 'caretup',
|
|
36
29
|
id: 20,
|
|
37
30
|
key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
38
31
|
};
|
|
@@ -43,7 +36,7 @@ describe('Test OneBigButtonTemplate', () => {
|
|
|
43
36
|
command_prefer_over_googlehome: false,
|
|
44
37
|
command_prefer_over_internet: false,
|
|
45
38
|
googlehome_actions: [],
|
|
46
|
-
icon: '
|
|
39
|
+
icon: 'caretup',
|
|
47
40
|
id: 20,
|
|
48
41
|
key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
49
42
|
};
|
|
@@ -51,11 +44,11 @@ describe('Test OneBigButtonTemplate', () => {
|
|
|
51
44
|
configuration: {
|
|
52
45
|
action_on: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
53
46
|
action_on_data: actionOnData,
|
|
54
|
-
icon_on: '
|
|
47
|
+
icon_on: 'caretup',
|
|
55
48
|
text_on: 'ON',
|
|
56
49
|
action_off: '5ed1d4dc-a905-47cd-b0c9-f979644bd21b',
|
|
57
50
|
action_off_data: actionOffData,
|
|
58
|
-
icon_off: '
|
|
51
|
+
icon_off: 'caretup',
|
|
59
52
|
text_off: 'OFF',
|
|
60
53
|
config: 1,
|
|
61
54
|
},
|
|
@@ -13,13 +13,6 @@ jest.mock('../../../iot/states', () => ({
|
|
|
13
13
|
useConfigGlobalState: jest.fn(),
|
|
14
14
|
}));
|
|
15
15
|
|
|
16
|
-
jest.mock('@react-navigation/native', () => {
|
|
17
|
-
return {
|
|
18
|
-
...jest.requireActual('@react-navigation/native'),
|
|
19
|
-
useFocusEffect: jest.fn(),
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
|
|
23
16
|
const wrapComponent = (item, doAction, sensor) => (
|
|
24
17
|
<SCProvider initState={mockSCStore({})}>
|
|
25
18
|
<OnOffSmartLock item={item} doAction={doAction} sensor={sensor} />
|
|
@@ -36,7 +29,7 @@ describe('Test OnOffTemplate', () => {
|
|
|
36
29
|
command_prefer_over_googlehome: false,
|
|
37
30
|
command_prefer_over_internet: false,
|
|
38
31
|
googlehome_actions: [],
|
|
39
|
-
icon: '
|
|
32
|
+
icon: 'caretup',
|
|
40
33
|
id: 20,
|
|
41
34
|
key: 'key-2',
|
|
42
35
|
};
|
|
@@ -46,7 +39,7 @@ describe('Test OnOffTemplate', () => {
|
|
|
46
39
|
command_prefer_over_googlehome: false,
|
|
47
40
|
command_prefer_over_internet: false,
|
|
48
41
|
googlehome_actions: [],
|
|
49
|
-
icon: '
|
|
42
|
+
icon: 'caretup',
|
|
50
43
|
id: 20,
|
|
51
44
|
key: 'key-3',
|
|
52
45
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
2
|
import { act, create } from 'react-test-renderer';
|
|
4
3
|
|
|
5
|
-
import { DEVICE_TYPE
|
|
4
|
+
import { DEVICE_TYPE } from '../../../configs/Constants';
|
|
6
5
|
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
7
6
|
import OnOffTemplate from '../OnOffTemplate';
|
|
8
7
|
import OnOffButtonTemplate from '../OnOffTemplate/OnOffButtonTemplate';
|
|
@@ -22,13 +21,6 @@ jest.mock('../../../iot/states', () => ({
|
|
|
22
21
|
useConfigGlobalState: () => [{ 5: { value: 2 } }, null],
|
|
23
22
|
}));
|
|
24
23
|
|
|
25
|
-
jest.mock('@react-navigation/native', () => {
|
|
26
|
-
return {
|
|
27
|
-
...jest.requireActual('@react-navigation/native'),
|
|
28
|
-
useFocusEffect: jest.fn(),
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
|
|
32
24
|
describe('Test OnOffTemplate', () => {
|
|
33
25
|
let displayItem;
|
|
34
26
|
let tree;
|
|
@@ -40,7 +32,7 @@ describe('Test OnOffTemplate', () => {
|
|
|
40
32
|
command_prefer_over_googlehome: false,
|
|
41
33
|
command_prefer_over_internet: false,
|
|
42
34
|
googlehome_actions: [],
|
|
43
|
-
icon: '
|
|
35
|
+
icon: 'caretup',
|
|
44
36
|
id: 20,
|
|
45
37
|
key: 'key-1',
|
|
46
38
|
};
|
|
@@ -50,7 +42,7 @@ describe('Test OnOffTemplate', () => {
|
|
|
50
42
|
command_prefer_over_googlehome: false,
|
|
51
43
|
command_prefer_over_internet: false,
|
|
52
44
|
googlehome_actions: [],
|
|
53
|
-
icon: '
|
|
45
|
+
icon: 'caretup',
|
|
54
46
|
id: 20,
|
|
55
47
|
key: 'key-2',
|
|
56
48
|
};
|
|
@@ -60,7 +52,7 @@ describe('Test OnOffTemplate', () => {
|
|
|
60
52
|
command_prefer_over_googlehome: false,
|
|
61
53
|
command_prefer_over_internet: false,
|
|
62
54
|
googlehome_actions: [],
|
|
63
|
-
icon: '
|
|
55
|
+
icon: 'caretup',
|
|
64
56
|
id: 20,
|
|
65
57
|
key: 'key-3',
|
|
66
58
|
};
|
|
@@ -113,14 +105,8 @@ describe('Test OnOffTemplate', () => {
|
|
|
113
105
|
});
|
|
114
106
|
const instance = tree.root;
|
|
115
107
|
|
|
116
|
-
const templateOnOffButton = instance.findAll(
|
|
117
|
-
(el) =>
|
|
118
|
-
el.props.accessibilityLabel ===
|
|
119
|
-
AccessibilityLabel.ON_OFF_BUTTON_ACTION_TEMPLATE && el.type === View
|
|
120
|
-
);
|
|
121
108
|
const templateOnOffSimple = instance.findAllByType(OnOffSimpleTemplate);
|
|
122
109
|
|
|
123
|
-
expect(templateOnOffButton).not.toHaveLength(1);
|
|
124
110
|
expect(templateOnOffSimple).not.toHaveLength(1);
|
|
125
111
|
});
|
|
126
112
|
|
|
@@ -30,7 +30,7 @@ describe('Test OneBigButtonTemplate', () => {
|
|
|
30
30
|
command_prefer_over_googlehome: false,
|
|
31
31
|
command_prefer_over_internet: false,
|
|
32
32
|
googlehome_actions: [],
|
|
33
|
-
icon: '
|
|
33
|
+
icon: 'caretup',
|
|
34
34
|
id: 20,
|
|
35
35
|
key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
36
36
|
};
|
|
@@ -38,7 +38,7 @@ describe('Test OneBigButtonTemplate', () => {
|
|
|
38
38
|
configuration: {
|
|
39
39
|
action: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
40
40
|
action_data: actionData,
|
|
41
|
-
icon: '
|
|
41
|
+
icon: 'caretup',
|
|
42
42
|
text: 'UP',
|
|
43
43
|
},
|
|
44
44
|
};
|
|
@@ -30,13 +30,6 @@ jest.mock('../../../iot/states', () => ({
|
|
|
30
30
|
useConfigGlobalState: () => [{ 5: { value: 2 } }, null],
|
|
31
31
|
}));
|
|
32
32
|
|
|
33
|
-
jest.mock('@react-navigation/native', () => {
|
|
34
|
-
return {
|
|
35
|
-
...jest.requireActual('@react-navigation/native'),
|
|
36
|
-
useFocusEffect: jest.fn(),
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
|
|
40
33
|
describe('Test OptionsDropdownActionTemplate', () => {
|
|
41
34
|
const actionData = {
|
|
42
35
|
color: '#00979D',
|
|
@@ -44,7 +37,7 @@ describe('Test OptionsDropdownActionTemplate', () => {
|
|
|
44
37
|
command_prefer_over_googlehome: false,
|
|
45
38
|
command_prefer_over_internet: false,
|
|
46
39
|
googlehome_actions: [],
|
|
47
|
-
icon: '
|
|
40
|
+
icon: 'caretup',
|
|
48
41
|
id: 20,
|
|
49
42
|
key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
50
43
|
};
|
|
@@ -8,13 +8,6 @@ import { DEVICE_TYPE } from '../../../configs/Constants';
|
|
|
8
8
|
const mockDoAction = jest.fn();
|
|
9
9
|
const mockActionData = jest.fn();
|
|
10
10
|
|
|
11
|
-
jest.mock('@react-navigation/native', () => {
|
|
12
|
-
return {
|
|
13
|
-
...jest.requireActual('@react-navigation/native'),
|
|
14
|
-
useFocusEffect: jest.fn(),
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
|
|
18
11
|
describe('Test StatesGridActionTemplate', () => {
|
|
19
12
|
let tree;
|
|
20
13
|
let displayItem;
|
|
@@ -17,13 +17,6 @@ const wrapComponent = (item, mockDoAction, isOn) => (
|
|
|
17
17
|
</SCProvider>
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
jest.mock('@react-navigation/native', () => {
|
|
21
|
-
return {
|
|
22
|
-
...jest.requireActual('@react-navigation/native'),
|
|
23
|
-
useFocusEffect: jest.fn(),
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
|
|
27
20
|
describe('Test SwitchButtonTemplate', () => {
|
|
28
21
|
const actionOnData = {
|
|
29
22
|
color: '#00979D',
|
|
@@ -31,7 +24,7 @@ describe('Test SwitchButtonTemplate', () => {
|
|
|
31
24
|
command_prefer_over_googlehome: false,
|
|
32
25
|
command_prefer_over_internet: false,
|
|
33
26
|
googlehome_actions: [],
|
|
34
|
-
icon: '
|
|
27
|
+
icon: 'caretup',
|
|
35
28
|
id: 20,
|
|
36
29
|
key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
37
30
|
};
|
|
@@ -42,7 +35,7 @@ describe('Test SwitchButtonTemplate', () => {
|
|
|
42
35
|
command_prefer_over_googlehome: false,
|
|
43
36
|
command_prefer_over_internet: false,
|
|
44
37
|
googlehome_actions: [],
|
|
45
|
-
icon: '
|
|
38
|
+
icon: 'caretup',
|
|
46
39
|
id: 20,
|
|
47
40
|
key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
48
41
|
};
|
|
@@ -50,11 +43,11 @@ describe('Test SwitchButtonTemplate', () => {
|
|
|
50
43
|
configuration: {
|
|
51
44
|
action_on: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
52
45
|
action_on_data: actionOnData,
|
|
53
|
-
icon_on: '
|
|
46
|
+
icon_on: 'caretup',
|
|
54
47
|
text_on: 'ON',
|
|
55
48
|
action_off: '5ed1d4dc-a905-47cd-b0c9-f979644bd21b',
|
|
56
49
|
action_off_data: actionOffData,
|
|
57
|
-
icon_off: '
|
|
50
|
+
icon_off: 'caretup',
|
|
58
51
|
text_off: 'OFF',
|
|
59
52
|
config: 1,
|
|
60
53
|
},
|
|
@@ -67,12 +60,8 @@ describe('Test SwitchButtonTemplate', () => {
|
|
|
67
60
|
await act(async () => {
|
|
68
61
|
wrapper = await create(wrapComponent(displayItem, mockDoAction));
|
|
69
62
|
});
|
|
70
|
-
|
|
71
|
-
const renderJson = wrapper.toJSON();
|
|
72
63
|
const switchButton = wrapper.root.findByType(Switch);
|
|
73
64
|
|
|
74
|
-
expect(renderJson[1].props?.visible).toEqual(false);
|
|
75
|
-
expect(renderJson[1]?.type).toEqual('Modal');
|
|
76
65
|
expect(switchButton.props.value).toEqual(state);
|
|
77
66
|
};
|
|
78
67
|
|
|
@@ -30,13 +30,6 @@ jest.mock('../../../iot/states', () => ({
|
|
|
30
30
|
useConfigGlobalState: () => [{ 5: { value: 2 } }, null],
|
|
31
31
|
}));
|
|
32
32
|
|
|
33
|
-
jest.mock('@react-navigation/native', () => {
|
|
34
|
-
return {
|
|
35
|
-
...jest.requireActual('@react-navigation/native'),
|
|
36
|
-
useFocusEffect: jest.fn(),
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
|
|
40
33
|
describe('Test TerminalBoxTemplate', () => {
|
|
41
34
|
let displayItem;
|
|
42
35
|
let sensor;
|
|
@@ -27,13 +27,6 @@ jest.mock('../../../iot/states', () => ({
|
|
|
27
27
|
useConfigGlobalState: () => [{ 5: { value: 2 } }, null],
|
|
28
28
|
}));
|
|
29
29
|
|
|
30
|
-
jest.mock('@react-navigation/native', () => {
|
|
31
|
-
return {
|
|
32
|
-
...jest.requireActual('@react-navigation/native'),
|
|
33
|
-
useFocusEffect: jest.fn(),
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
|
|
37
30
|
describe('Test TextBoxTemplate', () => {
|
|
38
31
|
const actionData = {
|
|
39
32
|
color: '#00979D',
|
|
@@ -41,7 +34,7 @@ describe('Test TextBoxTemplate', () => {
|
|
|
41
34
|
command_prefer_over_googlehome: false,
|
|
42
35
|
command_prefer_over_internet: false,
|
|
43
36
|
googlehome_actions: [],
|
|
44
|
-
icon: '
|
|
37
|
+
icon: 'caretup',
|
|
45
38
|
id: 20,
|
|
46
39
|
key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
47
40
|
};
|
|
@@ -17,13 +17,6 @@ jest.mock('../../../iot/states', () => ({
|
|
|
17
17
|
useConfigGlobalState: () => [{ 5: { value: 18 }, 6: { value: 30 } }, null],
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
|
-
jest.mock('@react-navigation/native', () => {
|
|
21
|
-
return {
|
|
22
|
-
...jest.requireActual('@react-navigation/native'),
|
|
23
|
-
useFocusEffect: jest.fn(),
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
|
|
27
20
|
const mockDoAction = jest.fn();
|
|
28
21
|
|
|
29
22
|
const wrapComponent = (item, sensor) => (
|
|
@@ -39,7 +32,7 @@ describe('Test TimerActionTemplate success with config value', () => {
|
|
|
39
32
|
command_prefer_over_googlehome: false,
|
|
40
33
|
command_prefer_over_internet: false,
|
|
41
34
|
googlehome_actions: [],
|
|
42
|
-
icon: '
|
|
35
|
+
icon: 'caretup',
|
|
43
36
|
id: 20,
|
|
44
37
|
key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
45
38
|
};
|
|
@@ -90,15 +83,15 @@ describe('Test TimerActionTemplate success with config value', () => {
|
|
|
90
83
|
});
|
|
91
84
|
expect(mockDoAction).toBeCalled();
|
|
92
85
|
|
|
93
|
-
const
|
|
86
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
94
87
|
await act(async () => {
|
|
95
|
-
await
|
|
88
|
+
await touchableOpacities[0].props.onPress();
|
|
96
89
|
});
|
|
97
90
|
|
|
98
91
|
const dateTimePicker = instance.findByType(DateTimePickerModal);
|
|
99
92
|
expect(dateTimePicker.props.isVisible).toBeTruthy();
|
|
100
93
|
expect(dateTimePicker.props.date).toEqual(
|
|
101
|
-
moment('18:30', 'HH:mm').valueOf()
|
|
94
|
+
new Date(moment('18:30', 'HH:mm').valueOf())
|
|
102
95
|
);
|
|
103
96
|
});
|
|
104
97
|
|
|
@@ -127,13 +120,13 @@ describe('Test TimerActionTemplate success with config value', () => {
|
|
|
127
120
|
await act(async () => {
|
|
128
121
|
await dateTimePicker.props.onConfirm();
|
|
129
122
|
});
|
|
130
|
-
const
|
|
131
|
-
expect(
|
|
123
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
124
|
+
expect(touchableOpacities).toHaveLength(3);
|
|
132
125
|
await act(async () => {
|
|
133
|
-
await
|
|
126
|
+
await touchableOpacities[0].props.onPress();
|
|
134
127
|
});
|
|
135
128
|
await act(async () => {
|
|
136
|
-
await
|
|
129
|
+
await touchableOpacities[2].props.onPress(3);
|
|
137
130
|
});
|
|
138
131
|
expect(mockDoAction).toBeCalled();
|
|
139
132
|
});
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { Switch } from 'react-native';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
4
|
import DateTimePickerModal from 'react-native-modal-datetime-picker';
|
|
5
|
-
import moment from 'moment';
|
|
6
5
|
|
|
7
6
|
import Text from '../../Text';
|
|
8
7
|
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
@@ -16,13 +15,6 @@ jest.mock('../../../iot/states', () => ({
|
|
|
16
15
|
useConfigGlobalState: () => [{}, null],
|
|
17
16
|
}));
|
|
18
17
|
|
|
19
|
-
jest.mock('@react-navigation/native', () => {
|
|
20
|
-
return {
|
|
21
|
-
...jest.requireActual('@react-navigation/native'),
|
|
22
|
-
useFocusEffect: jest.fn(),
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
|
|
26
18
|
const wrapComponent = (item, mockDoAction, is_managed_by_backend) => (
|
|
27
19
|
<SCProvider initState={mockSCStore({})}>
|
|
28
20
|
<TimerActionTemplate
|
|
@@ -40,7 +32,7 @@ describe('Test TimerActionTemplate without config value', () => {
|
|
|
40
32
|
command_prefer_over_googlehome: false,
|
|
41
33
|
command_prefer_over_internet: false,
|
|
42
34
|
googlehome_actions: [],
|
|
43
|
-
icon: '
|
|
35
|
+
icon: 'caretup',
|
|
44
36
|
id: 20,
|
|
45
37
|
key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
46
38
|
};
|
|
@@ -77,7 +69,7 @@ describe('Test TimerActionTemplate without config value', () => {
|
|
|
77
69
|
const dateTimePicker = instance.findByType(DateTimePickerModal);
|
|
78
70
|
expect(dateTimePicker.props.isVisible).toBeFalsy();
|
|
79
71
|
expect(dateTimePicker.props.date).toEqual(
|
|
80
|
-
|
|
72
|
+
new Date('2021-09-09T10:00:00.000Z')
|
|
81
73
|
);
|
|
82
74
|
});
|
|
83
75
|
|
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
4
|
import { DEVICE_TYPE } from '../../../configs/Constants';
|
|
5
5
|
import TwoButtonTemplate from '../TwoButtonTemplate';
|
|
6
6
|
|
|
7
|
-
jest.mock('react', () => ({
|
|
8
|
-
...jest.requireActual('react'),
|
|
9
|
-
useState: jest.fn(),
|
|
10
|
-
}));
|
|
11
|
-
|
|
12
|
-
jest.mock('@react-navigation/native', () => {
|
|
13
|
-
return {
|
|
14
|
-
...jest.requireActual('@react-navigation/native'),
|
|
15
|
-
useFocusEffect: jest.fn(),
|
|
16
|
-
};
|
|
17
|
-
});
|
|
18
|
-
|
|
19
7
|
describe('Test TwoButtonTemplate', () => {
|
|
20
8
|
const actionOnData = {
|
|
21
9
|
color: '#00979D',
|
|
@@ -23,7 +11,7 @@ describe('Test TwoButtonTemplate', () => {
|
|
|
23
11
|
command_prefer_over_googlehome: false,
|
|
24
12
|
command_prefer_over_internet: false,
|
|
25
13
|
googlehome_actions: [],
|
|
26
|
-
icon: '
|
|
14
|
+
icon: 'caretup',
|
|
27
15
|
id: 20,
|
|
28
16
|
key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
29
17
|
};
|
|
@@ -34,7 +22,7 @@ describe('Test TwoButtonTemplate', () => {
|
|
|
34
22
|
command_prefer_over_googlehome: false,
|
|
35
23
|
command_prefer_over_internet: false,
|
|
36
24
|
googlehome_actions: [],
|
|
37
|
-
icon: '
|
|
25
|
+
icon: 'caretup',
|
|
38
26
|
id: 20,
|
|
39
27
|
key: '5ed1d4dc-a905-47cd-b0c9-f979644bd21a',
|
|
40
28
|
};
|
|
@@ -73,11 +61,7 @@ describe('Test TwoButtonTemplate', () => {
|
|
|
73
61
|
};
|
|
74
62
|
let wrapper;
|
|
75
63
|
|
|
76
|
-
const setState = jest.fn();
|
|
77
|
-
useState.mockImplementation((init) => [init, setState]);
|
|
78
|
-
|
|
79
64
|
const assertRender = async (state, text) => {
|
|
80
|
-
useState.mockImplementationOnce((init) => [state, setState]);
|
|
81
65
|
const mockDoAction = jest.fn();
|
|
82
66
|
await act(async () => {
|
|
83
67
|
wrapper = create(
|
|
@@ -101,7 +85,6 @@ describe('Test TwoButtonTemplate', () => {
|
|
|
101
85
|
});
|
|
102
86
|
|
|
103
87
|
const assertActionCall = async (state, action_data) => {
|
|
104
|
-
useState.mockImplementationOnce((init) => [state, setState]);
|
|
105
88
|
const mockDoAction = jest.fn();
|
|
106
89
|
await act(async () => {
|
|
107
90
|
wrapper = create(
|