@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
|
@@ -7,16 +7,6 @@ import MyUnitDevice from '../MyUnitDevice';
|
|
|
7
7
|
import ItemQuickAction from '../../../../commons/Action/ItemQuickAction';
|
|
8
8
|
import Text from '../../../../commons/Text';
|
|
9
9
|
|
|
10
|
-
const mockNavigate = jest.fn();
|
|
11
|
-
jest.mock('@react-navigation/native', () => {
|
|
12
|
-
return {
|
|
13
|
-
...jest.requireActual('@react-navigation/native'),
|
|
14
|
-
useNavigation: () => ({
|
|
15
|
-
navigate: mockNavigate,
|
|
16
|
-
}),
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
|
|
20
10
|
jest.mock('react', () => {
|
|
21
11
|
return {
|
|
22
12
|
...jest.requireActual('react'),
|
|
@@ -57,7 +47,7 @@ describe('Test MyUnitDevice', () => {
|
|
|
57
47
|
await act(async () => {
|
|
58
48
|
await touches[0].props.onPress();
|
|
59
49
|
});
|
|
60
|
-
expect(
|
|
50
|
+
expect(global.mockedNavigate).toHaveBeenCalled();
|
|
61
51
|
});
|
|
62
52
|
|
|
63
53
|
it('Test render without status', async () => {
|
|
@@ -25,16 +25,6 @@ const wrapComponent = (item, navigation) => (
|
|
|
25
25
|
</SCProvider>
|
|
26
26
|
);
|
|
27
27
|
|
|
28
|
-
const mockNavigate = jest.fn();
|
|
29
|
-
jest.mock('@react-navigation/native', () => {
|
|
30
|
-
return {
|
|
31
|
-
...jest.requireActual('@react-navigation/native'),
|
|
32
|
-
useNavigation: () => ({
|
|
33
|
-
navigate: mockNavigate,
|
|
34
|
-
}),
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
|
|
38
28
|
describe('Test SharedUnit', () => {
|
|
39
29
|
let tree;
|
|
40
30
|
|
|
@@ -70,7 +60,7 @@ describe('Test SharedUnit', () => {
|
|
|
70
60
|
await act(async () => {
|
|
71
61
|
touchSharedUnit.props.onPress();
|
|
72
62
|
});
|
|
73
|
-
expect(
|
|
63
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.UnitStack, {
|
|
74
64
|
screen: Routes.UnitDetail,
|
|
75
65
|
params: {
|
|
76
66
|
unitId: 3,
|
|
@@ -20,22 +20,11 @@ import { mockSCStore } from '../../../context/mockStore';
|
|
|
20
20
|
import api from '../../../utils/Apis/axios';
|
|
21
21
|
import { WrapHeaderScrollable } from '../../../commons';
|
|
22
22
|
import AirQuality from '../components/AirQuality';
|
|
23
|
+
import Text from '../../../commons/Text';
|
|
24
|
+
import { useConfigGlobalState } from '../../../iot/states';
|
|
23
25
|
|
|
24
26
|
const mock = new MockAdapter(api.axiosInstance);
|
|
25
27
|
|
|
26
|
-
const mockedNavigate = jest.fn();
|
|
27
|
-
|
|
28
|
-
jest.mock('@react-navigation/native', () => {
|
|
29
|
-
return {
|
|
30
|
-
...jest.requireActual('@react-navigation/native'),
|
|
31
|
-
useNavigation: () => ({
|
|
32
|
-
navigate: mockedNavigate,
|
|
33
|
-
}),
|
|
34
|
-
useIsFocused: () => true,
|
|
35
|
-
useFocusEffect: (func) => func(),
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
|
|
39
28
|
jest.mock('react-native-onesignal', () => {
|
|
40
29
|
return {
|
|
41
30
|
setNotificationWillShowInForegroundHandler: jest.fn(),
|
|
@@ -49,6 +38,10 @@ jest.mock('../../../hooks', () => {
|
|
|
49
38
|
};
|
|
50
39
|
});
|
|
51
40
|
|
|
41
|
+
jest.mock('../../../iot/states', () => ({
|
|
42
|
+
useConfigGlobalState: jest.fn(),
|
|
43
|
+
}));
|
|
44
|
+
|
|
52
45
|
const wrapComponent = (route) => (
|
|
53
46
|
<SCProvider initState={mockSCStore({})}>
|
|
54
47
|
<UnitSummary route={route} />
|
|
@@ -60,6 +53,7 @@ describe('Test UnitSummary', () => {
|
|
|
60
53
|
|
|
61
54
|
beforeEach(() => {
|
|
62
55
|
mock.reset();
|
|
56
|
+
useConfigGlobalState.mockReturnValue([{}]);
|
|
63
57
|
Date.now = jest.fn(() => new Date('2021-01-24T12:00:00.000Z'));
|
|
64
58
|
route = {
|
|
65
59
|
params: {
|
|
@@ -79,7 +73,9 @@ describe('Test UnitSummary', () => {
|
|
|
79
73
|
let tree;
|
|
80
74
|
|
|
81
75
|
it('onRefresh', async () => {
|
|
82
|
-
mock.onGet(API.UNIT.UNIT_SUMMARY_DETAIL(1, 1)).reply(200
|
|
76
|
+
mock.onGet(API.UNIT.UNIT_SUMMARY_DETAIL(1, 1)).reply(200, {
|
|
77
|
+
data: {},
|
|
78
|
+
});
|
|
83
79
|
await act(async () => {
|
|
84
80
|
tree = await create(wrapComponent(route));
|
|
85
81
|
});
|
|
@@ -188,7 +184,9 @@ describe('Test UnitSummary', () => {
|
|
|
188
184
|
|
|
189
185
|
it('test receive notification with summary_id then reload data', async () => {
|
|
190
186
|
jest.useFakeTimers();
|
|
191
|
-
mock.onGet(API.UNIT.UNIT_SUMMARY_DETAIL(1, 1)).reply(200
|
|
187
|
+
mock.onGet(API.UNIT.UNIT_SUMMARY_DETAIL(1, 1)).reply(200, {
|
|
188
|
+
data: {},
|
|
189
|
+
});
|
|
192
190
|
const dataNotification = {
|
|
193
191
|
params: {
|
|
194
192
|
summary_id: 1,
|
|
@@ -207,7 +205,9 @@ describe('Test UnitSummary', () => {
|
|
|
207
205
|
|
|
208
206
|
it('test receive notification with other summary_id then not reload data', async () => {
|
|
209
207
|
jest.useFakeTimers();
|
|
210
|
-
mock.onGet(API.UNIT.UNIT_SUMMARY_DETAIL(1, 1)).reply(200
|
|
208
|
+
mock.onGet(API.UNIT.UNIT_SUMMARY_DETAIL(1, 1)).reply(200, {
|
|
209
|
+
data: {},
|
|
210
|
+
});
|
|
211
211
|
const dataNotification = {
|
|
212
212
|
params: {
|
|
213
213
|
summary_id: 2,
|
|
@@ -222,6 +222,7 @@ describe('Test UnitSummary', () => {
|
|
|
222
222
|
await act(async () => {
|
|
223
223
|
jest.runOnlyPendingTimers();
|
|
224
224
|
});
|
|
225
|
+
expect(mock.history.get.length).toBe(1);
|
|
225
226
|
});
|
|
226
227
|
|
|
227
228
|
let list_value = [
|
|
@@ -286,13 +287,46 @@ describe('Test UnitSummary', () => {
|
|
|
286
287
|
await act(async () => {
|
|
287
288
|
await touch.props.onPress();
|
|
288
289
|
});
|
|
289
|
-
expect(mockedNavigate).toHaveBeenLastCalledWith(
|
|
290
|
+
expect(global.mockedNavigate).toHaveBeenLastCalledWith(
|
|
290
291
|
UnitSummaryDetail.guideName
|
|
291
292
|
);
|
|
292
293
|
}
|
|
293
294
|
});
|
|
294
295
|
});
|
|
295
296
|
|
|
297
|
+
test('create Unit Summary temperature value', async () => {
|
|
298
|
+
mock
|
|
299
|
+
.onGet(
|
|
300
|
+
API.UNIT.UNIT_SUMMARY_DETAIL(
|
|
301
|
+
route.params.unitId,
|
|
302
|
+
route.params.summaryData.id
|
|
303
|
+
)
|
|
304
|
+
)
|
|
305
|
+
.reply(200, {
|
|
306
|
+
data: {
|
|
307
|
+
listConfigs: {
|
|
308
|
+
temp: 1,
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
});
|
|
312
|
+
route.params.summaryData.screen = Routes.Temperature;
|
|
313
|
+
useConfigGlobalState.mockReturnValue([
|
|
314
|
+
{
|
|
315
|
+
1: {
|
|
316
|
+
value: 50,
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
]);
|
|
320
|
+
await act(async () => {
|
|
321
|
+
tree = await create(wrapComponent(route));
|
|
322
|
+
});
|
|
323
|
+
const instance = tree.root;
|
|
324
|
+
const texts = instance.findAll((el) => {
|
|
325
|
+
return el.type === Text && el.props.children === '50 °C';
|
|
326
|
+
});
|
|
327
|
+
expect(texts).toHaveLength(1);
|
|
328
|
+
});
|
|
329
|
+
|
|
296
330
|
it('Test render without params', async () => {
|
|
297
331
|
useReceiveNotifications.mockImplementationOnce(() => ({
|
|
298
332
|
dataNotification: {},
|
package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
3
|
import { AccessibilityLabel } from '../../../../../configs/Constants';
|
|
4
4
|
import { API } from '../../../../../configs';
|
|
@@ -7,30 +7,9 @@ import { SCProvider } from '../../../../../context';
|
|
|
7
7
|
import { mockSCStore } from '../../../../../context/mockStore';
|
|
8
8
|
import MockAdapter from 'axios-mock-adapter';
|
|
9
9
|
import api from '../../../../../utils/Apis/axios';
|
|
10
|
+
import PMSensorIndicator from '../../../../../commons/Device/PMSensor/PMSensorIndicator';
|
|
10
11
|
|
|
11
12
|
const mock = new MockAdapter(api.axiosInstance);
|
|
12
|
-
const mockSetState = jest.fn();
|
|
13
|
-
|
|
14
|
-
jest.mock('react', () => {
|
|
15
|
-
return {
|
|
16
|
-
...jest.requireActual('react'),
|
|
17
|
-
useState: jest.fn(),
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const mockedNavigate = jest.fn();
|
|
22
|
-
|
|
23
|
-
jest.mock('@react-navigation/native', () => {
|
|
24
|
-
return {
|
|
25
|
-
...jest.requireActual('@react-navigation/native'),
|
|
26
|
-
useNavigation: () => ({
|
|
27
|
-
navigate: mockedNavigate,
|
|
28
|
-
}),
|
|
29
|
-
useFocusEffect: (func) => func(),
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
useState.mockImplementation((init) => [init, mockSetState]);
|
|
34
13
|
|
|
35
14
|
const wrapComponent = (summaryDetail) => (
|
|
36
15
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -59,7 +38,6 @@ describe('Test 3PPowerConsumption', () => {
|
|
|
59
38
|
power_factor_1: 8,
|
|
60
39
|
power_factor_2: 9,
|
|
61
40
|
power_factor_3: 10,
|
|
62
|
-
total_power: 11,
|
|
63
41
|
},
|
|
64
42
|
};
|
|
65
43
|
await act(async () => {
|
|
@@ -85,6 +63,9 @@ describe('Test 3PPowerConsumption', () => {
|
|
|
85
63
|
{ id: 10, color: '#52C41A', title: 'Power Factor 3', measure: '' },
|
|
86
64
|
];
|
|
87
65
|
expect(listIndicator.props.data).toEqual(resultList);
|
|
66
|
+
|
|
67
|
+
const indicator = instance.findByType(PMSensorIndicator);
|
|
68
|
+
expect(indicator.props.data).toHaveLength(0);
|
|
88
69
|
});
|
|
89
70
|
|
|
90
71
|
it('render 3PPowerConsumption with total_power', async () => {
|
|
@@ -100,6 +81,8 @@ describe('Test 3PPowerConsumption', () => {
|
|
|
100
81
|
await act(async () => {
|
|
101
82
|
tree = await renderer.create(wrapComponent(summaryDetail));
|
|
102
83
|
});
|
|
103
|
-
|
|
84
|
+
const instance = tree.root;
|
|
85
|
+
const indicator = instance.findByType(PMSensorIndicator);
|
|
86
|
+
expect(indicator.props.data).toHaveLength(1);
|
|
104
87
|
});
|
|
105
88
|
});
|
|
@@ -12,13 +12,7 @@ import { Section, Text } from '../../../../../commons';
|
|
|
12
12
|
import AccessibilityLabel from '../../../../../configs/AccessibilityLabel';
|
|
13
13
|
|
|
14
14
|
new MockAdapter(api.axiosInstance);
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
...jest.requireActual('@react-navigation/native'),
|
|
18
|
-
useRoute: jest.fn(),
|
|
19
|
-
useFocusEffect: (func) => func(),
|
|
20
|
-
};
|
|
21
|
-
});
|
|
15
|
+
|
|
22
16
|
const wrapComponent = (data) => (
|
|
23
17
|
<SCProvider initState={mockSCStore({})}>
|
|
24
18
|
<AirQuality {...data} />
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
4
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
4
5
|
|
|
5
6
|
import styles from './styles';
|
|
6
7
|
|
|
@@ -79,7 +80,7 @@ const AirQuality = memo(({ summaryDetail }) => {
|
|
|
79
80
|
<View
|
|
80
81
|
style={[styles.boxEmotion, { backgroundColor: outdoorColor }]}
|
|
81
82
|
>
|
|
82
|
-
<
|
|
83
|
+
<AntDesign name={outdoorIcon} size={35} />
|
|
83
84
|
</View>
|
|
84
85
|
<View
|
|
85
86
|
style={[
|
|
@@ -121,7 +122,11 @@ const AirQuality = memo(({ summaryDetail }) => {
|
|
|
121
122
|
{<SegmentedRoundChart data={outdoor} />}
|
|
122
123
|
{!!advices?.length && (
|
|
123
124
|
<View style={styles.boxHealth}>
|
|
124
|
-
<
|
|
125
|
+
<MaterialCommunityIcons
|
|
126
|
+
name="alert-circle-outline"
|
|
127
|
+
size={20}
|
|
128
|
+
style={styles.iconMargin}
|
|
129
|
+
/>
|
|
125
130
|
<Text semibold color={Colors.Gray9} type="H4">
|
|
126
131
|
{t('Health advices:')}
|
|
127
132
|
</Text>
|
package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js
CHANGED
|
@@ -13,17 +13,6 @@ import { Today } from '../../../../../commons';
|
|
|
13
13
|
|
|
14
14
|
const mock = new MockAdapter(api.axiosInstance);
|
|
15
15
|
|
|
16
|
-
const mockedNavigate = jest.fn();
|
|
17
|
-
|
|
18
|
-
jest.mock('@react-navigation/native', () => {
|
|
19
|
-
return {
|
|
20
|
-
...jest.requireActual('@react-navigation/native'),
|
|
21
|
-
useNavigation: () => ({
|
|
22
|
-
navigate: mockedNavigate,
|
|
23
|
-
}),
|
|
24
|
-
useFocusEffect: (func) => func(),
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
16
|
const wrapComponent = (summaryDetail) => (
|
|
28
17
|
<SCProvider initState={mockSCStore({})}>
|
|
29
18
|
<PowerConsumption summaryDetail={summaryDetail} />
|
|
@@ -12,17 +12,6 @@ const wrapComponent = (unit, summaryDetail) => (
|
|
|
12
12
|
</SCProvider>
|
|
13
13
|
);
|
|
14
14
|
|
|
15
|
-
const mockedNavigate = jest.fn();
|
|
16
|
-
jest.mock('@react-navigation/native', () => {
|
|
17
|
-
return {
|
|
18
|
-
...jest.requireActual('@react-navigation/native'),
|
|
19
|
-
useNavigation: () => ({
|
|
20
|
-
navigate: mockedNavigate,
|
|
21
|
-
}),
|
|
22
|
-
useIsFocused: () => true,
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
|
|
26
15
|
const mockConnectHomeAssistant = jest.fn();
|
|
27
16
|
jest.mock('../../../../../hooks/IoT', () => {
|
|
28
17
|
return {
|
|
@@ -34,10 +23,6 @@ jest.mock('../../../../../hooks/IoT', () => {
|
|
|
34
23
|
});
|
|
35
24
|
|
|
36
25
|
describe('test RunningDevices', () => {
|
|
37
|
-
afterEach(() => {
|
|
38
|
-
mockedNavigate.mockClear();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
26
|
let list_svgMain = [
|
|
42
27
|
'',
|
|
43
28
|
'sensor',
|
|
@@ -128,7 +113,7 @@ describe('test RunningDevices', () => {
|
|
|
128
113
|
await act(async () => {
|
|
129
114
|
button[0].props.onPress();
|
|
130
115
|
});
|
|
131
|
-
expect(mockedNavigate).toBeCalledWith('DeviceDetail', {
|
|
116
|
+
expect(global.mockedNavigate).toBeCalledWith('DeviceDetail', {
|
|
132
117
|
sensorData: summaryDetail.devices[0],
|
|
133
118
|
station: 'station',
|
|
134
119
|
title: undefined,
|
|
@@ -25,18 +25,21 @@ const Temperature = ({ summaryDetail }) => {
|
|
|
25
25
|
() => [
|
|
26
26
|
{
|
|
27
27
|
id: temp,
|
|
28
|
+
key: 'temp',
|
|
28
29
|
svgMain: <SvgTemperature />,
|
|
29
30
|
title: `${t('text_temperature')}`,
|
|
30
31
|
measure: '°C',
|
|
31
32
|
},
|
|
32
33
|
{
|
|
33
34
|
id: humi,
|
|
35
|
+
key: 'humi',
|
|
34
36
|
svgMain: <SvgHumidity />,
|
|
35
37
|
title: `${t('text_humidity')}`,
|
|
36
38
|
measure: '%',
|
|
37
39
|
},
|
|
38
40
|
{
|
|
39
41
|
id: wind,
|
|
42
|
+
key: 'wind',
|
|
40
43
|
svgMain: <SvgWind />,
|
|
41
44
|
title: `${t('text_wind')}`,
|
|
42
45
|
des: `${t('text_win_direction')}: ${windDirection || t('loading')}`,
|
|
@@ -44,6 +47,7 @@ const Temperature = ({ summaryDetail }) => {
|
|
|
44
47
|
},
|
|
45
48
|
{
|
|
46
49
|
id: rain,
|
|
50
|
+
key: 'rain',
|
|
47
51
|
svgMain: <SvgRain />,
|
|
48
52
|
title: `${t('text_rain')}`,
|
|
49
53
|
measure: '',
|
|
@@ -78,7 +82,7 @@ const Temperature = ({ summaryDetail }) => {
|
|
|
78
82
|
<Today style={styles.textIndoor} />
|
|
79
83
|
<View style={styles.boxTemperature}>
|
|
80
84
|
{dataTemperature.map((item) => (
|
|
81
|
-
<ItemTemperature {...item} key={item.
|
|
85
|
+
<ItemTemperature {...item} key={item.key} />
|
|
82
86
|
))}
|
|
83
87
|
</View>
|
|
84
88
|
</Section>
|
|
@@ -9,14 +9,6 @@ import api from '../../../../../utils/Apis/axios';
|
|
|
9
9
|
|
|
10
10
|
new MockAdapter(api.axiosInstance);
|
|
11
11
|
|
|
12
|
-
jest.mock('@react-navigation/native', () => {
|
|
13
|
-
return {
|
|
14
|
-
...jest.requireActual('@react-navigation/native'),
|
|
15
|
-
useRoute: jest.fn(),
|
|
16
|
-
useFocusEffect: (func) => func(),
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
|
|
20
12
|
const wrapComponent = (data) => (
|
|
21
13
|
<SCProvider initState={mockSCStore({})}>
|
|
22
14
|
<UvIndex {...data} />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { memo, useMemo } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
4
4
|
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
5
5
|
|
|
6
6
|
import { Colors } from '../../../../configs';
|
|
@@ -37,7 +37,11 @@ const UvIndex = memo(({ summaryDetail }) => {
|
|
|
37
37
|
<Today />
|
|
38
38
|
<SegmentedRoundChart data={data} />
|
|
39
39
|
<View style={styles.boxHealth}>
|
|
40
|
-
<
|
|
40
|
+
<MaterialCommunityIcons
|
|
41
|
+
name="alert-circle-outline"
|
|
42
|
+
size={20}
|
|
43
|
+
style={styles.iconMargin}
|
|
44
|
+
/>
|
|
41
45
|
<Text
|
|
42
46
|
semibold
|
|
43
47
|
color={Colors.Gray9}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import { View, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
4
4
|
import { useNavigation } from '@react-navigation/native';
|
|
5
5
|
|
|
6
6
|
import Text from '../../../../../commons/Text';
|
|
@@ -23,7 +23,7 @@ const Item = memo(({ id, svgMain, title, measure, des, color, waterType }) => {
|
|
|
23
23
|
<Text>{title}</Text>
|
|
24
24
|
{waterType && (
|
|
25
25
|
<TouchableOpacity onPress={goToDetail} style={styles.buttonInfo}>
|
|
26
|
-
<
|
|
26
|
+
<AntDesign
|
|
27
27
|
style={styles.row}
|
|
28
28
|
name="info-circle"
|
|
29
29
|
size={20}
|
|
@@ -8,19 +8,9 @@ import { SCProvider } from '../../../../../context';
|
|
|
8
8
|
import { mockSCStore } from '../../../../../context/mockStore';
|
|
9
9
|
import MockAdapter from 'axios-mock-adapter';
|
|
10
10
|
import api from '../../../../../utils/Apis/axios';
|
|
11
|
+
import { useNavigation } from '@react-navigation/native';
|
|
11
12
|
|
|
12
13
|
new MockAdapter(api.axiosInstance);
|
|
13
|
-
const mockNavigate = jest.fn();
|
|
14
|
-
jest.mock('@react-navigation/native', () => {
|
|
15
|
-
return {
|
|
16
|
-
...jest.requireActual('@react-navigation/native'),
|
|
17
|
-
useRoute: jest.fn(),
|
|
18
|
-
useNavigation: () => ({
|
|
19
|
-
navigate: mockNavigate,
|
|
20
|
-
}),
|
|
21
|
-
useFocusEffect: (func) => func(),
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
14
|
|
|
25
15
|
const wrapComponent = (data) => (
|
|
26
16
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -29,10 +19,10 @@ const wrapComponent = (data) => (
|
|
|
29
19
|
);
|
|
30
20
|
|
|
31
21
|
describe('Test WaterQualityGuide', () => {
|
|
22
|
+
const { navigate } = useNavigation();
|
|
32
23
|
let data;
|
|
33
24
|
beforeEach(() => {
|
|
34
25
|
Date.now = jest.fn(() => new Date('2021-01-24T12:00:00.000Z'));
|
|
35
|
-
mockNavigate.mockClear();
|
|
36
26
|
data = {
|
|
37
27
|
summaryDetail: {
|
|
38
28
|
ph_id: 1,
|
|
@@ -45,6 +35,7 @@ describe('Test WaterQualityGuide', () => {
|
|
|
45
35
|
ph: 1,
|
|
46
36
|
tur: 2,
|
|
47
37
|
clo: 3,
|
|
38
|
+
temp: 4,
|
|
48
39
|
},
|
|
49
40
|
},
|
|
50
41
|
};
|
|
@@ -83,25 +74,30 @@ describe('Test WaterQualityGuide', () => {
|
|
|
83
74
|
await act(async () => {
|
|
84
75
|
buttons[0].props.onPress();
|
|
85
76
|
});
|
|
86
|
-
expect(
|
|
87
|
-
expect(
|
|
77
|
+
expect(navigate).toHaveBeenCalledTimes(1);
|
|
78
|
+
expect(navigate).toHaveBeenCalledWith(Routes.WaterQualityGuide, {
|
|
88
79
|
waterType: 'turbidity',
|
|
89
80
|
});
|
|
90
81
|
|
|
91
82
|
await act(async () => {
|
|
92
83
|
buttons[1].props.onPress();
|
|
93
84
|
});
|
|
94
|
-
expect(
|
|
95
|
-
expect(
|
|
85
|
+
expect(navigate).toHaveBeenCalledTimes(2);
|
|
86
|
+
expect(navigate).toHaveBeenCalledWith(Routes.WaterQualityGuide, {
|
|
96
87
|
waterType: 'ph',
|
|
97
88
|
});
|
|
98
89
|
|
|
99
90
|
await act(async () => {
|
|
100
91
|
buttons[2].props.onPress();
|
|
101
92
|
});
|
|
102
|
-
expect(
|
|
103
|
-
expect(
|
|
93
|
+
expect(navigate).toHaveBeenCalledTimes(3);
|
|
94
|
+
expect(navigate).toHaveBeenCalledWith(Routes.WaterQualityGuide, {
|
|
104
95
|
waterType: 'clo',
|
|
105
96
|
});
|
|
97
|
+
|
|
98
|
+
await act(async () => {
|
|
99
|
+
buttons[3].props.onPress();
|
|
100
|
+
});
|
|
101
|
+
expect(navigate).toHaveBeenCalledTimes(3); // not call navigate
|
|
106
102
|
});
|
|
107
103
|
});
|
|
@@ -22,8 +22,8 @@ describe('Test UnitSummary', () => {
|
|
|
22
22
|
tree = await create(<UnitSummary {...defaultProps} index={0} />);
|
|
23
23
|
});
|
|
24
24
|
const instance = tree.root;
|
|
25
|
-
const
|
|
26
|
-
expect(
|
|
25
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
26
|
+
expect(touchableOpacities[0].props.style).toEqual([
|
|
27
27
|
styles.summaryContainer,
|
|
28
28
|
{ borderTopLeftRadius: 10 },
|
|
29
29
|
]);
|
|
@@ -34,8 +34,8 @@ describe('Test UnitSummary', () => {
|
|
|
34
34
|
tree = await create(<UnitSummary {...defaultProps} index={1} />);
|
|
35
35
|
});
|
|
36
36
|
const instance = tree.root;
|
|
37
|
-
const
|
|
38
|
-
expect(
|
|
37
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
38
|
+
expect(touchableOpacities[0].props.style).toEqual([
|
|
39
39
|
styles.summaryContainer,
|
|
40
40
|
{ borderTopRightRadius: 10 },
|
|
41
41
|
]);
|
|
@@ -46,8 +46,8 @@ describe('Test UnitSummary', () => {
|
|
|
46
46
|
tree = await create(<UnitSummary {...defaultProps} index={1} len={2} />);
|
|
47
47
|
});
|
|
48
48
|
const instance = tree.root;
|
|
49
|
-
const
|
|
50
|
-
expect(
|
|
49
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
50
|
+
expect(touchableOpacities[0].props.style).toEqual([
|
|
51
51
|
styles.summaryContainer,
|
|
52
52
|
{ borderBottomRightRadius: 10 },
|
|
53
53
|
]);
|
|
@@ -58,8 +58,8 @@ describe('Test UnitSummary', () => {
|
|
|
58
58
|
tree = await create(<UnitSummary {...defaultProps} index={2} len={3} />);
|
|
59
59
|
});
|
|
60
60
|
const instance = tree.root;
|
|
61
|
-
const
|
|
62
|
-
expect(
|
|
61
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
62
|
+
expect(touchableOpacities[0].props.style).toEqual([
|
|
63
63
|
styles.summaryContainer,
|
|
64
64
|
{ borderBottomLeftRadius: 10 },
|
|
65
65
|
]);
|
|
@@ -2,7 +2,7 @@ import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
|
2
2
|
import { View, StyleSheet } from 'react-native';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
4
|
import { TouchableOpacity } from 'react-native';
|
|
5
|
-
import
|
|
5
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
6
6
|
import moment from 'moment';
|
|
7
7
|
|
|
8
8
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
@@ -129,9 +129,9 @@ const UnitSummary = memo(({ route }) => {
|
|
|
129
129
|
fetchSummaryDetail();
|
|
130
130
|
}, [fetchSummaryDetail, summary?.screen]);
|
|
131
131
|
|
|
132
|
-
const onRefresh = useCallback(() => {
|
|
132
|
+
const onRefresh = useCallback(async () => {
|
|
133
133
|
setLoading(true);
|
|
134
|
-
fetchSummaryDetail();
|
|
134
|
+
await fetchSummaryDetail();
|
|
135
135
|
}, [fetchSummaryDetail]);
|
|
136
136
|
|
|
137
137
|
const { dataNotification } = useReceiveNotifications();
|
|
@@ -168,11 +168,7 @@ const UnitSummary = memo(({ route }) => {
|
|
|
168
168
|
accessibilityLabel={AccessibilityLabel.UNIT_SUMMARY_GUIDE_TOUCH}
|
|
169
169
|
onPress={() => navigation.navigate(GuideName)}
|
|
170
170
|
>
|
|
171
|
-
<
|
|
172
|
-
name="info-circle"
|
|
173
|
-
size={27}
|
|
174
|
-
color={Colors.Black}
|
|
175
|
-
/>
|
|
171
|
+
<AntDesign name="info-circle" size={27} color={Colors.Black} />
|
|
176
172
|
</TouchableOpacity>
|
|
177
173
|
</View>
|
|
178
174
|
) : null
|
|
@@ -17,6 +17,14 @@ describe('Test timer', () => {
|
|
|
17
17
|
expect(result).toBe('1 seconds ago');
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
+
it('Test timeDifference when previous is string', async () => {
|
|
21
|
+
result = await timeDifference(
|
|
22
|
+
new Date('2022-08-01T03:24:01'),
|
|
23
|
+
'2022-08-01T03:24:00'
|
|
24
|
+
);
|
|
25
|
+
expect(result).toBe('1 seconds ago');
|
|
26
|
+
});
|
|
27
|
+
|
|
20
28
|
it('Test timeDifference when elapsed < msPerMinute and symbol=true', async () => {
|
|
21
29
|
result = await timeDifference(
|
|
22
30
|
new Date('2022-08-01T03:24:01'),
|
|
@@ -7,7 +7,7 @@ export const preloadImagesFromUnits = async (units, storeKey) => {
|
|
|
7
7
|
const isFirstTime = await getData(storeKey);
|
|
8
8
|
if (units?.length && !isFirstTime) {
|
|
9
9
|
await storeData(storeKey, 'true');
|
|
10
|
-
Promise.all(
|
|
10
|
+
const results = await Promise.all(
|
|
11
11
|
units.map(async (item) => {
|
|
12
12
|
const unitId =
|
|
13
13
|
storeKey === STORAGE_KEY.IS_FIRST_TIME_LOAD_MY_UNITS
|
|
@@ -22,18 +22,17 @@ export const preloadImagesFromUnits = async (units, storeKey) => {
|
|
|
22
22
|
return success && data;
|
|
23
23
|
}
|
|
24
24
|
})
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const icons = results
|
|
28
|
+
.map((item) => item?.stations?.map((i) => i?.background) || [])
|
|
29
|
+
.flat()
|
|
30
|
+
.filter(Boolean);
|
|
31
|
+
FastImage.preload(
|
|
32
|
+
icons.map((uri) => ({
|
|
33
|
+
uri,
|
|
34
|
+
priority: FastImage.priority.high,
|
|
35
|
+
}))
|
|
36
|
+
);
|
|
38
37
|
}
|
|
39
38
|
};
|
package/src/utils/Monitor.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { getPusher, destroyPusher } from './Pusher';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
export const watchNotificationData = (user, callback) => {
|
|
3
|
+
export const watchNotificationData = (user, handler) => {
|
|
5
4
|
const channel = getPusher().subscribe(`private-user-${user.id}`);
|
|
6
|
-
channel.bind('new-notification',
|
|
5
|
+
channel.bind('new-notification', handler);
|
|
7
6
|
};
|
|
8
7
|
|
|
9
8
|
export const unwatchNotificationData = (user) => {
|