@eohjsc/react-native-smart-city 0.7.3-rc7 → 0.7.3-rc9
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 +4 -4
- 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/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/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/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/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/__test__/ShortDetail.test.js +8 -8
- package/src/commons/Widgets/IFrame/__tests__/IFrame.test.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/iot/RemoteControl/__test__/Internet.test.js +7 -7
- package/src/screens/AddLocationMaps/__test__/index.test.js +12 -12
- 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/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/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/Automate/AddNewAction/__test__/ChooseAction.test.js +3 -3
- 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/__test__/AddNewAutoSmart.test.js +11 -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/OneTap/__test__/AddNewOneTap.test.js +6 -6
- package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +6 -6
- 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 +10 -10
- package/src/screens/ChangePosition/__test__/index.test.js +6 -6
- 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/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/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/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/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 +10 -0
- 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 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,13 @@ 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
|
+
}
|
|
50
|
+
);
|
|
48
51
|
});
|
|
49
52
|
|
|
50
53
|
it('test choose Schedule', async () => {
|
|
@@ -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,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 () => {
|
|
@@ -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 () => {
|
|
@@ -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
|
});
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native';
|
|
2
|
+
import moment from 'moment';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { act, create } from 'react-test-renderer';
|
|
5
|
+
import BottomButtonView from '../../../../commons/BottomButtonView';
|
|
6
|
+
import Calendar from '../../../../commons/Calendar';
|
|
7
|
+
import WheelDateTimePicker from '../../../../commons/WheelDateTimePicker';
|
|
8
|
+
import AccessibilityLabel from '../../../../configs/AccessibilityLabel';
|
|
3
9
|
import { SCProvider } from '../../../../context';
|
|
4
10
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
5
|
-
import
|
|
6
|
-
import RowItem from '../components/RowItem';
|
|
7
|
-
import WheelDateTimePicker from '../../../../commons/WheelDateTimePicker';
|
|
11
|
+
import Routes from '../../../../utils/Route';
|
|
8
12
|
import RepeatOptionsPopup, {
|
|
9
13
|
REPEAT_OPTIONS,
|
|
10
14
|
} from '../components/RepeatOptionsPopup';
|
|
11
|
-
import
|
|
12
|
-
import BottomButtonView from '../../../../commons/BottomButtonView';
|
|
13
|
-
import Routes from '../../../../utils/Route';
|
|
15
|
+
import RowItem from '../components/RowItem';
|
|
14
16
|
import SelectWeekday from '../components/SelectWeekday';
|
|
15
|
-
import
|
|
16
|
-
import { useNavigation } from '@react-navigation/native';
|
|
17
|
-
import AccessibilityLabel from '../../../../configs/AccessibilityLabel';
|
|
17
|
+
import SetSchedule from '../index';
|
|
18
18
|
|
|
19
19
|
const wrapComponent = (route) => (
|
|
20
20
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -70,7 +70,7 @@ describe('Test SetSchedule', () => {
|
|
|
70
70
|
await act(async () => {
|
|
71
71
|
await header.props.onPress();
|
|
72
72
|
});
|
|
73
|
-
expect(global.mockedNavigate).
|
|
73
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(undefined);
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
it('test repeat options popup', async () => {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { act, create } from 'react-test-renderer';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
1
|
import { useRoute } from '@react-navigation/native';
|
|
2
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
3
|
+
import React from 'react';
|
|
5
4
|
import DraggableFlatList from 'react-native-draggable-flatlist';
|
|
5
|
+
import { act, create } from 'react-test-renderer';
|
|
6
6
|
|
|
7
7
|
import ChangePosition from '../';
|
|
8
|
+
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
9
|
+
import { API } from '../../../configs';
|
|
8
10
|
import { SCProvider } from '../../../context';
|
|
9
11
|
import { mockSCStore } from '../../../context/mockStore';
|
|
10
12
|
import api from '../../../utils/Apis/axios';
|
|
11
|
-
import { API } from '../../../configs';
|
|
12
13
|
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
13
|
-
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
14
14
|
|
|
15
15
|
const mock = new MockAdapter(api.axiosInstance);
|
|
16
16
|
const mockSetDisplay = jest.fn();
|
|
@@ -60,6 +60,6 @@ describe('Test ChangePosition', () => {
|
|
|
60
60
|
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
61
61
|
expect(mockFetchData).toHaveBeenCalled();
|
|
62
62
|
expect(mockSetDisplay).toHaveBeenCalled();
|
|
63
|
-
expect(spyToastSuccess).
|
|
63
|
+
expect(spyToastSuccess).toHaveBeenCalledWith('Updated widget successfully');
|
|
64
64
|
});
|
|
65
65
|
});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { TouchableOpacity } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
+
import { act, create } from 'react-test-renderer';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
6
|
+
import { useRoute } from '@react-navigation/native';
|
|
7
|
+
import Toast from 'react-native-toast-message';
|
|
8
8
|
import EditDevice from '..';
|
|
9
9
|
import AlertAction from '../../../../commons/AlertAction';
|
|
10
10
|
import _TextInput from '../../../../commons/Form/TextInput';
|
|
11
|
-
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
12
11
|
import { API } from '../../../../configs';
|
|
13
|
-
import {
|
|
12
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
13
|
+
import { SCProvider } from '../../../../context';
|
|
14
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
14
15
|
import api from '../../../../utils/Apis/axios';
|
|
15
|
-
import Toast from 'react-native-toast-message';
|
|
16
16
|
import { getTranslate } from '../../../../utils/I18n';
|
|
17
17
|
|
|
18
18
|
const wrapComponent = (route) => (
|
|
@@ -96,7 +96,7 @@ describe('Test EditDevice', () => {
|
|
|
96
96
|
await act(async () => {
|
|
97
97
|
await alertAction.props.rightButtonClick();
|
|
98
98
|
});
|
|
99
|
-
expect(Toast.show).
|
|
99
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
100
100
|
type: 'error',
|
|
101
101
|
position: 'bottom',
|
|
102
102
|
text1: getTranslate('en', 'rename_failed'),
|
|
@@ -148,7 +148,7 @@ describe('Test EditDevice', () => {
|
|
|
148
148
|
await act(async () => {
|
|
149
149
|
await alertAction.props.rightButtonClick();
|
|
150
150
|
});
|
|
151
|
-
expect(Toast.show).
|
|
151
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
152
152
|
type: 'error',
|
|
153
153
|
position: 'bottom',
|
|
154
154
|
text1: getTranslate('en', 'remove_failed'),
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
+
import { NavigationContext, useNavigation } from '@react-navigation/native';
|
|
2
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { Alert, ScrollView } from 'react-native';
|
|
3
5
|
import { act, create } from 'react-test-renderer';
|
|
4
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
5
|
-
import { NavigationContext, useNavigation } from '@react-navigation/native';
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
7
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
8
|
+
import { AlertAction, ButtonPopup, MenuActionMore } from '../../../commons';
|
|
9
|
+
import CurrentRainSensor from '../../../commons/Device/RainningSensor/CurrentRainSensor';
|
|
9
10
|
import { AlertSendConfirm } from '../../../commons/EmergencyButton/AlertSendConfirm';
|
|
10
11
|
import { AlertSent } from '../../../commons/EmergencyButton/AlertSent';
|
|
11
|
-
import { AlertAction, ButtonPopup, MenuActionMore } from '../../../commons';
|
|
12
|
-
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
13
12
|
import Text from '../../../commons/Text';
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { getTranslate } from '../../../utils/I18n';
|
|
13
|
+
import { API } from '../../../configs';
|
|
14
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
17
15
|
import { SCProvider } from '../../../context';
|
|
18
16
|
import { mockSCStore } from '../../../context/mockStore';
|
|
19
|
-
import Routes from '../../../utils/Route';
|
|
20
|
-
import api from '../../../utils/Apis/axios';
|
|
21
17
|
import { useWatchConfigs } from '../../../hooks/IoT';
|
|
18
|
+
import api from '../../../utils/Apis/axios';
|
|
19
|
+
import { getTranslate } from '../../../utils/I18n';
|
|
20
|
+
import Routes from '../../../utils/Route';
|
|
21
|
+
import DeviceDetail from '../detail';
|
|
22
22
|
|
|
23
23
|
const mock = new MockAdapter(api.axiosInstance);
|
|
24
24
|
|
|
@@ -755,7 +755,7 @@ describe('test DeviceDetail', () => {
|
|
|
755
755
|
await act(async () => {
|
|
756
756
|
await create(wrapComponent(store, account, route));
|
|
757
757
|
});
|
|
758
|
-
expect(mockAlertShow).not.
|
|
758
|
+
expect(mockAlertShow).not.toHaveBeenCalled();
|
|
759
759
|
});
|
|
760
760
|
|
|
761
761
|
it('Test fetchUnitDetail', async () => {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
+
import { NavigationContext } from '@react-navigation/native';
|
|
2
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
3
|
+
import mqtt from 'precompiled-mqtt/dist/mqtt.browser';
|
|
1
4
|
import React from 'react';
|
|
2
5
|
import { Alert } from 'react-native';
|
|
3
6
|
import { act, create } from 'react-test-renderer';
|
|
4
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
5
|
-
import mqtt from 'precompiled-mqtt/dist/mqtt.browser';
|
|
6
|
-
import { NavigationContext } from '@react-navigation/native';
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import QualityIndicatorItem from '../../../commons/Device/WaterQualitySensor/QualityIndicatorsItem';
|
|
9
9
|
import { API } from '../../../configs';
|
|
10
10
|
import { SCProvider } from '../../../context';
|
|
11
11
|
import { mockSCStore } from '../../../context/mockStore';
|
|
12
|
+
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
13
|
+
import { setConfigGlobalState } from '../../../iot/states';
|
|
12
14
|
import api from '../../../utils/Apis/axios';
|
|
13
15
|
import {
|
|
14
|
-
gatewayDataFactory,
|
|
15
16
|
configDataFactory,
|
|
17
|
+
gatewayDataFactory,
|
|
16
18
|
} from '../../../utils/FactoryGateway';
|
|
17
|
-
import
|
|
18
|
-
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
19
|
-
import { setConfigGlobalState } from '../../../iot/states';
|
|
19
|
+
import DeviceDetail from '../detail';
|
|
20
20
|
|
|
21
21
|
const mock = new MockAdapter(api.axiosInstance);
|
|
22
22
|
|
|
@@ -194,7 +194,7 @@ describe('test DeviceDetail', () => {
|
|
|
194
194
|
await act(async () => {
|
|
195
195
|
tree.unmount();
|
|
196
196
|
});
|
|
197
|
-
expect(client.end).
|
|
197
|
+
expect(client.end).toHaveBeenCalled();
|
|
198
198
|
});
|
|
199
199
|
|
|
200
200
|
const _receiveDataOnDeviceDetail = async (widgetConfigs, topic, message) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import renderer, { act } from 'react-test-renderer';
|
|
3
4
|
import AccessibilityLabel from '../../configs/AccessibilityLabel';
|
|
4
5
|
import { SCProvider } from '../../context';
|
|
5
6
|
import { mockSCStore } from '../../context/mockStore';
|
|
6
7
|
import Drawer, { Row } from './index';
|
|
7
|
-
import { useNavigation } from '@react-navigation/native';
|
|
8
8
|
|
|
9
9
|
const wrapComponent = (initState = mockSCStore({})) => (
|
|
10
10
|
<SCProvider initState={initState}>
|
|
@@ -35,7 +35,7 @@ describe('Drawer', () => {
|
|
|
35
35
|
await act(async () => {
|
|
36
36
|
await rows[2].props.onPress();
|
|
37
37
|
});
|
|
38
|
-
expect(dispatch).
|
|
38
|
+
expect(dispatch).toHaveBeenCalledWith({
|
|
39
39
|
payload: { index: 0, routes: [{ name: 'Main' }] },
|
|
40
40
|
type: 'RESET',
|
|
41
41
|
});
|