@eohjsc/react-native-smart-city 0.7.3-rc2 → 0.7.3-rc21
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/package.json +17 -15
- package/src/commons/Action/__test__/ItemQuickAction.test.js +6 -6
- 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 +5 -5
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
- package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +2 -2
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -2
- package/src/commons/ActionGroup/SliderRangeTemplate.js +7 -7
- 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__/ThreeButtonCircle.test.js +2 -2
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonDefault.test.js +2 -2
- package/src/commons/ActionGroup/TimerActionTemplate.js +6 -3
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
- package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +9 -10
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +5 -5
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +5 -5
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +8 -8
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +6 -6
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +1 -1
- package/src/commons/ActionGroup/__test__/index.test.js +6 -6
- package/src/commons/ActionTemplate/__test__/index.test.js +4 -4
- package/src/commons/Automate/ItemAutomate.js +8 -7
- package/src/commons/Automate/__test__/ItemAutomate.test.js +2 -2
- package/src/commons/BackDefault/index.js +2 -2
- package/src/commons/ButtonPopup/index.js +2 -2
- package/src/commons/ChartAggregationOption/__test__/FourButtonFilterHistory.test.js +2 -2
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +8 -9
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +7 -7
- package/src/commons/DateTimeRangeChange/DateTimeButton.js +3 -3
- package/src/commons/Device/ConnectedViewHeader.js +2 -2
- package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +1 -1
- package/src/commons/Device/FlatListItems.js +20 -19
- package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -3
- package/src/commons/Device/HorizontalBarChart.js +54 -34
- 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 +6 -2
- package/src/commons/DisplayChecking/index.js +2 -2
- package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
- package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -3
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +6 -6
- package/src/commons/FlatListDnD/__test__/index.test.js +4 -4
- package/src/commons/FlatListDnD/index.js +12 -9
- package/src/commons/Grid/GridItem.js +10 -2
- package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +3 -3
- package/src/commons/Header/HeaderCustom.js +2 -2
- package/src/commons/Header/__test__/HeaderCT.test.js +3 -3
- package/src/commons/HeaderAni/index.js +2 -2
- package/src/commons/IconComponent/index.js +3 -3
- package/src/commons/ImagePicker/__test__/ImagePicker.test.js +5 -5
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +6 -4
- package/src/commons/NavBar/index.js +2 -2
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +1 -1
- package/src/commons/Popover/__test__/index.test.js +3 -3
- package/src/commons/Processing/__test__/Connecting.test.js +4 -4
- package/src/commons/SearchLocation/index.js +3 -3
- package/src/commons/SelectActionCard/index.js +2 -2
- package/src/commons/SelectSubUnit/index.js +6 -2
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +5 -5
- package/src/commons/Sharing/BtnRemoveMember.js +2 -2
- package/src/commons/Sharing/StationDevicePermissions.js +2 -2
- 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/OneTap/ItemOneTap.js +3 -4
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +0 -2
- package/src/commons/SubUnit/OneTap/index.js +9 -8
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +8 -8
- package/src/commons/Unit/HeaderUnit/index.js +3 -3
- package/src/commons/Unit/SharedUnit.js +7 -7
- package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +9 -13
- package/src/configs/Theme.js +1 -1
- package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +5 -5
- package/src/hooks/IoT/__test__/useHomeAssistantConnection.test.js +12 -12
- package/src/hooks/IoT/__test__/useWatchConfigs.test.js +3 -3
- package/src/hooks/IoT/useRemoteControl.js +6 -6
- package/src/hooks/useMqtt.js +2 -2
- package/src/iot/RemoteControl/Internet.js +2 -2
- package/src/iot/RemoteControl/__test__/Internet.test.js +7 -7
- package/src/navigations/EmergencyContactsStack.js +4 -3
- package/src/navigations/SharedStack.js +2 -0
- package/src/navigations/UnitStack.js +55 -54
- package/src/screens/AQIGuide/index.js +0 -2
- package/src/screens/ActivityLog/index.js +2 -2
- package/src/screens/AddLocationMaps/__test__/index.test.js +12 -12
- package/src/screens/AddLocationMaps/index.js +15 -15
- package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
- package/src/screens/AddNewGateway/SelectDeviceType.js +1 -1
- package/src/screens/AddNewGateway/ShareWifiPassword.js +16 -15
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -7
- package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +8 -8
- package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +7 -7
- package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +8 -8
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +5 -5
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +4 -4
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -6
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -6
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +0 -4
- package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +2 -2
- package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +19 -17
- package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +19 -17
- package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +18 -16
- package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +43 -35
- package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +13 -13
- package/src/screens/AllGateway/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/components/Detail/__test__/index.test.js +3 -5
- package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +3 -3
- package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/hooks/__test__/index.test.js +2 -2
- package/src/screens/AllGateway/test-utils.js +3 -4
- package/src/screens/Automate/AddNewAction/ChooseAction.js +17 -3
- package/src/screens/Automate/AddNewAction/ChooseConfig.js +7 -6
- package/src/screens/Automate/AddNewAction/NewActionWrapper.js +8 -8
- package/src/screens/Automate/AddNewAction/SelectControlDevices.js +30 -20
- package/src/screens/Automate/AddNewAction/SelectMonitorDevices.js +17 -10
- package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +42 -34
- package/src/screens/Automate/AddNewAction/SetupScriptDelay.js +1 -1
- package/src/screens/Automate/AddNewAction/SetupScriptNotify.js +3 -3
- package/src/screens/Automate/AddNewAction/Styles/SetupSensorStyles.js +20 -4
- package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +12 -12
- package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +14 -8
- package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +13 -7
- package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +12 -11
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptDelay.test.js +9 -9
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +39 -10
- package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +10 -9
- package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +13 -8
- package/src/screens/Automate/Components/InputName.js +10 -7
- package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +8 -8
- package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +6 -6
- package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +7 -7
- package/src/screens/Automate/EditActionsList/index.js +19 -17
- package/src/screens/Automate/MultiUnits.js +19 -22
- package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +18 -8
- package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +15 -7
- package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +14 -6
- package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +4 -7
- package/src/screens/Automate/ScriptDetail/__test__/index.test.js +3 -1
- package/src/screens/Automate/ScriptDetail/__test__/useStarredScript.test.js +6 -6
- package/src/screens/Automate/ScriptDetail/index.js +48 -38
- package/src/screens/Automate/SetSchedule/__test__/SelectWeekday.test.js +4 -4
- package/src/screens/Automate/SetSchedule/__test__/index.test.js +29 -18
- package/src/screens/Automate/SetSchedule/components/RowItem.js +5 -5
- package/src/screens/Automate/SetSchedule/index.js +8 -7
- package/src/screens/Automate/Styles/indexStyles.js +1 -1
- package/src/screens/Automate/__test__/MultiUnits.test.js +1 -4
- package/src/screens/Automate/__test__/index.test.js +0 -1
- package/src/screens/Automate/index.js +36 -34
- package/src/screens/ChangePosition/__test__/index.test.js +6 -6
- package/src/screens/ChangePosition/index.js +2 -1
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +9 -9
- package/src/screens/Device/EditDevice/index.js +2 -2
- package/src/screens/Device/__test__/detail.test.js +14 -14
- package/src/screens/Device/__test__/mqttDetail.test.js +9 -9
- package/src/screens/Device/components/SensorDisplayItem.js +5 -5
- package/src/screens/Device/detail.js +7 -7
- package/src/screens/Device/hooks/useEvaluateValue.js +1 -1
- package/src/screens/Drawer/Drawer.test.js +2 -2
- package/src/screens/Drawer/index.js +3 -3
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +8 -4
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -3
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -7
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +8 -8
- package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
- package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +3 -3
- package/src/screens/GuestInfo/index.js +2 -2
- package/src/screens/HanetCamera/ManageAccess.js +3 -3
- package/src/screens/HanetCamera/MemberInfo.js +2 -2
- package/src/screens/HanetCamera/__test__/Detail.test.js +9 -9
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -10
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
- package/src/screens/ManageAccess/index.js +3 -3
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +9 -9
- package/src/screens/Notification/__test__/Notification.test.js +9 -9
- package/src/screens/Notification/components/NotificationItem.js +3 -4
- package/src/screens/Notification/index.js +3 -3
- package/src/screens/Notification/styles/NotificationItemStyles.js +0 -1
- package/src/screens/PlayBackCamera/__test__/index.test.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
- package/src/screens/SelectUnit/__test__/index.test.js +8 -8
- package/src/screens/SelectUnit/index.js +4 -4
- 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__/UpdateShareDevice.test.js +7 -7
- package/src/screens/SideMenuDetail/__test__/index.test.js +8 -8
- package/src/screens/SmartAccount/Connecting/index.js +5 -5
- package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +8 -8
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +7 -7
- package/src/screens/SmartAccount/SuccessfullyConnected/index.js +2 -2
- package/src/screens/SmartAccount/__test__/Connecting.test.js +6 -6
- package/src/screens/SmartAccount/__test__/SmartAccount.test.js +10 -10
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +3 -2
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +2 -2
- package/src/screens/SmartIr/components/SelectBrand.js +2 -2
- package/src/screens/SubUnit/AddSubUnit.js +2 -4
- package/src/screens/SubUnit/EditSubUnit.js +10 -9
- package/src/screens/SubUnit/ManageSubUnit.js +3 -3
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -11
- package/src/screens/Template/EditTemplate.js +6 -4
- package/src/screens/Template/__test__/EditTemplate.test.js +7 -7
- package/src/screens/Template/__test__/detail.test.js +4 -4
- package/src/screens/Template/__test__/index.test.js +1 -1
- package/src/screens/UVIndexGuide/index.js +2 -4
- package/src/screens/Unit/SelectAddToFavorites.js +2 -2
- package/src/screens/Unit/SelectAddress.js +16 -12
- package/src/screens/Unit/Station/__test__/index.test.js +1 -1
- package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +9 -9
- package/src/screens/Unit/__test__/SelectAddress.test.js +11 -17
- package/src/screens/Unit/__test__/Summaries.test.js +7 -7
- package/src/screens/Unit/components/AutomateScript/index.js +2 -2
- package/src/screens/Unit/components/ButtonWrapper/index.js +3 -3
- package/src/screens/Unit/components/Header/index.js +2 -2
- package/src/screens/Unit/components/SharedUnit/index.js +5 -5
- package/src/screens/Unit/components/__test__/AutomateScript.test.js +3 -3
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +8 -8
- package/src/screens/Unit/hook/__test__/useUnitConnectRemoteDevices.test.js +2 -2
- package/src/screens/UnitSummary/components/AirQuality/index.js +6 -11
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +6 -6
- package/src/screens/UnitSummary/index.js +3 -3
- package/src/utils/I18n/translations/en.js +3 -1
- package/src/utils/I18n/translations/vi.js +5 -2
- package/src/utils/__test__/Utils.test.js +16 -16
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
1
|
import SegmentedControl from '@react-native-segmented-control/segmented-control';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import Carousel from 'react-native-new-snap-carousel';
|
|
4
|
+
import { act, create } from 'react-test-renderer';
|
|
5
5
|
|
|
6
|
+
import TabPaneCT from '..';
|
|
7
|
+
import { DEVICE_TYPE } from '../../../../../configs/Constants';
|
|
6
8
|
import { SCProvider } from '../../../../../context';
|
|
7
9
|
import { mockSCStore } from '../../../../../context/mockStore';
|
|
8
|
-
import { DEVICE_TYPE } from '../../../../../configs/Constants';
|
|
9
|
-
import TabPaneCT from '..';
|
|
10
10
|
|
|
11
11
|
const mockSetSelectedIndex = jest.fn();
|
|
12
12
|
const wrapComponent = (item = []) => (
|
|
@@ -58,7 +58,7 @@ describe('Test TabPaneCT', () => {
|
|
|
58
58
|
nativeEvent: { selectedSegmentIndex: 1 },
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
-
expect(mockSetSelectedIndex).
|
|
61
|
+
expect(mockSetSelectedIndex).toHaveBeenCalledWith(1);
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
it('test render TabPaneCT onChange Carousel', async () => {
|
|
@@ -72,7 +72,7 @@ describe('Test TabPaneCT', () => {
|
|
|
72
72
|
await act(async () => {
|
|
73
73
|
await carousel[0].props.onSnapToItem(1);
|
|
74
74
|
});
|
|
75
|
-
expect(mockSetSelectedIndex).
|
|
75
|
+
expect(mockSetSelectedIndex).toHaveBeenCalledWith(1);
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
it('test render TabPaneCT none list', async () => {
|
|
@@ -2,8 +2,8 @@ import { act, renderHook } from '@testing-library/react-hooks';
|
|
|
2
2
|
import MockAdapter from 'axios-mock-adapter';
|
|
3
3
|
import Toast from 'react-native-toast-message';
|
|
4
4
|
|
|
5
|
-
import api from '../../../../utils/Apis/axios';
|
|
6
5
|
import { API } from '../../../../configs';
|
|
6
|
+
import api from '../../../../utils/Apis/axios';
|
|
7
7
|
import { useGateway } from '../useGateway';
|
|
8
8
|
|
|
9
9
|
const mock = new MockAdapter(api.axiosInstance);
|
|
@@ -98,7 +98,7 @@ describe('Test useGateway', () => {
|
|
|
98
98
|
await act(async () => {
|
|
99
99
|
await hook.result.current.deleteGatewayDetail(1);
|
|
100
100
|
});
|
|
101
|
-
expect(Toast.show).
|
|
101
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
102
102
|
position: 'bottom',
|
|
103
103
|
text1: 'Delete successfully!',
|
|
104
104
|
text2: undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Detail from './components/Detail';
|
|
2
|
-
import TabPaneCT from './components/TabPaneCT';
|
|
3
1
|
import SegmentedControl from '@react-native-segmented-control/segmented-control';
|
|
4
2
|
import { act } from 'react-test-renderer';
|
|
3
|
+
import Detail from './components/Detail';
|
|
4
|
+
import TabPaneCT from './components/TabPaneCT';
|
|
5
5
|
|
|
6
6
|
export const fetchGatewayCT = async (tree) => {
|
|
7
7
|
const instance = tree.root;
|
|
@@ -16,5 +16,4 @@ export const fetchGatewayCT = async (tree) => {
|
|
|
16
16
|
return { tabPaneCT, detail };
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export const flushPromises = () =>
|
|
20
|
-
new Promise((resolve) => setImmediate(resolve));
|
|
19
|
+
export const flushPromises = () => new Promise(process.nextTick);
|
|
@@ -14,7 +14,13 @@ import RenderActionItem from './RenderActionItem';
|
|
|
14
14
|
const ChooseAction = ({ route }) => {
|
|
15
15
|
const t = useTranslations();
|
|
16
16
|
const { navigate } = useNavigation();
|
|
17
|
-
const {
|
|
17
|
+
const {
|
|
18
|
+
unitId,
|
|
19
|
+
device,
|
|
20
|
+
automateId,
|
|
21
|
+
numberActionCanAdd,
|
|
22
|
+
multiUnit = {},
|
|
23
|
+
} = route.params;
|
|
18
24
|
const [data, setData] = useState([]);
|
|
19
25
|
const [actions, setActions] = useState([]);
|
|
20
26
|
|
|
@@ -48,7 +54,7 @@ const ChooseAction = ({ route }) => {
|
|
|
48
54
|
API.AUTOMATE.ADD_SCRIPT_ACTION(automateId),
|
|
49
55
|
{
|
|
50
56
|
list_action,
|
|
51
|
-
unit: unitId,
|
|
57
|
+
unit: unitId || multiUnit.id,
|
|
52
58
|
}
|
|
53
59
|
);
|
|
54
60
|
|
|
@@ -58,7 +64,15 @@ const ChooseAction = ({ route }) => {
|
|
|
58
64
|
merge: true,
|
|
59
65
|
params: { saveAt: moment().valueOf() },
|
|
60
66
|
});
|
|
61
|
-
}, [
|
|
67
|
+
}, [
|
|
68
|
+
actions,
|
|
69
|
+
numberActionCanAdd,
|
|
70
|
+
automateId,
|
|
71
|
+
unitId,
|
|
72
|
+
multiUnit.id,
|
|
73
|
+
navigate,
|
|
74
|
+
t,
|
|
75
|
+
]);
|
|
62
76
|
|
|
63
77
|
const handleOnSelectAction = (action) => {
|
|
64
78
|
setActions((prevActions) => {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native';
|
|
1
2
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
3
|
import { View } from 'react-native';
|
|
3
|
-
import { useNavigation } from '@react-navigation/native';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import GridItem from '../../../commons/Grid/GridItem';
|
|
6
6
|
import Text from '../../../commons/Text';
|
|
7
|
-
import { axiosGet } from '../../../utils/Apis/axios';
|
|
8
7
|
import { API, Colors } from '../../../configs';
|
|
8
|
+
import { AUTOMATE_TYPE } from '../../../configs/Constants';
|
|
9
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
10
|
+
import { axiosGet } from '../../../utils/Apis/axios';
|
|
9
11
|
import Routes from '../../../utils/Route';
|
|
10
|
-
import styles from './Styles/SelectActionStyles';
|
|
11
12
|
import { LoadingSelectAction } from './Components';
|
|
12
|
-
import { AUTOMATE_TYPE } from '../../../configs/Constants';
|
|
13
13
|
import NewActionWrapper from './NewActionWrapper';
|
|
14
|
-
import
|
|
14
|
+
import styles from './Styles/SelectActionStyles';
|
|
15
15
|
|
|
16
16
|
const ChooseConfig = ({ route }) => {
|
|
17
17
|
const t = useTranslations();
|
|
@@ -44,6 +44,7 @@ const ChooseConfig = ({ route }) => {
|
|
|
44
44
|
config,
|
|
45
45
|
automate,
|
|
46
46
|
closeScreen,
|
|
47
|
+
unitId: automate?.unit,
|
|
47
48
|
});
|
|
48
49
|
},
|
|
49
50
|
[automate, closeScreen, navigate]
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { KeyboardAwareScrollView } from '@eohjsc/react-native-keyboard-aware-scroll-view';
|
|
1
2
|
import React, { useCallback, useMemo } from 'react';
|
|
2
3
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import { KeyboardAwareScrollView } from '@eohjsc/react-native-keyboard-aware-scroll-view';
|
|
4
4
|
|
|
5
|
-
import styles from './Styles/SelectActionStyles';
|
|
6
|
-
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
7
|
-
import { Colors } from '../../../configs';
|
|
8
5
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
6
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
7
|
+
import { FullLoading, HeaderCustom } from '../../../commons';
|
|
9
8
|
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
9
|
+
import { Colors } from '../../../configs';
|
|
10
10
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
11
|
-
import
|
|
11
|
+
import styles from './Styles/SelectActionStyles';
|
|
12
12
|
|
|
13
13
|
const NewActionWrapper = ({
|
|
14
14
|
name,
|
|
@@ -25,8 +25,8 @@ const NewActionWrapper = ({
|
|
|
25
25
|
const { closeScreen } = params;
|
|
26
26
|
|
|
27
27
|
const handleClose = useCallback(() => {
|
|
28
|
-
navigate(closeScreen);
|
|
29
|
-
}, [closeScreen, navigate]);
|
|
28
|
+
navigate(closeScreen, params);
|
|
29
|
+
}, [closeScreen, navigate, params]);
|
|
30
30
|
|
|
31
31
|
const rightComponent = useMemo(
|
|
32
32
|
() => (
|
|
@@ -35,7 +35,7 @@ const NewActionWrapper = ({
|
|
|
35
35
|
onPress={handleClose}
|
|
36
36
|
accessibilityLabel={AccessibilityLabel.ICON_CLOSE}
|
|
37
37
|
>
|
|
38
|
-
<
|
|
38
|
+
<IconOutline name={'close'} size={24} color={Colors.Black} />
|
|
39
39
|
</TouchableOpacity>
|
|
40
40
|
),
|
|
41
41
|
[handleClose]
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
1
|
import { useNavigation } from '@react-navigation/native';
|
|
3
|
-
import {
|
|
2
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
4
3
|
import { API } from '../../../configs';
|
|
4
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
5
|
+
import { fetchWithCache } from '../../../utils/Apis/axios';
|
|
5
6
|
import Routes from '../../../utils/Route';
|
|
6
7
|
import SelectDevices from './Components/SelectDevices';
|
|
7
|
-
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
8
8
|
|
|
9
9
|
const SelectControlDevices = ({ route }) => {
|
|
10
10
|
const t = useTranslations();
|
|
11
|
-
const {
|
|
12
|
-
|
|
11
|
+
const {
|
|
12
|
+
unitId,
|
|
13
|
+
closeScreen,
|
|
14
|
+
automateId,
|
|
15
|
+
numberActionCanAdd,
|
|
16
|
+
multiUnit = {},
|
|
17
|
+
} = route.params || {};
|
|
13
18
|
|
|
14
19
|
const [stations, setStations] = useState([]);
|
|
15
20
|
const [listStation, setListStation] = useState([]);
|
|
@@ -19,22 +24,26 @@ const SelectControlDevices = ({ route }) => {
|
|
|
19
24
|
const [loading, setLoading] = useState(true);
|
|
20
25
|
|
|
21
26
|
const fetchDetails = useCallback(async () => {
|
|
22
|
-
await fetchWithCache(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
index
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
await fetchWithCache(
|
|
28
|
+
API.UNIT.DEVICE_CONTROL(unitId || multiUnit.id),
|
|
29
|
+
{},
|
|
30
|
+
(response) => {
|
|
31
|
+
const { success, data } = response;
|
|
32
|
+
if (success) {
|
|
33
|
+
const newData = data.filter((item) => item.sensors.length > 0);
|
|
34
|
+
const listMenu = newData.map((item, index) => ({
|
|
35
|
+
text: item.name,
|
|
36
|
+
station: item,
|
|
37
|
+
index: index,
|
|
38
|
+
}));
|
|
39
|
+
setStations(newData);
|
|
40
|
+
setListMenuItem(listMenu);
|
|
41
|
+
setListStation(listMenu);
|
|
42
|
+
}
|
|
34
43
|
}
|
|
35
|
-
|
|
44
|
+
);
|
|
36
45
|
setLoading(false);
|
|
37
|
-
}, [unitId]);
|
|
46
|
+
}, [multiUnit.id, unitId]);
|
|
38
47
|
|
|
39
48
|
useEffect(() => {
|
|
40
49
|
fetchDetails();
|
|
@@ -48,9 +57,10 @@ const SelectControlDevices = ({ route }) => {
|
|
|
48
57
|
device: selectedDevice,
|
|
49
58
|
closeScreen,
|
|
50
59
|
numberActionCanAdd,
|
|
60
|
+
multiUnit,
|
|
51
61
|
});
|
|
52
62
|
},
|
|
53
|
-
[navigate, unitId, automateId, closeScreen, numberActionCanAdd]
|
|
63
|
+
[navigate, unitId, automateId, closeScreen, numberActionCanAdd, multiUnit]
|
|
54
64
|
);
|
|
55
65
|
|
|
56
66
|
if (loading) {
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
1
|
import { useNavigation } from '@react-navigation/native';
|
|
2
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
3
3
|
|
|
4
|
+
import { API } from '../../../configs';
|
|
5
|
+
import { AUTOMATE_TYPE } from '../../../configs/Constants';
|
|
4
6
|
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
5
7
|
import { fetchWithCache } from '../../../utils/Apis/axios';
|
|
6
|
-
import { API } from '../../../configs';
|
|
7
8
|
import Routes from '../../../utils/Route';
|
|
8
9
|
import SelectDevices from './Components/SelectDevices';
|
|
9
|
-
import { AUTOMATE_TYPE } from '../../../configs/Constants';
|
|
10
10
|
|
|
11
11
|
const SelectMonitorDevices = ({ route }) => {
|
|
12
12
|
const t = useTranslations();
|
|
13
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
automate = {},
|
|
15
|
+
isCreateNewAction,
|
|
16
|
+
closeScreen,
|
|
17
|
+
multiUnit = {},
|
|
18
|
+
} = route.params || {};
|
|
19
|
+
const { type, unit, sensor_id } = automate;
|
|
14
20
|
|
|
15
21
|
const [stations, setStations] = useState([]);
|
|
16
22
|
const [listStation, setListStation] = useState([]);
|
|
@@ -22,11 +28,11 @@ const SelectMonitorDevices = ({ route }) => {
|
|
|
22
28
|
|
|
23
29
|
const fetchDetails = useCallback(async () => {
|
|
24
30
|
const configs = { params: {} };
|
|
25
|
-
if (
|
|
31
|
+
if (type === AUTOMATE_TYPE.EVENT) {
|
|
26
32
|
configs.params.type = 'event';
|
|
27
33
|
}
|
|
28
34
|
await fetchWithCache(
|
|
29
|
-
API.UNIT.DEVICE_SENSOR(
|
|
35
|
+
API.UNIT.DEVICE_SENSOR(unit || multiUnit.id),
|
|
30
36
|
configs,
|
|
31
37
|
(response) => {
|
|
32
38
|
const { success, data } = response;
|
|
@@ -46,17 +52,17 @@ const SelectMonitorDevices = ({ route }) => {
|
|
|
46
52
|
}
|
|
47
53
|
);
|
|
48
54
|
setLoading(false);
|
|
49
|
-
}, [
|
|
55
|
+
}, [multiUnit.id, type, unit]);
|
|
50
56
|
|
|
51
57
|
useEffect(() => {
|
|
52
|
-
if (!
|
|
58
|
+
if (!sensor_id) {
|
|
53
59
|
return;
|
|
54
60
|
}
|
|
55
61
|
let selectSensor = {};
|
|
56
62
|
let found = false;
|
|
57
63
|
for (let i = 0; i < stations.length; i++) {
|
|
58
64
|
for (let j = 0; j < stations[i].sensors.length; j++) {
|
|
59
|
-
if (stations[i].sensors[j].id ===
|
|
65
|
+
if (stations[i].sensors[j].id === sensor_id) {
|
|
60
66
|
selectSensor = stations[i].sensors[j];
|
|
61
67
|
found = true;
|
|
62
68
|
break;
|
|
@@ -67,7 +73,7 @@ const SelectMonitorDevices = ({ route }) => {
|
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
75
|
setDefaultSelectedDevice(selectSensor);
|
|
70
|
-
}, [
|
|
76
|
+
}, [sensor_id, stations]);
|
|
71
77
|
|
|
72
78
|
useEffect(() => {
|
|
73
79
|
fetchDetails();
|
|
@@ -86,6 +92,7 @@ const SelectMonitorDevices = ({ route }) => {
|
|
|
86
92
|
stationName: stations[indexStation]?.name,
|
|
87
93
|
isCreateNewAction,
|
|
88
94
|
closeScreen,
|
|
95
|
+
unitId: automate?.unit,
|
|
89
96
|
});
|
|
90
97
|
},
|
|
91
98
|
[navigate, automate, stations, isCreateNewAction, closeScreen]
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
|
-
import { View
|
|
2
|
+
import { View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import styles from './Styles/SetupSensorStyles';
|
|
5
|
-
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
6
|
-
import Text from '../../../commons/Text';
|
|
7
4
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
8
|
-
import
|
|
5
|
+
import { Button } from '../../../commons';
|
|
6
|
+
import TextInput from '../../../commons/Form/TextInput';
|
|
9
7
|
import GridItem from '../../../commons/Grid/GridItem';
|
|
10
|
-
import Routes from '../../../utils/Route';
|
|
11
8
|
import ModalCustom from '../../../commons/Modal/ModalCustom';
|
|
9
|
+
import Text from '../../../commons/Text';
|
|
10
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
11
|
+
import Routes from '../../../utils/Route';
|
|
12
12
|
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
13
|
+
import NewActionWrapper from './NewActionWrapper';
|
|
14
|
+
import styles from './Styles/SetupSensorStyles';
|
|
15
15
|
|
|
16
16
|
const valueEvaluationToOptions = (valueEvaluation) => {
|
|
17
17
|
if (valueEvaluation.template === 'range') {
|
|
@@ -43,7 +43,7 @@ const SetupConfigCondition = () => {
|
|
|
43
43
|
const t = useTranslations();
|
|
44
44
|
const { navigate } = useNavigation();
|
|
45
45
|
const { params = {} } = useRoute();
|
|
46
|
-
const { config, automate, closeScreen } = params;
|
|
46
|
+
const { config, automate, closeScreen, unitId } = params;
|
|
47
47
|
const [selectedCondition, setSelectedCondition] = useState(undefined);
|
|
48
48
|
const [customCondition, setCustomCondition] = useState(undefined);
|
|
49
49
|
const [isShowModal, setIsShowModal] = useState(false);
|
|
@@ -54,7 +54,7 @@ const SetupConfigCondition = () => {
|
|
|
54
54
|
value: '<',
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
|
-
label: `${t('
|
|
57
|
+
label: `${t('is_equal')} (=)`,
|
|
58
58
|
value: '=',
|
|
59
59
|
},
|
|
60
60
|
{
|
|
@@ -88,6 +88,7 @@ const SetupConfigCondition = () => {
|
|
|
88
88
|
navigate(Routes.ValueChangeName, {
|
|
89
89
|
automate,
|
|
90
90
|
closeScreen,
|
|
91
|
+
unitId,
|
|
91
92
|
});
|
|
92
93
|
};
|
|
93
94
|
|
|
@@ -132,41 +133,44 @@ const SetupConfigCondition = () => {
|
|
|
132
133
|
style={styles.modal}
|
|
133
134
|
>
|
|
134
135
|
<View style={styles.modalContent}>
|
|
135
|
-
<Text type="Body">
|
|
136
|
+
<Text type="Body" bold style={styles.titleCondition}>
|
|
136
137
|
{t('when_value_is', { config_name: config.name })}
|
|
137
138
|
</Text>
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
data={normalConditions}
|
|
141
|
-
renderItem={({ item }) => {
|
|
139
|
+
<View style={styles.flatListCondition}>
|
|
140
|
+
{normalConditions.map((item) => {
|
|
142
141
|
return (
|
|
143
|
-
<
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
</
|
|
142
|
+
<GridItem
|
|
143
|
+
onPress={() => {
|
|
144
|
+
automate.condition = item.value;
|
|
145
|
+
setCustomCondition(item.value);
|
|
146
|
+
}}
|
|
147
|
+
selected={item.value === customCondition}
|
|
148
|
+
style={styles.gridItem}
|
|
149
|
+
>
|
|
150
|
+
<Text type="Body">{item.label}</Text>
|
|
151
|
+
</GridItem>
|
|
153
152
|
);
|
|
154
|
-
}}
|
|
155
|
-
|
|
153
|
+
})}
|
|
154
|
+
</View>
|
|
155
|
+
|
|
156
156
|
<View style={styles.inputValue}>
|
|
157
|
-
<Text>{t('value')}</Text>
|
|
158
157
|
<TextInput
|
|
159
158
|
keyboardType="decimal-pad"
|
|
160
159
|
type="number"
|
|
161
160
|
maxLength={10}
|
|
161
|
+
placeholder={t('value')}
|
|
162
162
|
onChange={(value) => {
|
|
163
163
|
const floatValue = parseFloat(value.replace(',', '.'));
|
|
164
164
|
automate.value = floatValue;
|
|
165
165
|
}}
|
|
166
|
-
|
|
166
|
+
textInputStyle={styles.numberInput}
|
|
167
|
+
wrapStyle={styles.wrapTextInput}
|
|
167
168
|
/>
|
|
168
169
|
</View>
|
|
169
|
-
|
|
170
|
+
|
|
171
|
+
<Button
|
|
172
|
+
type="primary"
|
|
173
|
+
title={t('continue')}
|
|
170
174
|
testID={'continue_button'}
|
|
171
175
|
onPress={() => {
|
|
172
176
|
if (
|
|
@@ -177,11 +181,15 @@ const SetupConfigCondition = () => {
|
|
|
177
181
|
return;
|
|
178
182
|
}
|
|
179
183
|
setIsShowModal(false);
|
|
180
|
-
navigate(Routes.ValueChangeName, {
|
|
184
|
+
navigate(Routes.ValueChangeName, {
|
|
185
|
+
automate,
|
|
186
|
+
closeScreen,
|
|
187
|
+
unitId,
|
|
188
|
+
});
|
|
181
189
|
}}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
190
|
+
style={styles.buttonContinue}
|
|
191
|
+
textSemiBold={false}
|
|
192
|
+
/>
|
|
185
193
|
</View>
|
|
186
194
|
</ModalCustom>
|
|
187
195
|
</NewActionWrapper>
|
|
@@ -17,9 +17,9 @@ import moment from 'moment';
|
|
|
17
17
|
const SetupScriptNotify = ({ route }) => {
|
|
18
18
|
const t = useTranslations();
|
|
19
19
|
const { goBack, navigate } = useNavigation();
|
|
20
|
-
const { automate = {}, unitId } = route
|
|
20
|
+
const { automate = {}, unitId, multiUnit } = route.params || {};
|
|
21
21
|
const { id: automateId } = automate;
|
|
22
|
-
const [notify, setNotify] = useState({ unit: unitId });
|
|
22
|
+
const [notify, setNotify] = useState({ unit: unitId || multiUnit.id });
|
|
23
23
|
|
|
24
24
|
const onChangeTitle = (value) => {
|
|
25
25
|
setNotify((state) => ({
|
|
@@ -47,7 +47,7 @@ const SetupScriptNotify = ({ route }) => {
|
|
|
47
47
|
params: { saveAt: moment().valueOf() },
|
|
48
48
|
});
|
|
49
49
|
} else {
|
|
50
|
-
ToastBottomHelper.error(t('
|
|
50
|
+
ToastBottomHelper.error(t('error_please_try_later'));
|
|
51
51
|
}
|
|
52
52
|
}, [automateId, navigate, notify, t]);
|
|
53
53
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
-
import {
|
|
2
|
+
import { Colors, Theme } from '../../../../configs';
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
5
|
...Theme,
|
|
@@ -11,10 +11,9 @@ export default StyleSheet.create({
|
|
|
11
11
|
},
|
|
12
12
|
inputValue: { marginBottom: 10 },
|
|
13
13
|
numberInput: {
|
|
14
|
-
borderRadius:
|
|
14
|
+
borderRadius: 8,
|
|
15
15
|
borderWidth: 1,
|
|
16
|
-
height:
|
|
17
|
-
marginTop: 10,
|
|
16
|
+
height: 50,
|
|
18
17
|
},
|
|
19
18
|
boxDevices: {
|
|
20
19
|
flexWrap: 'wrap',
|
|
@@ -43,4 +42,21 @@ export default StyleSheet.create({
|
|
|
43
42
|
width: '100%',
|
|
44
43
|
borderRadius: 10,
|
|
45
44
|
},
|
|
45
|
+
titleCondition: {
|
|
46
|
+
marginBottom: 16,
|
|
47
|
+
},
|
|
48
|
+
wrapTextInput: {
|
|
49
|
+
marginTop: 0,
|
|
50
|
+
},
|
|
51
|
+
flatListCondition: {
|
|
52
|
+
display: 'flex',
|
|
53
|
+
flexDirection: 'row',
|
|
54
|
+
justifyContent: 'space-between',
|
|
55
|
+
},
|
|
56
|
+
gridItem: {
|
|
57
|
+
width: 'fit-content',
|
|
58
|
+
},
|
|
59
|
+
buttonContinue: {
|
|
60
|
+
flex: 0,
|
|
61
|
+
},
|
|
46
62
|
});
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
5
|
+
import { useNavigation } from '@react-navigation/native';
|
|
6
|
+
import { TouchableOpacity } from 'react-native';
|
|
8
7
|
import BottomButtonView from '../../../../commons/BottomButtonView';
|
|
8
|
+
import SelectActionCard from '../../../../commons/SelectActionCard';
|
|
9
|
+
import { API } from '../../../../configs';
|
|
9
10
|
import { AccessibilityLabel, DEVICE_TYPE } from '../../../../configs/Constants';
|
|
11
|
+
import { SCProvider } from '../../../../context';
|
|
12
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
10
13
|
import api from '../../../../utils/Apis/axios';
|
|
11
|
-
import { API } from '../../../../configs';
|
|
12
|
-
import { TouchableOpacity } from 'react-native';
|
|
13
|
-
import SelectActionCard from '../../../../commons/SelectActionCard';
|
|
14
|
-
import { useNavigation } from '@react-navigation/native';
|
|
15
|
-
import { ToastBottomHelper } from '../../../../utils/Utils';
|
|
16
14
|
import { getTranslate } from '../../../../utils/I18n';
|
|
15
|
+
import { ToastBottomHelper } from '../../../../utils/Utils';
|
|
16
|
+
import ChooseAction from '../ChooseAction';
|
|
17
17
|
|
|
18
18
|
const mock = new MockAdapter(api.axiosInstance);
|
|
19
19
|
|
|
@@ -391,7 +391,7 @@ describe('Test ChooseAction', () => {
|
|
|
391
391
|
await act(async () => {
|
|
392
392
|
tree = await renderer.create(wrapComponent(route));
|
|
393
393
|
});
|
|
394
|
-
expect(spyToastError).
|
|
394
|
+
expect(spyToastError).toHaveBeenCalledWith(
|
|
395
395
|
getTranslate('en', 'template_not_supported', {
|
|
396
396
|
template: response[0].template,
|
|
397
397
|
}),
|
|
@@ -459,7 +459,7 @@ describe('Test ChooseAction', () => {
|
|
|
459
459
|
await buttonSave.props.onPress();
|
|
460
460
|
});
|
|
461
461
|
|
|
462
|
-
expect(spyToastError).
|
|
462
|
+
expect(spyToastError).toHaveBeenCalledWith(
|
|
463
463
|
'You can only add more 0 action',
|
|
464
464
|
null,
|
|
465
465
|
3000
|
|
@@ -617,7 +617,7 @@ describe('Test ChooseAction', () => {
|
|
|
617
617
|
await buttonSave.props.onPress();
|
|
618
618
|
});
|
|
619
619
|
|
|
620
|
-
expect(spyToastError).
|
|
620
|
+
expect(spyToastError).toHaveBeenCalledWith(
|
|
621
621
|
'You can only add more 2 actions',
|
|
622
622
|
null,
|
|
623
623
|
3000
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
2
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
3
|
import React from 'react';
|
|
4
|
+
import { TouchableOpacity } from 'react-native';
|
|
2
5
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
-
import { SCProvider } from '../../../../context';
|
|
5
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
|
-
import Device from '../Device';
|
|
7
6
|
import NavBar from '../../../../commons/NavBar';
|
|
8
7
|
import API from '../../../../configs/API';
|
|
9
8
|
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
9
|
+
import { SCProvider } from '../../../../context';
|
|
10
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
12
11
|
import api from '../../../../utils/Apis/axios';
|
|
12
|
+
import Routes from '../../../../utils/Route';
|
|
13
|
+
import Device from '../Device';
|
|
13
14
|
import SelectControlDevices from '../SelectControlDevices';
|
|
14
|
-
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
15
15
|
|
|
16
16
|
const mock = new MockAdapter(api.axiosInstance);
|
|
17
17
|
|
|
@@ -108,6 +108,12 @@ describe('Test SelectMonitorDevices', () => {
|
|
|
108
108
|
await act(async () => {
|
|
109
109
|
iconClose[0].props.onPress();
|
|
110
110
|
});
|
|
111
|
-
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail
|
|
111
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail, {
|
|
112
|
+
automate: { sensor_id: 1 },
|
|
113
|
+
automateId: 1,
|
|
114
|
+
closeScreen: 'ScriptDetail',
|
|
115
|
+
scriptName: 'scriptName test',
|
|
116
|
+
unitId: 1,
|
|
117
|
+
});
|
|
112
118
|
});
|
|
113
119
|
});
|