@eohjsc/react-native-smart-city 0.7.3-rc0 → 0.7.3-rc10
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 +5 -5
- 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 +8 -8
- 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/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/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/GroupCheckBox/__test__/GroupCheckBox.test.js +3 -3
- package/src/commons/Header/__test__/HeaderCT.test.js +3 -3
- package/src/commons/IconComponent/index.js +1 -1
- 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 +5 -5
- 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/__test__/ChooseAction.test.js +13 -13
- 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__/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/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 +1 -2
- 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/__test__/Utils.test.js +16 -16
|
@@ -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
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import MockAdapter from 'axios-mock-adapter';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { Platform, TextInput, TouchableOpacity } from 'react-native';
|
|
4
4
|
import { act, create } from 'react-test-renderer';
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
7
|
+
import { API } from '../../../../configs';
|
|
7
8
|
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
8
9
|
import { SCProvider } from '../../../../context';
|
|
9
10
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
10
|
-
import Routes from '../../../../utils/Route';
|
|
11
11
|
import api from '../../../../utils/Apis/axios';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import Routes from '../../../../utils/Route';
|
|
13
|
+
import AddNewOneTap from '../index';
|
|
14
14
|
|
|
15
15
|
const wrapComponent = (route) => {
|
|
16
16
|
useRoute.mockReturnValue(route);
|
|
@@ -114,7 +114,7 @@ describe('test OneTap', () => {
|
|
|
114
114
|
await act(async () => {
|
|
115
115
|
await item[0].props.onPress();
|
|
116
116
|
});
|
|
117
|
-
expect(global.mockedNavigate).not.
|
|
117
|
+
expect(global.mockedNavigate).not.toHaveBeenCalled();
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
it('test onClose have automateId', async () => {
|
|
@@ -122,8 +122,13 @@ describe('test OneTap', () => {
|
|
|
122
122
|
let route = {
|
|
123
123
|
params: {
|
|
124
124
|
closeScreen: Routes.ScriptDetail,
|
|
125
|
+
automate: {
|
|
126
|
+
unit: 1,
|
|
127
|
+
},
|
|
128
|
+
unitId: 1,
|
|
125
129
|
},
|
|
126
130
|
};
|
|
131
|
+
|
|
127
132
|
mock.onPost(API.AUTOMATE.CREATE_AUTOMATE()).reply(400);
|
|
128
133
|
await act(async () => {
|
|
129
134
|
tree = await create(wrapComponent(route));
|
|
@@ -136,6 +141,10 @@ describe('test OneTap', () => {
|
|
|
136
141
|
await act(async () => {
|
|
137
142
|
header.props.onPress();
|
|
138
143
|
});
|
|
139
|
-
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail
|
|
144
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail, {
|
|
145
|
+
unitId: 1,
|
|
146
|
+
automate: { unit: 1 },
|
|
147
|
+
closeScreen: Routes.ScriptDetail,
|
|
148
|
+
});
|
|
140
149
|
});
|
|
141
150
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import MockAdapter from 'axios-mock-adapter';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { Platform, TextInput, TouchableOpacity } from 'react-native';
|
|
4
4
|
import { act, create } from 'react-test-renderer';
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
7
|
+
import { API } from '../../../../configs';
|
|
7
8
|
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
8
9
|
import { SCProvider } from '../../../../context';
|
|
9
10
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
10
|
-
import Routes from '../../../../utils/Route';
|
|
11
11
|
import api from '../../../../utils/Apis/axios';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import Routes from '../../../../utils/Route';
|
|
13
|
+
import ScenarioName from '../ScenarioName';
|
|
14
14
|
|
|
15
15
|
const wrapComponent = (route) => {
|
|
16
16
|
useRoute.mockReturnValue(route);
|
|
@@ -103,7 +103,7 @@ describe('test OneTap', () => {
|
|
|
103
103
|
await act(async () => {
|
|
104
104
|
await item[0].props.onPress();
|
|
105
105
|
});
|
|
106
|
-
expect(global.mockedNavigate).not.
|
|
106
|
+
expect(global.mockedNavigate).not.toHaveBeenCalled();
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
it('test onClose have automateId', async () => {
|
|
@@ -111,6 +111,10 @@ describe('test OneTap', () => {
|
|
|
111
111
|
let route = {
|
|
112
112
|
params: {
|
|
113
113
|
closeScreen: Routes.ScriptDetail,
|
|
114
|
+
automate: {
|
|
115
|
+
unit: 1,
|
|
116
|
+
},
|
|
117
|
+
unitId: 1,
|
|
114
118
|
},
|
|
115
119
|
};
|
|
116
120
|
mock.onPost(API.AUTOMATE.CREATE_AUTOMATE()).reply(400);
|
|
@@ -125,6 +129,10 @@ describe('test OneTap', () => {
|
|
|
125
129
|
await act(async () => {
|
|
126
130
|
header.props.onPress();
|
|
127
131
|
});
|
|
128
|
-
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail
|
|
132
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail, {
|
|
133
|
+
unitId: 1,
|
|
134
|
+
automate: { unit: 1 },
|
|
135
|
+
closeScreen: 'ScriptDetail',
|
|
136
|
+
});
|
|
129
137
|
});
|
|
130
138
|
});
|
|
@@ -14,14 +14,11 @@ const RenameScript = ({ automate, setAutomate, isVisible, setIsVisible }) => {
|
|
|
14
14
|
const transY = useKeyboardAnimated();
|
|
15
15
|
|
|
16
16
|
const renameScript = useCallback(async () => {
|
|
17
|
-
const { success
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
name: inputName,
|
|
21
|
-
}
|
|
22
|
-
);
|
|
17
|
+
const { success } = await axiosPatch(API.AUTOMATE.SCRIPT(automate.id), {
|
|
18
|
+
name: inputName,
|
|
19
|
+
});
|
|
23
20
|
if (success) {
|
|
24
|
-
setAutomate((prev) => ({ ...prev, name:
|
|
21
|
+
setAutomate((prev) => ({ ...prev, name: inputName }));
|
|
25
22
|
ToastBottomHelper.success(t('rename_successfully'));
|
|
26
23
|
} else {
|
|
27
24
|
ToastBottomHelper.error(t('rename_failed'));
|
|
@@ -344,7 +344,7 @@ describe('Test ScriptDetail', () => {
|
|
|
344
344
|
const instance = tree.root;
|
|
345
345
|
const switchButton = instance.findByType(Switch);
|
|
346
346
|
await act(async () => {
|
|
347
|
-
await switchButton.props.
|
|
347
|
+
await switchButton.props.onValueChange(false);
|
|
348
348
|
});
|
|
349
349
|
const buttonAddScript = instance.findAll(
|
|
350
350
|
(el) =>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { act, renderHook } from '@testing-library/react-hooks';
|
|
3
|
-
import { SCProvider } from '../../../../context';
|
|
4
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
5
|
-
import { useStarredScript } from '../hooks/useStarredScript';
|
|
6
2
|
import MockAdapter from 'axios-mock-adapter';
|
|
7
|
-
import
|
|
3
|
+
import React from 'react';
|
|
8
4
|
import { API } from '../../../../configs';
|
|
5
|
+
import { SCProvider } from '../../../../context';
|
|
9
6
|
import { Action } from '../../../../context/actionType';
|
|
7
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
8
|
+
import api from '../../../../utils/Apis/axios';
|
|
9
|
+
import { useStarredScript } from '../hooks/useStarredScript';
|
|
10
10
|
|
|
11
11
|
const mockedSetAction = jest.fn();
|
|
12
12
|
const mock = new MockAdapter(api.axiosInstance);
|
|
@@ -42,6 +42,6 @@ describe('Test useStarredScript', () => {
|
|
|
42
42
|
await act(async () => {
|
|
43
43
|
await result.current.unstarScript();
|
|
44
44
|
});
|
|
45
|
-
expect(mockedSetAction).
|
|
45
|
+
expect(mockedSetAction).toHaveBeenCalledWith(Action.UNSTAR_SCRIPTS, [2]);
|
|
46
46
|
});
|
|
47
47
|
});
|
|
@@ -5,35 +5,35 @@ import React, {
|
|
|
5
5
|
useRef,
|
|
6
6
|
useState,
|
|
7
7
|
} from 'react';
|
|
8
|
-
import { Image, Platform, TouchableOpacity, View
|
|
8
|
+
import { Image, Platform, Switch, TouchableOpacity, View } from 'react-native';
|
|
9
9
|
import { PopoverMode } from 'react-native-popover-view';
|
|
10
10
|
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
11
11
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
12
12
|
|
|
13
|
-
import {
|
|
14
|
-
import styles from './Styles/indexStyles';
|
|
15
|
-
import Text from '../../../commons/Text';
|
|
16
|
-
import WrapHeaderScrollable from '../../../commons/Sharing/WrapHeaderScrollable';
|
|
17
|
-
import { API, Colors } from '../../../configs';
|
|
18
|
-
import { usePopover } from '../../../hooks/Common';
|
|
19
|
-
import { useStarredScript } from './hooks/useStarredScript';
|
|
20
|
-
import MenuActionMore from '../../../commons/MenuActionMore';
|
|
13
|
+
import { useIsFocused, useNavigation } from '@react-navigation/native';
|
|
21
14
|
import Add from '../../../../assets/images/Add.svg';
|
|
22
|
-
import Notify from '../../../../assets/images/Notify.svg';
|
|
23
15
|
import Delay from '../../../../assets/images/Delay.svg';
|
|
24
|
-
import
|
|
25
|
-
import { axiosGet, axiosPost } from '../../../utils/Apis/axios';
|
|
26
|
-
import Routes from '../../../utils/Route';
|
|
27
|
-
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
16
|
+
import Notify from '../../../../assets/images/Notify.svg';
|
|
28
17
|
import ItemAutomate from '../../../commons/Automate/ItemAutomate';
|
|
18
|
+
import IconComponent from '../../../commons/IconComponent';
|
|
19
|
+
import MenuActionMore from '../../../commons/MenuActionMore';
|
|
20
|
+
import WrapHeaderScrollable from '../../../commons/Sharing/WrapHeaderScrollable';
|
|
21
|
+
import Text from '../../../commons/Text';
|
|
29
22
|
import withPreventDoubleClick from '../../../commons/WithPreventDoubleClick';
|
|
23
|
+
import { API, Colors } from '../../../configs';
|
|
30
24
|
import { AccessibilityLabel, AUTOMATE_TYPE } from '../../../configs/Constants';
|
|
31
|
-
import RenameScript from './Components/RenameScript';
|
|
32
|
-
import DeleteScript from './Components/DeleteScript';
|
|
33
25
|
import Images from '../../../configs/Images';
|
|
26
|
+
import { usePopover } from '../../../hooks/Common';
|
|
27
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
28
|
+
import { axiosGet, axiosPost } from '../../../utils/Apis/axios';
|
|
34
29
|
import { useBackendPermission } from '../../../utils/Permission/backend';
|
|
35
|
-
import
|
|
30
|
+
import Routes from '../../../utils/Route';
|
|
31
|
+
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
36
32
|
import AddActionScript from './Components/AddActionScript';
|
|
33
|
+
import DeleteScript from './Components/DeleteScript';
|
|
34
|
+
import RenameScript from './Components/RenameScript';
|
|
35
|
+
import { useStarredScript } from './hooks/useStarredScript';
|
|
36
|
+
import styles from './Styles/indexStyles';
|
|
37
37
|
|
|
38
38
|
const PreventDoubleTouch = withPreventDoubleClick(TouchableOpacity);
|
|
39
39
|
|
|
@@ -228,7 +228,7 @@ const ScriptDetail = ({ route }) => {
|
|
|
228
228
|
<Text type="H3" semibold>
|
|
229
229
|
{t('enable_this_script')}
|
|
230
230
|
</Text>
|
|
231
|
-
<Switch
|
|
231
|
+
<Switch value={enableScript} onValueChange={onChangeSwitch} />
|
|
232
232
|
</View>
|
|
233
233
|
)}
|
|
234
234
|
<Text type="H3" semibold>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
import { act, create } from 'react-test-renderer';
|
|
3
4
|
import { SCProvider } from '../../../../context';
|
|
4
5
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
5
|
-
import { TouchableOpacity } from 'react-native';
|
|
6
6
|
import SelectWeekday from '../components/SelectWeekday';
|
|
7
7
|
|
|
8
8
|
const wrapComponent = (props) => (
|
|
@@ -28,7 +28,7 @@ it('test select', async () => {
|
|
|
28
28
|
await act(async () => {
|
|
29
29
|
await items[0].props.onPress();
|
|
30
30
|
});
|
|
31
|
-
expect(mockSetWeekday).
|
|
31
|
+
expect(mockSetWeekday).toHaveBeenCalledWith(['1']);
|
|
32
32
|
|
|
33
33
|
mockSetWeekday.mockClear();
|
|
34
34
|
props = {
|
|
@@ -44,5 +44,5 @@ it('test select', async () => {
|
|
|
44
44
|
await act(async () => {
|
|
45
45
|
await items[0].props.onPress();
|
|
46
46
|
});
|
|
47
|
-
expect(mockSetWeekday).
|
|
47
|
+
expect(mockSetWeekday).toHaveBeenCalledWith(['0', '1']);
|
|
48
48
|
});
|