@eohjsc/react-native-smart-city 0.7.3-rc1 → 0.7.3-rc11
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/OnOffSmartLock/PasscodeList/__test__/index.test.js +5 -5
- 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/__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/__test__/ItemAutomate.test.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 +1 -1
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +1 -1
- package/src/commons/Device/FlatListItems.js +17 -16
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -3
- package/src/commons/Device/HorizontalBarChart.js +54 -34
- 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/__test__/HeaderCT.test.js +3 -3
- 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/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/SelectUnit/__test__/SelectUnit.test.js +5 -5
- package/src/commons/SubUnit/OneTap/index.js +9 -8
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +8 -8
- package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +9 -13
- 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/screens/AddLocationMaps/__test__/index.test.js +12 -12
- 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/NewActionWrapper.js +7 -7
- package/src/screens/Automate/AddNewAction/SelectControlDevices.js +3 -3
- package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +35 -32
- 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 +10 -10
- package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +4 -3
- package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +13 -8
- 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/OneTap/__test__/AddNewOneTap.test.js +16 -7
- package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +15 -7
- package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +4 -7
- package/src/screens/Automate/ScriptDetail/__test__/index.test.js +1 -1
- package/src/screens/Automate/ScriptDetail/__test__/useStarredScript.test.js +6 -6
- package/src/screens/Automate/ScriptDetail/index.js +18 -18
- package/src/screens/Automate/SetSchedule/__test__/SelectWeekday.test.js +4 -4
- package/src/screens/Automate/SetSchedule/__test__/index.test.js +28 -18
- package/src/screens/Automate/SetSchedule/components/RowItem.js +5 -5
- package/src/screens/Automate/SetSchedule/index.js +7 -7
- 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/__test__/detail.test.js +12 -12
- package/src/screens/Device/__test__/mqttDetail.test.js +9 -9
- package/src/screens/Device/components/SensorDisplayItem.js +5 -5
- package/src/screens/Drawer/Drawer.test.js +2 -2
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -7
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +8 -8
- package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +3 -3
- package/src/screens/HanetCamera/__test__/Detail.test.js +9 -9
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -10
- 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 +2 -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/SelectUnit/__test__/index.test.js +7 -7
- 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/__test__/Connecting.test.js +6 -6
- package/src/screens/SmartAccount/__test__/SmartAccount.test.js +10 -10
- package/src/screens/SubUnit/AddSubUnit.js +2 -4
- 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/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/__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/utils/I18n/translations/en.js +1 -1
- package/src/utils/I18n/translations/vi.js +1 -1
- package/src/utils/__test__/Utils.test.js +16 -16
|
@@ -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') {
|
|
@@ -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
|
{
|
|
@@ -132,41 +132,44 @@ const SetupConfigCondition = () => {
|
|
|
132
132
|
style={styles.modal}
|
|
133
133
|
>
|
|
134
134
|
<View style={styles.modalContent}>
|
|
135
|
-
<Text type="Body">
|
|
135
|
+
<Text type="Body" bold style={styles.titleCondition}>
|
|
136
136
|
{t('when_value_is', { config_name: config.name })}
|
|
137
137
|
</Text>
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
data={normalConditions}
|
|
141
|
-
renderItem={({ item }) => {
|
|
138
|
+
<View style={styles.flatListCondition}>
|
|
139
|
+
{normalConditions.map((item) => {
|
|
142
140
|
return (
|
|
143
|
-
<
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
</
|
|
141
|
+
<GridItem
|
|
142
|
+
onPress={() => {
|
|
143
|
+
automate.condition = item.value;
|
|
144
|
+
setCustomCondition(item.value);
|
|
145
|
+
}}
|
|
146
|
+
selected={item.value === customCondition}
|
|
147
|
+
style={styles.gridItem}
|
|
148
|
+
>
|
|
149
|
+
<Text type="Body">{item.label}</Text>
|
|
150
|
+
</GridItem>
|
|
153
151
|
);
|
|
154
|
-
}}
|
|
155
|
-
|
|
152
|
+
})}
|
|
153
|
+
</View>
|
|
154
|
+
|
|
156
155
|
<View style={styles.inputValue}>
|
|
157
|
-
<Text>{t('value')}</Text>
|
|
158
156
|
<TextInput
|
|
159
157
|
keyboardType="decimal-pad"
|
|
160
158
|
type="number"
|
|
161
159
|
maxLength={10}
|
|
160
|
+
placeholder={t('value')}
|
|
162
161
|
onChange={(value) => {
|
|
163
162
|
const floatValue = parseFloat(value.replace(',', '.'));
|
|
164
163
|
automate.value = floatValue;
|
|
165
164
|
}}
|
|
166
|
-
|
|
165
|
+
textInputStyle={styles.numberInput}
|
|
166
|
+
wrapStyle={styles.wrapTextInput}
|
|
167
167
|
/>
|
|
168
168
|
</View>
|
|
169
|
-
|
|
169
|
+
|
|
170
|
+
<Button
|
|
171
|
+
type="primary"
|
|
172
|
+
title={t('continue')}
|
|
170
173
|
testID={'continue_button'}
|
|
171
174
|
onPress={() => {
|
|
172
175
|
if (
|
|
@@ -179,9 +182,9 @@ const SetupConfigCondition = () => {
|
|
|
179
182
|
setIsShowModal(false);
|
|
180
183
|
navigate(Routes.ValueChangeName, { automate, closeScreen });
|
|
181
184
|
}}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
style={styles.buttonContinue}
|
|
186
|
+
textSemiBold={false}
|
|
187
|
+
/>
|
|
185
188
|
</View>
|
|
186
189
|
</ModalCustom>
|
|
187
190
|
</NewActionWrapper>
|
|
@@ -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
|
});
|
|
@@ -1,15 +1,15 @@
|
|
|
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 { useRoute } from '@react-navigation/native';
|
|
6
|
+
import { TouchableOpacity } from 'react-native';
|
|
8
7
|
import API from '../../../../configs/API';
|
|
9
8
|
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
10
|
-
import {
|
|
9
|
+
import { SCProvider } from '../../../../context';
|
|
10
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
11
11
|
import api from '../../../../utils/Apis/axios';
|
|
12
|
-
import
|
|
12
|
+
import SelectMonitorDevices from '../SelectMonitorDevices';
|
|
13
13
|
|
|
14
14
|
const mock = new MockAdapter(api.axiosInstance);
|
|
15
15
|
|
|
@@ -70,6 +70,12 @@ describe('Test SelectMonitorDevices', () => {
|
|
|
70
70
|
await act(async () => {
|
|
71
71
|
iconClose[0].props.onPress();
|
|
72
72
|
});
|
|
73
|
-
expect(global.mockedNavigate).toHaveBeenCalledWith('closeScreen'
|
|
73
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith('closeScreen', {
|
|
74
|
+
automate: { sensor_id: 1 },
|
|
75
|
+
automateId: null,
|
|
76
|
+
closeScreen: 'closeScreen',
|
|
77
|
+
scriptName: 'scriptName test',
|
|
78
|
+
unit: { id: 1, name: 'Unit test' },
|
|
79
|
+
});
|
|
74
80
|
});
|
|
75
81
|
});
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
+
import { useRoute } from '@react-navigation/native';
|
|
1
2
|
import React from 'react';
|
|
3
|
+
import { TouchableWithoutFeedback } from 'react-native';
|
|
2
4
|
import { act, create } from 'react-test-renderer';
|
|
3
|
-
import { SCProvider } from '../../../../context';
|
|
4
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
5
|
-
import SetupConfigCondition from '../SetupConfigCondition';
|
|
6
|
-
import { useRoute } from '@react-navigation/native';
|
|
7
|
-
import { ToastBottomHelper } from '../../../../utils/Utils';
|
|
8
5
|
import { Text } from '../../../../commons';
|
|
9
|
-
import GridItem from '../../../../commons/Grid/GridItem';
|
|
10
|
-
import { TouchableWithoutFeedback } from 'react-native';
|
|
11
|
-
import Routes from '../../../../utils/Route';
|
|
12
|
-
import { ModalCustom } from '../../../../commons/Modal';
|
|
13
6
|
import { showAllGridItems } from '../../../../commons/ActionTemplate/__test__/utils';
|
|
14
7
|
import TextInput from '../../../../commons/Form/TextInput';
|
|
15
|
-
import
|
|
8
|
+
import GridItem from '../../../../commons/Grid/GridItem';
|
|
9
|
+
import { ModalCustom } from '../../../../commons/Modal';
|
|
10
|
+
import { SCProvider } from '../../../../context';
|
|
11
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
12
|
+
import Routes from '../../../../utils/Route';
|
|
13
|
+
import { ToastBottomHelper } from '../../../../utils/Utils';
|
|
14
|
+
import SetupConfigCondition from '../SetupConfigCondition';
|
|
16
15
|
|
|
17
16
|
jest.mock('react', () => {
|
|
18
17
|
return {
|
|
@@ -214,8 +213,10 @@ describe('Test SetupConfigCondition', () => {
|
|
|
214
213
|
});
|
|
215
214
|
expect(modal.props.isVisible).toBeFalsy();
|
|
216
215
|
|
|
216
|
+
const modalGridItems = instance.findAllByType(GridItem);
|
|
217
|
+
|
|
217
218
|
await act(async () => {
|
|
218
|
-
|
|
219
|
+
modalGridItems[1].findByType(TouchableWithoutFeedback).props.onPress();
|
|
219
220
|
});
|
|
220
221
|
|
|
221
222
|
const input = instance.findByType(TextInput);
|
|
@@ -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 { TouchableWithoutFeedback } from 'react-native';
|
|
2
5
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import
|
|
6
|
+
import BottomButtonView from '../../../../commons/BottomButtonView';
|
|
7
|
+
import _TextInput from '../../../../commons/Form/TextInput';
|
|
8
|
+
import API from '../../../../configs/API';
|
|
4
9
|
import { SCProvider } from '../../../../context';
|
|
5
10
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
|
-
import API from '../../../../configs/API';
|
|
7
|
-
import Routes from '../../../../utils/Route';
|
|
8
11
|
import api from '../../../../utils/Apis/axios';
|
|
9
|
-
import
|
|
10
|
-
import _TextInput from '../../../../commons/Form/TextInput';
|
|
11
|
-
import BottomButtonView from '../../../../commons/BottomButtonView';
|
|
12
|
+
import Routes from '../../../../utils/Route';
|
|
12
13
|
import { ToastBottomHelper } from '../../../../utils/Utils';
|
|
13
14
|
import SetupScriptDelay from '../SetupScriptDelay';
|
|
14
|
-
import { TouchableWithoutFeedback } from 'react-native';
|
|
15
15
|
|
|
16
16
|
const mock = new MockAdapter(api.axiosInstance);
|
|
17
17
|
|
|
@@ -75,7 +75,7 @@ describe('Test SetupScriptDelay', () => {
|
|
|
75
75
|
await act(async () => {
|
|
76
76
|
button.props.onPressMain();
|
|
77
77
|
});
|
|
78
|
-
expect(spyToast).
|
|
78
|
+
expect(spyToast).toHaveBeenCalled();
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
it('SetupScriptDelay onPress create script notify error', async () => {
|
|
@@ -95,6 +95,6 @@ describe('Test SetupScriptDelay', () => {
|
|
|
95
95
|
await act(async () => {
|
|
96
96
|
button.props.onPressMain();
|
|
97
97
|
});
|
|
98
|
-
expect(spyToast).
|
|
98
|
+
expect(spyToast).toHaveBeenCalled();
|
|
99
99
|
});
|
|
100
100
|
});
|
|
@@ -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 { TouchableWithoutFeedback } from 'react-native';
|
|
2
5
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import
|
|
6
|
+
import BottomButtonView from '../../../../commons/BottomButtonView';
|
|
7
|
+
import _TextInput from '../../../../commons/Form/TextInput';
|
|
8
|
+
import API from '../../../../configs/API';
|
|
4
9
|
import { SCProvider } from '../../../../context';
|
|
5
10
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
|
-
import API from '../../../../configs/API';
|
|
7
|
-
import Routes from '../../../../utils/Route';
|
|
8
11
|
import api from '../../../../utils/Apis/axios';
|
|
9
|
-
import
|
|
10
|
-
import SetupScriptNotify from '../SetupScriptNotify';
|
|
11
|
-
import _TextInput from '../../../../commons/Form/TextInput';
|
|
12
|
-
import BottomButtonView from '../../../../commons/BottomButtonView';
|
|
12
|
+
import Routes from '../../../../utils/Route';
|
|
13
13
|
import { ToastBottomHelper } from '../../../../utils/Utils';
|
|
14
|
-
import
|
|
14
|
+
import SetupScriptNotify from '../SetupScriptNotify';
|
|
15
15
|
|
|
16
16
|
const mock = new MockAdapter(api.axiosInstance);
|
|
17
17
|
|
|
@@ -66,7 +66,7 @@ describe('Test SetupScriptNotify', () => {
|
|
|
66
66
|
await act(async () => {
|
|
67
67
|
button.props.onPressMain();
|
|
68
68
|
});
|
|
69
|
-
expect(spyToast).
|
|
69
|
+
expect(spyToast).toHaveBeenCalled();
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
it('SetupScriptNotify onPress create script notify error', async () => {
|
|
@@ -87,6 +87,6 @@ describe('Test SetupScriptNotify', () => {
|
|
|
87
87
|
await act(async () => {
|
|
88
88
|
button.props.onPressMain();
|
|
89
89
|
});
|
|
90
|
-
expect(spyToast).
|
|
90
|
+
expect(spyToast).toHaveBeenCalled();
|
|
91
91
|
});
|
|
92
92
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native';
|
|
1
2
|
import React, { useCallback, useState } from 'react';
|
|
2
3
|
import { View } from 'react-native';
|
|
3
|
-
import
|
|
4
|
+
import ItemAutomate from '../../../commons/Automate/ItemAutomate';
|
|
4
5
|
import { HeaderCustom } from '../../../commons/Header';
|
|
5
|
-
import styles from './styles/AddNewAutoSmartStyles';
|
|
6
6
|
import Text from '../../../commons/Text';
|
|
7
|
-
import ItemAutomate from '../../../commons/Automate/ItemAutomate';
|
|
8
7
|
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
9
8
|
import Routes from '../../../utils/Route';
|
|
9
|
+
import styles from './styles/AddNewAutoSmartStyles';
|
|
10
10
|
|
|
11
11
|
const AddTypeSmart = ({ smartTypes, route }) => {
|
|
12
12
|
const t = useTranslations();
|
|
@@ -27,6 +27,7 @@ const AddTypeSmart = ({ smartTypes, route }) => {
|
|
|
27
27
|
...automate,
|
|
28
28
|
type: dataAutomate?.type,
|
|
29
29
|
},
|
|
30
|
+
unitId: automate?.unit,
|
|
30
31
|
closeScreen: closeScreen,
|
|
31
32
|
};
|
|
32
33
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native';
|
|
1
2
|
import React from 'react';
|
|
3
|
+
import { TouchableOpacity } from 'react-native';
|
|
2
4
|
import { act, create } from 'react-test-renderer';
|
|
3
|
-
import
|
|
5
|
+
import ItemAutomate from '../../../../commons/Automate/ItemAutomate';
|
|
4
6
|
import { SCProvider } from '../../../../context';
|
|
5
7
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
|
-
import ItemAutomate from '../../../../commons/Automate/ItemAutomate';
|
|
7
8
|
import Routes from '../../../../utils/Route';
|
|
8
|
-
import
|
|
9
|
-
import { useNavigation } from '@react-navigation/native';
|
|
9
|
+
import AddUnknownTypeSmart from '../AddUnknownTypeSmart';
|
|
10
10
|
|
|
11
11
|
const wrapComponent = (route) => (
|
|
12
12
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -41,10 +41,14 @@ describe('test AddNewAutoSmart', () => {
|
|
|
41
41
|
await touchItem.props.onPress();
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
expect(global.mockedNavigate).
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
45
|
+
Routes.SelectMonitorDevices,
|
|
46
|
+
{
|
|
47
|
+
automate: { unit: 1, type: 'value_change' },
|
|
48
|
+
closeScreen: undefined,
|
|
49
|
+
unitId: 1,
|
|
50
|
+
}
|
|
51
|
+
);
|
|
48
52
|
});
|
|
49
53
|
|
|
50
54
|
it('test choose Schedule', async () => {
|
|
@@ -62,6 +66,7 @@ describe('test AddNewAutoSmart', () => {
|
|
|
62
66
|
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.SetSchedule, {
|
|
63
67
|
automate: { type: 'schedule', unit: 1 },
|
|
64
68
|
closeScreen: undefined,
|
|
69
|
+
unitId: 1,
|
|
65
70
|
});
|
|
66
71
|
});
|
|
67
72
|
});
|
|
@@ -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 { SCProvider } from '../../../../context';
|
|
6
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
7
5
|
import API from '../../../../configs/API';
|
|
8
6
|
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
7
|
+
import { SCProvider } from '../../../../context';
|
|
8
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
9
9
|
|
|
10
|
+
import { useRoute } from '@react-navigation/native';
|
|
11
|
+
import { TouchableOpacity } from 'react-native';
|
|
12
|
+
import { showAllCards } from '../../../../commons/ActionTemplate/__test__/utils';
|
|
10
13
|
import api from '../../../../utils/Apis/axios';
|
|
11
14
|
import { ToastBottomHelper } from '../../../../utils/Utils';
|
|
12
|
-
import UpdateActionScript from '../UpdateActionScript';
|
|
13
|
-
import { TouchableOpacity } from 'react-native';
|
|
14
|
-
import { useRoute } from '@react-navigation/native';
|
|
15
15
|
import RenderActionItem from '../../AddNewAction/RenderActionItem';
|
|
16
|
-
import
|
|
16
|
+
import UpdateActionScript from '../UpdateActionScript';
|
|
17
17
|
|
|
18
18
|
const mock = new MockAdapter(api.axiosInstance);
|
|
19
19
|
const mockedPermission = jest.fn();
|
|
@@ -152,6 +152,6 @@ describe('Test UpdateActionScript', () => {
|
|
|
152
152
|
await selectActionOne(instance);
|
|
153
153
|
await pressSaveButton(instance);
|
|
154
154
|
|
|
155
|
-
expect(spyToast).
|
|
155
|
+
expect(spyToast).toHaveBeenCalled();
|
|
156
156
|
});
|
|
157
157
|
});
|
|
@@ -1,15 +1,15 @@
|
|
|
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 { SCProvider } from '../../../../context';
|
|
6
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
7
5
|
import API from '../../../../configs/API';
|
|
8
6
|
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
7
|
+
import { SCProvider } from '../../../../context';
|
|
8
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
9
9
|
|
|
10
|
-
import api from '../../../../utils/Apis/axios';
|
|
11
|
-
import _TextInput from '../../../../commons/Form/TextInput';
|
|
12
10
|
import BottomButtonView from '../../../../commons/BottomButtonView';
|
|
11
|
+
import _TextInput from '../../../../commons/Form/TextInput';
|
|
12
|
+
import api from '../../../../utils/Apis/axios';
|
|
13
13
|
import { ToastBottomHelper } from '../../../../utils/Utils';
|
|
14
14
|
import UpdateDelayScript from '../UpdateDelayScript';
|
|
15
15
|
|
|
@@ -80,7 +80,7 @@ describe('Test UpdateDelayScript', () => {
|
|
|
80
80
|
await act(async () => {
|
|
81
81
|
button.props.onPressMain();
|
|
82
82
|
});
|
|
83
|
-
expect(spyToast).
|
|
83
|
+
expect(spyToast).toHaveBeenCalled();
|
|
84
84
|
});
|
|
85
85
|
it('test can not update title and message', async () => {
|
|
86
86
|
await act(async () => {
|
|
@@ -1,17 +1,17 @@
|
|
|
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 { SCProvider } from '../../../../context';
|
|
6
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
7
5
|
import API from '../../../../configs/API';
|
|
8
6
|
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
7
|
+
import { SCProvider } from '../../../../context';
|
|
8
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
9
9
|
|
|
10
|
-
import api from '../../../../utils/Apis/axios';
|
|
11
|
-
import UpdateNotifyScript from '../UpdateNotifyScript';
|
|
12
|
-
import _TextInput from '../../../../commons/Form/TextInput';
|
|
13
10
|
import BottomButtonView from '../../../../commons/BottomButtonView';
|
|
11
|
+
import _TextInput from '../../../../commons/Form/TextInput';
|
|
12
|
+
import api from '../../../../utils/Apis/axios';
|
|
14
13
|
import { ToastBottomHelper } from '../../../../utils/Utils';
|
|
14
|
+
import UpdateNotifyScript from '../UpdateNotifyScript';
|
|
15
15
|
|
|
16
16
|
const mock = new MockAdapter(api.axiosInstance);
|
|
17
17
|
const mockerOnClosePopup = jest.fn();
|
|
@@ -89,7 +89,7 @@ describe('Test UpdateNotifyScript', () => {
|
|
|
89
89
|
await act(async () => {
|
|
90
90
|
button.props.onPressMain();
|
|
91
91
|
});
|
|
92
|
-
expect(spyToast).
|
|
92
|
+
expect(spyToast).toHaveBeenCalled();
|
|
93
93
|
// expect(global.mockedNavigate).toHaveBeenCalledWith('closeScreen');
|
|
94
94
|
});
|
|
95
95
|
it('test can not update title and message', async () => {
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import React, { useState, useCallback, useMemo, useEffect } from 'react';
|
|
2
|
-
import { View, TouchableOpacity } from 'react-native';
|
|
3
|
-
import DraggableFlatList from 'react-native-draggable-flatlist';
|
|
4
1
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
4
|
+
import DraggableFlatList from 'react-native-draggable-flatlist';
|
|
5
5
|
import ParsedText from 'react-native-parsed-text';
|
|
6
6
|
|
|
7
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
8
|
+
import Close from '../../../../assets/images/Close.svg';
|
|
9
|
+
import Delay from '../../../../assets/images/Delay.svg';
|
|
10
|
+
import Notify from '../../../../assets/images/Notify.svg';
|
|
11
|
+
import Rearrange from '../../../../assets/images/Rearrange.svg';
|
|
12
|
+
import { FullLoading } from '../../../commons';
|
|
13
|
+
import FImage from '../../../commons/FImage';
|
|
7
14
|
import { HeaderCustom } from '../../../commons/Header';
|
|
8
|
-
import {
|
|
15
|
+
import { ModalBottom, ModalCustom } from '../../../commons/Modal';
|
|
9
16
|
import Text from '../../../commons/Text';
|
|
10
|
-
import styles from './Styles/indexStyles';
|
|
11
17
|
import { API, Colors } from '../../../configs';
|
|
12
|
-
import FImage from '../../../commons/FImage';
|
|
13
|
-
import Rearrange from '../../../../assets/images/Rearrange.svg';
|
|
14
|
-
import Notify from '../../../../assets/images/Notify.svg';
|
|
15
|
-
import Delay from '../../../../assets/images/Delay.svg';
|
|
16
|
-
import Close from '../../../../assets/images/Close.svg';
|
|
17
|
-
import { axiosDelete, axiosPut } from '../../../utils/Apis/axios';
|
|
18
|
-
import { ModalBottom, ModalCustom } from '../../../commons/Modal';
|
|
19
|
-
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
20
18
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
19
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
20
|
+
import { axiosDelete, axiosPut } from '../../../utils/Apis/axios';
|
|
21
21
|
import Routes from '../../../utils/Route';
|
|
22
|
+
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
23
|
+
import styles from './Styles/indexStyles';
|
|
22
24
|
import UpdateDelayScript from './UpdateDelayScript';
|
|
23
25
|
import UpdateNotifyScript from './UpdateNotifyScript';
|
|
24
|
-
import { FullLoading } from '../../../commons';
|
|
25
26
|
|
|
26
27
|
const EditActionsList = () => {
|
|
27
28
|
const t = useTranslations();
|
|
@@ -134,7 +135,8 @@ const EditActionsList = () => {
|
|
|
134
135
|
</View>
|
|
135
136
|
);
|
|
136
137
|
const renderItem = useCallback(
|
|
137
|
-
({ item,
|
|
138
|
+
({ item, getIndex, drag, isActive }) => {
|
|
139
|
+
const index = getIndex();
|
|
138
140
|
const paddedIndex = (index + 1).toString().padStart(2, '0');
|
|
139
141
|
const { action_script, notify_script, delay_script } = item;
|
|
140
142
|
if (action_script) {
|
|
@@ -354,7 +356,7 @@ const EditActionsList = () => {
|
|
|
354
356
|
}, [itemRemove, t]);
|
|
355
357
|
|
|
356
358
|
return (
|
|
357
|
-
<
|
|
359
|
+
<GestureHandlerRootView style={styles.wrap}>
|
|
358
360
|
<HeaderCustom title={t('edit_actions_list')} onGoBack={onCancel} />
|
|
359
361
|
<View style={styles.wrapContent}>
|
|
360
362
|
<Text type="Body" color={Colors.Gray8}>
|
|
@@ -393,7 +395,7 @@ const EditActionsList = () => {
|
|
|
393
395
|
<View style={styles.modalHeader}>{renderAction}</View>
|
|
394
396
|
</View>
|
|
395
397
|
</ModalCustom>
|
|
396
|
-
</
|
|
398
|
+
</GestureHandlerRootView>
|
|
397
399
|
);
|
|
398
400
|
};
|
|
399
401
|
|