@eohjsc/react-native-smart-city 0.5.9 → 0.6.0-rc2
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 +8 -10
- package/package.json +52 -69
- 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__/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 +3 -3
- 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 +3 -4
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
- 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 +1 -8
- package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +1 -8
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +2 -9
- package/src/commons/ActionGroup/__test__/index.test.js +14 -21
- 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/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +1 -12
- 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/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/HorizontalBarChart.js +1 -1
- package/src/commons/Device/ItemAddNew/index.js +2 -2
- package/src/commons/Device/ItemDevice.js +2 -2
- package/src/commons/Device/PowerConsumptionChart.js +154 -0
- 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 +2 -2
- package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
- package/src/commons/Form/CurrencyInput.js +1 -15
- package/src/commons/Header/HeaderCustom.js +3 -3
- package/src/commons/HeaderAni/index.js +2 -2
- package/src/commons/IconComponent/index.js +3 -3
- 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 +2 -2
- 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__/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 +2 -2
- 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/Tabbar/__test__/index.test.js +0 -11
- package/src/commons/Unit/HeaderUnit/index.js +4 -4
- package/src/commons/Unit/SharedUnit.js +5 -5
- package/src/commons/Unit/__test__/HeaderUnit.test.js +3 -15
- package/src/commons/Unit/__test__/SharedUnit.test.js +94 -105
- package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +11 -30
- package/src/commons/UnitSummary/ConfigHistoryChart/index.js +6 -61
- package/src/commons/Widgets/IFrame/IFrame.js +54 -0
- package/src/commons/Widgets/IFrame/IFrameStyles.js +35 -0
- package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +74 -0
- package/src/commons/Widgets/IFrame/index.js +0 -0
- package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +163 -0
- package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfigStyles.js +9 -0
- package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +284 -0
- package/src/commons/Widgets/IFrameWithConfig/index.js +0 -0
- package/src/commons/Widgets/Widget.js +0 -0
- package/src/commons/Widgets/index.js +0 -0
- package/src/configs/Constants.js +5 -0
- package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +4 -15
- package/src/hooks/Common/useDevicesStatus.js +23 -23
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +1 -1
- package/src/hooks/IoT/__test__/useWatchConfigs.test.js +0 -7
- 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 +2 -2
- package/src/navigations/UnitStack.js +2 -2
- 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 +4 -4
- 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/AddNewGateway/hooks/__Tests__/index.test.js +1 -10
- 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 +5 -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 +5 -5
- 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 +0 -12
- 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 +3 -15
- package/src/screens/Device/components/SensorDisplayItem.js +23 -5
- package/src/screens/Device/components/__test__/VisualChart.test.js +2 -9
- package/src/screens/Device/detail.js +11 -10
- 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 +2 -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 +5 -5
- package/src/screens/Notification/__test__/NotificationItem.test.js +9 -19
- package/src/screens/Notification/index.js +3 -3
- package/src/screens/PlayBackCamera/Styles/index.js +2 -4
- package/src/screens/PlayBackCamera/Timer.js +65 -47
- package/src/screens/PlayBackCamera/__test__/index.test.js +32 -33
- package/src/screens/PlayBackCamera/index.js +115 -112
- 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 +1 -21
- 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/UnitMemberList.js +2 -2
- 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 +7 -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 +3 -3
- 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 +4 -5
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -31
- package/src/screens/SubUnit/__test__/Detail.test.js +4 -28
- 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 +2 -13
- package/src/screens/Template/__test__/GatewayList.test.js +0 -9
- package/src/screens/Template/__test__/detail.test.js +4 -4
- package/src/screens/Template/__test__/index.test.js +1 -12
- package/src/screens/Template/detail.js +2 -2
- package/src/screens/Unit/SelectAddToFavorites.js +2 -2
- package/src/screens/Unit/SelectAddress.js +4 -4
- package/src/screens/Unit/SmartAccountItem.js +2 -2
- package/src/screens/Unit/Summaries.js +3 -2
- 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 +5 -5
- 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 +3 -3
- 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 +0 -12
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +10 -23
- package/src/screens/UnitSummary/components/AirQuality/__test__/index.test.js +1 -7
- package/src/screens/UnitSummary/components/AirQuality/index.js +3 -3
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +38 -14
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +21 -30
- 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 +2 -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/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 +4 -4
- package/src/utils/Storage.js +1 -1
- package/src/commons/Device/HistoryChart.js +0 -225
- package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +0 -48
- package/src/commons/Device/WindSpeed/LinearChart/index.js +0 -155
- package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +0 -289
- package/src/screens/Device/__test__/DetailHistoryChart.test.js +0 -69
- package/src/screens/Device/components/DetailHistoryChart.js +0 -118
- 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
|
@@ -15,22 +15,10 @@ const wrapComponent = (route) => (
|
|
|
15
15
|
<SmartAccount route={route} />
|
|
16
16
|
</SCProvider>
|
|
17
17
|
);
|
|
18
|
-
const mockedNavigate = jest.fn();
|
|
19
|
-
|
|
20
|
-
jest.mock('@react-navigation/native', () => {
|
|
21
|
-
return {
|
|
22
|
-
...jest.requireActual('@react-navigation/native'),
|
|
23
|
-
useNavigation: () => ({
|
|
24
|
-
navigate: mockedNavigate,
|
|
25
|
-
}),
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
18
|
|
|
29
19
|
describe('Test SmartAccount', () => {
|
|
30
20
|
let tree;
|
|
31
|
-
|
|
32
|
-
mockedNavigate.mockClear();
|
|
33
|
-
});
|
|
21
|
+
|
|
34
22
|
it('render SmartAccount', async () => {
|
|
35
23
|
const route = {
|
|
36
24
|
params: {
|
|
@@ -164,12 +152,15 @@ describe('Test SmartAccount', () => {
|
|
|
164
152
|
await act(async () => {
|
|
165
153
|
await touchableOpacity.props.onPress();
|
|
166
154
|
});
|
|
167
|
-
expect(mockedNavigate).toBeCalledWith(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
155
|
+
expect(global.mockedNavigate).toBeCalledWith(
|
|
156
|
+
Routes.SmartAccountConnecting,
|
|
157
|
+
{
|
|
158
|
+
brand: 'google_home',
|
|
159
|
+
password: '1234567',
|
|
160
|
+
unit_id: 1,
|
|
161
|
+
username: 'eoh.dienquang@gmail.com',
|
|
162
|
+
}
|
|
163
|
+
);
|
|
173
164
|
});
|
|
174
165
|
|
|
175
166
|
it('render handle sync item DienQuang from screen dashboard', async () => {
|
|
@@ -215,7 +206,7 @@ describe('Test SmartAccount', () => {
|
|
|
215
206
|
await act(async () => {
|
|
216
207
|
await touchableOpacity.props.onPress();
|
|
217
208
|
});
|
|
218
|
-
expect(mockedNavigate).toBeCalledWith(Routes.AddDeviceStack, {
|
|
209
|
+
expect(global.mockedNavigate).toBeCalledWith(Routes.AddDeviceStack, {
|
|
219
210
|
screen: 'AddCommonSelectUnit',
|
|
220
211
|
params: {
|
|
221
212
|
addType: 'AddHassioDevice',
|
|
@@ -245,7 +236,7 @@ describe('Test SmartAccount', () => {
|
|
|
245
236
|
await touchSupplierItem[1].props.onPress();
|
|
246
237
|
});
|
|
247
238
|
expect(touchSupplierItem).toBeDefined();
|
|
248
|
-
expect(mockedNavigate).toBeCalledWith(Routes.Browser, {
|
|
239
|
+
expect(global.mockedNavigate).toBeCalledWith(Routes.Browser, {
|
|
249
240
|
// eslint-disable-next-line max-len
|
|
250
241
|
link: 'https://qt-vn.m.lgaccount.com/emp/v2/authorize?client_id=2b85aee334f046848341547894bb7c4e&redirect_uri=app://eoh/sync-lg-device&response_type=code&state=1',
|
|
251
242
|
});
|
|
@@ -9,7 +9,7 @@ import { AccessibilityLabel } from '../../../configs/Constants';
|
|
|
9
9
|
import TextInput from '../../../commons/Form/TextInput';
|
|
10
10
|
import { ModalCustom } from '../../../commons/Modal';
|
|
11
11
|
import { TouchableOpacity } from 'react-native';
|
|
12
|
-
import
|
|
12
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
13
13
|
|
|
14
14
|
const wrapComponent = (route) => (
|
|
15
15
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -17,16 +17,6 @@ const wrapComponent = (route) => (
|
|
|
17
17
|
</SCProvider>
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
const mockNavigate = jest.fn();
|
|
21
|
-
jest.mock('@react-navigation/native', () => {
|
|
22
|
-
return {
|
|
23
|
-
...jest.requireActual('@react-navigation/native'),
|
|
24
|
-
useNavigation: () => ({
|
|
25
|
-
navigate: mockNavigate,
|
|
26
|
-
}),
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
|
|
30
20
|
describe('Test GroupButtonByType', () => {
|
|
31
21
|
let tree;
|
|
32
22
|
it('render GroupButtonByType', async () => {
|
|
@@ -139,15 +129,15 @@ describe('Test GroupButtonByType', () => {
|
|
|
139
129
|
AccessibilityLabel.HEADER_BUTTON_TYPE_RELOAD &&
|
|
140
130
|
el.type === TouchableOpacity
|
|
141
131
|
);
|
|
142
|
-
const
|
|
132
|
+
const icon = instance.find(
|
|
143
133
|
(el) =>
|
|
144
134
|
el.props.accessibilityLabel ===
|
|
145
|
-
AccessibilityLabel.ICON_OUTLINE_TYPE_RELOAD && el.type ===
|
|
135
|
+
AccessibilityLabel.ICON_OUTLINE_TYPE_RELOAD && el.type === AntDesign
|
|
146
136
|
);
|
|
147
137
|
await act(async () => {
|
|
148
138
|
await touch.props.onPress();
|
|
149
139
|
});
|
|
150
|
-
expect(
|
|
140
|
+
expect(icon.props.name).toEqual('reload');
|
|
151
141
|
|
|
152
142
|
const touch2 = instance.find(
|
|
153
143
|
(el) =>
|
|
@@ -155,14 +145,14 @@ describe('Test GroupButtonByType', () => {
|
|
|
155
145
|
AccessibilityLabel.HEADER_BUTTON_TYPE_MORE &&
|
|
156
146
|
el.type === TouchableOpacity
|
|
157
147
|
);
|
|
158
|
-
const
|
|
148
|
+
const AntDesign2 = instance.find(
|
|
159
149
|
(el) =>
|
|
160
150
|
el.props.accessibilityLabel ===
|
|
161
|
-
AccessibilityLabel.ICON_OUTLINE_TYPE_MORE && el.type ===
|
|
151
|
+
AccessibilityLabel.ICON_OUTLINE_TYPE_MORE && el.type === AntDesign
|
|
162
152
|
);
|
|
163
153
|
await act(async () => {
|
|
164
154
|
await touch2.props.onPress();
|
|
165
155
|
});
|
|
166
|
-
expect(
|
|
156
|
+
expect(AntDesign2.props.name).toEqual('more');
|
|
167
157
|
});
|
|
168
158
|
});
|
|
@@ -12,16 +12,6 @@ const wrapComponent = (route) => (
|
|
|
12
12
|
</SCProvider>
|
|
13
13
|
);
|
|
14
14
|
|
|
15
|
-
const mockNavigate = jest.fn();
|
|
16
|
-
jest.mock('@react-navigation/native', () => {
|
|
17
|
-
return {
|
|
18
|
-
...jest.requireActual('@react-navigation/native'),
|
|
19
|
-
useNavigation: () => ({
|
|
20
|
-
navigate: mockNavigate,
|
|
21
|
-
}),
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
|
|
25
15
|
describe('Test SelectBrand', () => {
|
|
26
16
|
let tree;
|
|
27
17
|
it('render SelectBrand', async () => {
|
|
@@ -55,6 +45,6 @@ describe('Test SelectBrand', () => {
|
|
|
55
45
|
await act(async () => {
|
|
56
46
|
rowItem[0].props.onPress();
|
|
57
47
|
});
|
|
58
|
-
expect(
|
|
48
|
+
expect(global.mockedNavigate).toHaveBeenCalled();
|
|
59
49
|
});
|
|
60
50
|
});
|
|
@@ -11,17 +11,6 @@ const wrapComponent = () => (
|
|
|
11
11
|
</SCProvider>
|
|
12
12
|
);
|
|
13
13
|
|
|
14
|
-
const mockNavigate = jest.fn();
|
|
15
|
-
|
|
16
|
-
jest.mock('@react-navigation/native', () => {
|
|
17
|
-
return {
|
|
18
|
-
...jest.requireActual('@react-navigation/native'),
|
|
19
|
-
useNavigation: () => ({
|
|
20
|
-
navigate: mockNavigate,
|
|
21
|
-
}),
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
|
|
25
14
|
describe('Test SelectIrDeviceType', () => {
|
|
26
15
|
let tree;
|
|
27
16
|
|
|
@@ -47,6 +36,6 @@ describe('Test SelectIrDeviceType', () => {
|
|
|
47
36
|
await act(async () => {
|
|
48
37
|
itemDevice.props.onPress();
|
|
49
38
|
});
|
|
50
|
-
expect(
|
|
39
|
+
expect(global.mockedNavigate).toHaveBeenCalled();
|
|
51
40
|
});
|
|
52
41
|
});
|
|
@@ -11,19 +11,11 @@ const wrapComponent = (item) => (
|
|
|
11
11
|
<SmartIr item={item} />
|
|
12
12
|
</SCProvider>
|
|
13
13
|
);
|
|
14
|
-
|
|
15
|
-
jest.mock('@react-navigation/native', () => {
|
|
16
|
-
return {
|
|
17
|
-
...jest.requireActual('@react-navigation/native'),
|
|
18
|
-
useNavigation: () => ({
|
|
19
|
-
navigate: mockNavigate,
|
|
20
|
-
}),
|
|
21
|
-
};
|
|
22
|
-
});
|
|
14
|
+
|
|
23
15
|
describe('Test SmartIr', () => {
|
|
24
16
|
let tree;
|
|
25
17
|
beforeEach(() => {
|
|
26
|
-
|
|
18
|
+
global.mockedNavigate.mockClear();
|
|
27
19
|
});
|
|
28
20
|
it('render SmartIr', async () => {
|
|
29
21
|
const item = {
|
|
@@ -65,6 +57,6 @@ describe('Test SmartIr', () => {
|
|
|
65
57
|
await act(async () => {
|
|
66
58
|
itemAddNew.props.onPress();
|
|
67
59
|
});
|
|
68
|
-
expect(
|
|
60
|
+
expect(global.mockedNavigate).toHaveBeenCalled();
|
|
69
61
|
});
|
|
70
62
|
});
|
|
@@ -5,7 +5,7 @@ import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
|
5
5
|
import SmartTiviActionTemplate from '../../../../commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate';
|
|
6
6
|
import Text from '../../../../commons/Text';
|
|
7
7
|
import { ModalCustom } from '../../../../commons/Modal';
|
|
8
|
-
import
|
|
8
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
9
9
|
import { Colors } from '../../../../configs';
|
|
10
10
|
import TextInput from '../../../../commons/Form/TextInput';
|
|
11
11
|
import { ButtonsBottom } from './ButtonsBottom';
|
|
@@ -57,7 +57,7 @@ const GroupButtonByType = memo(({ route }) => {
|
|
|
57
57
|
style={[styles.headerButton]}
|
|
58
58
|
accessibilityLabel={AccessibilityLabel.HEADER_BUTTON_TYPE_RELOAD}
|
|
59
59
|
>
|
|
60
|
-
<
|
|
60
|
+
<AntDesign
|
|
61
61
|
name={'reload'}
|
|
62
62
|
size={27}
|
|
63
63
|
color={Colors.Black}
|
|
@@ -69,7 +69,7 @@ const GroupButtonByType = memo(({ route }) => {
|
|
|
69
69
|
style={[styles.headerButton]}
|
|
70
70
|
accessibilityLabel={AccessibilityLabel.HEADER_BUTTON_TYPE_MORE}
|
|
71
71
|
>
|
|
72
|
-
<
|
|
72
|
+
<AntDesign
|
|
73
73
|
name={'more'}
|
|
74
74
|
size={27}
|
|
75
75
|
color={Colors.Black}
|
|
@@ -5,7 +5,7 @@ import { HeaderCustom } from '../../../commons/Header';
|
|
|
5
5
|
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
6
6
|
import Routes from '../../../utils/Route';
|
|
7
7
|
import { RowItem } from '../../../commons/RowItem';
|
|
8
|
-
import
|
|
8
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
9
9
|
import { Colors } from '../../../configs';
|
|
10
10
|
|
|
11
11
|
import styles from './SelectBrandStyles';
|
|
@@ -47,7 +47,7 @@ const SelectDeviceType = memo(({ route }) => {
|
|
|
47
47
|
key={index.toString()}
|
|
48
48
|
isShowSubText={false}
|
|
49
49
|
rightComponent={
|
|
50
|
-
<
|
|
50
|
+
<AntDesign name="right" size={20} color={Colors.Gray7} />
|
|
51
51
|
}
|
|
52
52
|
/>
|
|
53
53
|
);
|
|
@@ -18,7 +18,7 @@ import AlertAction from '../../commons/AlertAction';
|
|
|
18
18
|
import _TextInput from '../../commons/Form/TextInput';
|
|
19
19
|
import Text from '../../commons/Text';
|
|
20
20
|
import { AccessibilityLabel } from '../../configs/Constants';
|
|
21
|
-
import
|
|
21
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
22
22
|
import { useEmeragencyContacts } from './hooks/useEmergencyContacts';
|
|
23
23
|
import useKeyboardAnimated from '../../hooks/Explore/useKeyboardAnimated';
|
|
24
24
|
import styles from './EditSubUnitStyles';
|
|
@@ -114,6 +114,7 @@ const EditSubUnit = ({ route }) => {
|
|
|
114
114
|
const { success } = await axiosDelete(
|
|
115
115
|
API.SUB_UNIT.REMOVE_SUB_UNIT(unit.id, station.id)
|
|
116
116
|
);
|
|
117
|
+
|
|
117
118
|
if (success) {
|
|
118
119
|
//dispatch(removeSubUnit(station.id));
|
|
119
120
|
ToastBottomHelper.success(t('text_remove_sub_unit_success'));
|
|
@@ -206,7 +207,7 @@ const EditSubUnit = ({ route }) => {
|
|
|
206
207
|
<Text type={'H4'} color={Colors.Gray9}>
|
|
207
208
|
{t('emergency_contacts')}
|
|
208
209
|
</Text>
|
|
209
|
-
<
|
|
210
|
+
<AntDesign name={'right'} size={20} color={Colors.Gray8} />
|
|
210
211
|
</TouchableOpacity>
|
|
211
212
|
<Text
|
|
212
213
|
type={'Body'}
|
|
@@ -14,8 +14,7 @@ import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
|
|
|
14
14
|
import Text from '../../commons/Text';
|
|
15
15
|
|
|
16
16
|
import styles from './ManageSubUnitStyles';
|
|
17
|
-
import
|
|
18
|
-
import { Icon } from '@ant-design/react-native';
|
|
17
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
19
18
|
import Routes from '../../utils/Route';
|
|
20
19
|
import { RowItem } from '../../commons/RowItem';
|
|
21
20
|
import NoSubUnitImage from '../../../assets/images/Illustrations.svg';
|
|
@@ -54,14 +53,14 @@ const ManageSubUnit = ({ route }) => {
|
|
|
54
53
|
onPress={addSubUnit}
|
|
55
54
|
style={styles.headerButton}
|
|
56
55
|
>
|
|
57
|
-
<
|
|
56
|
+
<AntDesign name={'plus'} size={27} color={Colors.Black} />
|
|
58
57
|
</TouchableOpacity>
|
|
59
58
|
<TouchableOpacity
|
|
60
59
|
// onPress={handleShowMenuAction}
|
|
61
60
|
// ref={refMenuAction}
|
|
62
61
|
style={[styles.headerButton, styles.moreButton]}
|
|
63
62
|
>
|
|
64
|
-
<
|
|
63
|
+
<AntDesign name={'more'} size={27} color={Colors.Black} />
|
|
65
64
|
</TouchableOpacity>
|
|
66
65
|
</View>
|
|
67
66
|
),
|
|
@@ -112,7 +111,7 @@ const ManageSubUnit = ({ route }) => {
|
|
|
112
111
|
} devices`}
|
|
113
112
|
onPress={() => goToEditSubUnit(item, unit)}
|
|
114
113
|
rightComponent={
|
|
115
|
-
<
|
|
114
|
+
<AntDesign
|
|
116
115
|
name="right"
|
|
117
116
|
size={20}
|
|
118
117
|
color={Colors.Gray6}
|
|
@@ -22,30 +22,10 @@ const wrapComponent = (route, storeData = {}) => (
|
|
|
22
22
|
</SCProvider>
|
|
23
23
|
);
|
|
24
24
|
|
|
25
|
-
const mockedNavigate = jest.fn();
|
|
26
|
-
const mockedGoBack = jest.fn();
|
|
27
|
-
|
|
28
25
|
const mock = new MockAdapter(api.axiosInstance);
|
|
29
26
|
jest.mock('react-native-toast-message');
|
|
30
27
|
jest.mock('react-native-image-resizer');
|
|
31
28
|
|
|
32
|
-
const mockNavigationDispatch = jest.fn();
|
|
33
|
-
const mockReplace = jest.fn();
|
|
34
|
-
|
|
35
|
-
jest.mock('@react-navigation/native', () => {
|
|
36
|
-
return {
|
|
37
|
-
...jest.requireActual('@react-navigation/native'),
|
|
38
|
-
useNavigation: () => ({
|
|
39
|
-
navigate: mockedNavigate,
|
|
40
|
-
goBack: mockedGoBack,
|
|
41
|
-
dispatch: mockNavigationDispatch,
|
|
42
|
-
}),
|
|
43
|
-
StackActions: {
|
|
44
|
-
replace: () => mockReplace,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
|
|
49
29
|
describe('Test AddSubUnit', () => {
|
|
50
30
|
let route;
|
|
51
31
|
|
|
@@ -61,8 +41,6 @@ describe('Test AddSubUnit', () => {
|
|
|
61
41
|
},
|
|
62
42
|
},
|
|
63
43
|
};
|
|
64
|
-
mockedNavigate.mockClear();
|
|
65
|
-
mockNavigationDispatch.mockClear();
|
|
66
44
|
Toast.show.mockClear();
|
|
67
45
|
mock.reset();
|
|
68
46
|
});
|
|
@@ -139,7 +117,7 @@ describe('Test AddSubUnit', () => {
|
|
|
139
117
|
await viewButtonBottom.props.onLeftClick();
|
|
140
118
|
});
|
|
141
119
|
|
|
142
|
-
expect(mockedGoBack).toHaveBeenCalled();
|
|
120
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
143
121
|
});
|
|
144
122
|
|
|
145
123
|
it('validateData then send api success', async () => {
|
|
@@ -201,7 +179,7 @@ describe('Test AddSubUnit', () => {
|
|
|
201
179
|
await act(async () => {
|
|
202
180
|
await viewButtonBottom.props.onRightClick();
|
|
203
181
|
});
|
|
204
|
-
expect(
|
|
182
|
+
expect(global.mockedDispatch).toBeCalled();
|
|
205
183
|
});
|
|
206
184
|
|
|
207
185
|
it('test choose Location', async () => {
|
|
@@ -223,7 +201,7 @@ describe('Test AddSubUnit', () => {
|
|
|
223
201
|
await act(async () => {
|
|
224
202
|
buttonChooseLocation.props.onPress();
|
|
225
203
|
});
|
|
226
|
-
expect(mockedNavigate).toHaveBeenCalledWith(Routes.AddLocationMaps);
|
|
204
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.AddLocationMaps);
|
|
227
205
|
});
|
|
228
206
|
|
|
229
207
|
it('test create Unit Fail', async () => {
|
|
@@ -265,7 +243,7 @@ describe('Test AddSubUnit', () => {
|
|
|
265
243
|
await act(async () => {
|
|
266
244
|
await viewButtonBottom.props.onRightClick();
|
|
267
245
|
});
|
|
268
|
-
expect(mockedNavigate).toHaveBeenCalledWith('UnitDetail', {
|
|
246
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith('UnitDetail', {
|
|
269
247
|
params: {
|
|
270
248
|
isAddSubUnit: true,
|
|
271
249
|
routeName: 'DashboardStack',
|
|
@@ -308,7 +286,7 @@ describe('Test AddSubUnit', () => {
|
|
|
308
286
|
await act(async () => {
|
|
309
287
|
await viewButtonBottom.props.onRightClick();
|
|
310
288
|
});
|
|
311
|
-
expect(
|
|
289
|
+
expect(global.mockedDispatch).toBeCalled();
|
|
312
290
|
});
|
|
313
291
|
|
|
314
292
|
it('test no permission create fail sub-unit is out side Unit', async () => {
|
|
@@ -347,7 +325,7 @@ describe('Test AddSubUnit', () => {
|
|
|
347
325
|
'',
|
|
348
326
|
7000
|
|
349
327
|
);
|
|
350
|
-
expect(
|
|
328
|
+
expect(global.mockedDispatch).not.toBeCalled();
|
|
351
329
|
});
|
|
352
330
|
|
|
353
331
|
it('test create sub-unit type AddHassiDevice', async () => {
|
|
@@ -355,7 +333,7 @@ describe('Test AddSubUnit', () => {
|
|
|
355
333
|
...route.params,
|
|
356
334
|
addType: 'AddHassiDevice',
|
|
357
335
|
};
|
|
358
|
-
mock.onPost(API.SUB_UNIT.CREATE_SUB_UNIT()).reply(200, {});
|
|
336
|
+
mock.onPost(API.SUB_UNIT.CREATE_SUB_UNIT(1)).reply(200, {});
|
|
359
337
|
await act(async () => {
|
|
360
338
|
tree = await create(wrapComponent(route));
|
|
361
339
|
});
|
|
@@ -364,7 +342,7 @@ describe('Test AddSubUnit', () => {
|
|
|
364
342
|
await act(async () => {
|
|
365
343
|
await viewButtonBottom.props.onRightClick();
|
|
366
344
|
});
|
|
367
|
-
expect(mockedGoBack).toHaveBeenCalled();
|
|
345
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
368
346
|
});
|
|
369
347
|
|
|
370
348
|
it('test create sub-unit type AddNewGateway', async () => {
|
|
@@ -381,7 +359,7 @@ describe('Test AddSubUnit', () => {
|
|
|
381
359
|
await act(async () => {
|
|
382
360
|
await viewButtonBottom.props.onRightClick();
|
|
383
361
|
});
|
|
384
|
-
expect(mockedNavigate).not.toHaveBeenCalledWith(
|
|
362
|
+
expect(global.mockedNavigate).not.toHaveBeenCalledWith(
|
|
385
363
|
Routes.AddCommonSelectSubUnit,
|
|
386
364
|
{
|
|
387
365
|
...route.params,
|
|
@@ -10,27 +10,6 @@ import { mockSCStore } from '../../../context/mockStore';
|
|
|
10
10
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
11
11
|
import { TouchableOpacity } from 'react-native';
|
|
12
12
|
|
|
13
|
-
const mockedNavigate = jest.fn();
|
|
14
|
-
const mockedDispatch = jest.fn();
|
|
15
|
-
const mockedDangerouslyGetState = jest.fn();
|
|
16
|
-
const mockedDangerouslyGetStatePop = jest.fn();
|
|
17
|
-
const mockedPop = jest.fn();
|
|
18
|
-
|
|
19
|
-
jest.mock('@react-navigation/native', () => {
|
|
20
|
-
return {
|
|
21
|
-
...jest.requireActual('@react-navigation/native'),
|
|
22
|
-
useNavigation: () => ({
|
|
23
|
-
navigate: mockedNavigate,
|
|
24
|
-
dangerouslyGetParent: () => ({
|
|
25
|
-
dangerouslyGetState: mockedDangerouslyGetState,
|
|
26
|
-
pop: mockedDangerouslyGetStatePop,
|
|
27
|
-
}),
|
|
28
|
-
pop: mockedPop,
|
|
29
|
-
}),
|
|
30
|
-
useIsFocused: jest.fn(),
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
|
|
34
13
|
const wrapComponent = (route) => (
|
|
35
14
|
<SCProvider initState={mockSCStore({})}>
|
|
36
15
|
<SubUnitDetail route={route} />
|
|
@@ -55,12 +34,9 @@ describe('Test SubUnitDetail', () => {
|
|
|
55
34
|
},
|
|
56
35
|
},
|
|
57
36
|
};
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
afterEach(() => {
|
|
61
|
-
mockedDispatch.mockClear();
|
|
62
37
|
Toast.show.mockClear();
|
|
63
38
|
});
|
|
39
|
+
|
|
64
40
|
let tree;
|
|
65
41
|
|
|
66
42
|
it('ItemDevice', async () => {
|
|
@@ -73,7 +49,7 @@ describe('Test SubUnitDetail', () => {
|
|
|
73
49
|
});
|
|
74
50
|
|
|
75
51
|
it('onBack', async () => {
|
|
76
|
-
mockedDangerouslyGetState.mockImplementation(() => ({
|
|
52
|
+
global.mockedDangerouslyGetState.mockImplementation(() => ({
|
|
77
53
|
routes: [
|
|
78
54
|
{ name: 'route 1' },
|
|
79
55
|
{ name: 'route 2' },
|
|
@@ -89,11 +65,11 @@ describe('Test SubUnitDetail', () => {
|
|
|
89
65
|
await act(async () => {
|
|
90
66
|
await wrapScrollView.props.onBack();
|
|
91
67
|
});
|
|
92
|
-
expect(
|
|
68
|
+
expect(global.mockedPop).toHaveBeenCalledWith(2);
|
|
93
69
|
});
|
|
94
70
|
|
|
95
71
|
it('click Menu ActionMore', async () => {
|
|
96
|
-
mockedDangerouslyGetState.mockImplementation(() => ({
|
|
72
|
+
global.mockedDangerouslyGetState.mockImplementation(() => ({
|
|
97
73
|
routes: [
|
|
98
74
|
{ name: 'route 1' },
|
|
99
75
|
{ name: 'route 2' },
|
|
@@ -17,28 +17,9 @@ import { getTranslate } from '../../../utils/I18n';
|
|
|
17
17
|
import api from '../../../utils/Apis/axios';
|
|
18
18
|
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
19
19
|
|
|
20
|
-
const mockedNavigate = jest.fn();
|
|
21
|
-
const mockedDispatch = jest.fn();
|
|
22
|
-
const mockedDangerouslyGetState = jest.fn();
|
|
23
|
-
const mockedPop = jest.fn();
|
|
24
|
-
|
|
25
20
|
const mock = new MockAdapter(api.axiosInstance);
|
|
26
21
|
jest.mock('react-native-toast-message');
|
|
27
22
|
|
|
28
|
-
const mockUseIsFocused = jest.fn();
|
|
29
|
-
|
|
30
|
-
jest.mock('@react-navigation/native', () => {
|
|
31
|
-
return {
|
|
32
|
-
...jest.requireActual('@react-navigation/native'),
|
|
33
|
-
useNavigation: () => ({
|
|
34
|
-
navigate: mockedNavigate,
|
|
35
|
-
dangerouslyGetState: mockedDangerouslyGetState,
|
|
36
|
-
pop: mockedPop,
|
|
37
|
-
}),
|
|
38
|
-
useIsFocused: () => mockUseIsFocused,
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
|
|
42
23
|
const wrapComponent = (route) => (
|
|
43
24
|
<SCProvider initState={mockSCStore({})}>
|
|
44
25
|
<EditSubUnit route={route} />
|
|
@@ -66,7 +47,6 @@ describe('Test EditSubUnit', () => {
|
|
|
66
47
|
},
|
|
67
48
|
};
|
|
68
49
|
|
|
69
|
-
mockedDispatch.mockClear();
|
|
70
50
|
mock.reset();
|
|
71
51
|
Toast.show.mockClear();
|
|
72
52
|
});
|
|
@@ -90,7 +70,7 @@ describe('Test EditSubUnit', () => {
|
|
|
90
70
|
it('alertAction rightButtonClick success, previous screen Routes.UnitDetail', async () => {
|
|
91
71
|
mock.onDelete(API.SUB_UNIT.REMOVE_SUB_UNIT(1, 2)).reply(200);
|
|
92
72
|
|
|
93
|
-
mockedDangerouslyGetState.mockImplementation(() => ({
|
|
73
|
+
global.mockedDangerouslyGetState.mockImplementation(() => ({
|
|
94
74
|
routes: [
|
|
95
75
|
{ name: Routes.UnitDetail },
|
|
96
76
|
{ name: 'route 2' },
|
|
@@ -117,11 +97,13 @@ describe('Test EditSubUnit', () => {
|
|
|
117
97
|
});
|
|
118
98
|
|
|
119
99
|
it('alertAction rightButtonClick success', async () => {
|
|
120
|
-
mock
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
100
|
+
mock.onDelete(API.SUB_UNIT.REMOVE_SUB_UNIT(1, 2)).reply(200);
|
|
101
|
+
global.mockedDangerouslyGetState.mockImplementation(() => ({
|
|
102
|
+
routes: [
|
|
103
|
+
{ name: 'UnitDetail' },
|
|
104
|
+
{ name: 'route 2' },
|
|
105
|
+
{ name: 'route 3' },
|
|
106
|
+
],
|
|
125
107
|
}));
|
|
126
108
|
|
|
127
109
|
await act(async () => {
|
|
@@ -132,7 +114,7 @@ describe('Test EditSubUnit', () => {
|
|
|
132
114
|
await act(async () => {
|
|
133
115
|
await alertAction[1].props.rightButtonClick();
|
|
134
116
|
});
|
|
135
|
-
expect(mockedPop).toBeCalled();
|
|
117
|
+
expect(global.mockedPop).toBeCalled();
|
|
136
118
|
});
|
|
137
119
|
|
|
138
120
|
it('alertAction rightButtonClick fail', async () => {
|
|
@@ -140,7 +122,7 @@ describe('Test EditSubUnit', () => {
|
|
|
140
122
|
.onDelete('https://backend.eoh.io/api/property_manager/1/sub_units/2/')
|
|
141
123
|
.reply(400);
|
|
142
124
|
|
|
143
|
-
mockedDangerouslyGetState.mockImplementation(() => ({
|
|
125
|
+
global.mockedDangerouslyGetState.mockImplementation(() => ({
|
|
144
126
|
routes: [{ name: 'route 1' }, { name: 'route 2' }, { name: 'route 3' }],
|
|
145
127
|
}));
|
|
146
128
|
|
|
@@ -216,7 +198,7 @@ describe('Test EditSubUnit', () => {
|
|
|
216
198
|
await act(async () => {
|
|
217
199
|
await viewBottomButton.props.onRightClick();
|
|
218
200
|
});
|
|
219
|
-
expect(mockedDispatch).not.toHaveBeenCalled();
|
|
201
|
+
expect(global.mockedDispatch).not.toHaveBeenCalled();
|
|
220
202
|
expect(spyToast).not.toHaveBeenCalled();
|
|
221
203
|
});
|
|
222
204
|
|
|
@@ -334,7 +316,7 @@ describe('Test EditSubUnit', () => {
|
|
|
334
316
|
mock
|
|
335
317
|
.onGet(API.EMERGENCY_BUTTON.CONTACTS())
|
|
336
318
|
.reply(200, [{ id: 1, name: 'name' }]);
|
|
337
|
-
|
|
319
|
+
global.mockedUseIsFocused.mockImplementationOnce(() => true);
|
|
338
320
|
await act(async () => {
|
|
339
321
|
tree = await create(wrapComponent(route));
|
|
340
322
|
});
|
|
@@ -47,7 +47,7 @@ describe('Test ManageSubUnit', () => {
|
|
|
47
47
|
await act(async () => {
|
|
48
48
|
rowItem[0].props.onPress();
|
|
49
49
|
});
|
|
50
|
-
expect(mockedNavigate).toHaveBeenCalledWith(Routes.UnitStack, {
|
|
50
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.UnitStack, {
|
|
51
51
|
params: {
|
|
52
52
|
station: { id: 1, name: 'sensor' },
|
|
53
53
|
unit: {
|
|
@@ -74,7 +74,7 @@ describe('Test ManageSubUnit', () => {
|
|
|
74
74
|
await act(async () => {
|
|
75
75
|
buttonAddSubUnit.props.onPress();
|
|
76
76
|
});
|
|
77
|
-
expect(mockedNavigate).toHaveBeenCalledWith(Routes.AddSubUnitStack, {
|
|
77
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.AddSubUnitStack, {
|
|
78
78
|
params: {
|
|
79
79
|
unit: {
|
|
80
80
|
id: 1,
|
|
@@ -4,20 +4,8 @@ import useManageSubUnit from '../useManageSubUnit';
|
|
|
4
4
|
import API from '../../../../configs/API';
|
|
5
5
|
import api from '../../../../utils/Apis/axios';
|
|
6
6
|
|
|
7
|
-
const mockRoute = jest.fn();
|
|
8
7
|
const mock = new MockAdapter(api.axiosInstance);
|
|
9
8
|
|
|
10
|
-
jest.mock('@react-navigation/native', () => {
|
|
11
|
-
return {
|
|
12
|
-
...jest.requireActual('@react-navigation/native'),
|
|
13
|
-
useRoute: () => mockRoute,
|
|
14
|
-
useNavigation: () => ({
|
|
15
|
-
goBack: jest.fn(),
|
|
16
|
-
}),
|
|
17
|
-
useIsFocused: jest.fn(),
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
|
|
21
9
|
describe('Test Manage Access', () => {
|
|
22
10
|
const unit = { id: 1, name: 'unit name' };
|
|
23
11
|
|