@eohjsc/react-native-smart-city 0.7.3-rc7 → 0.7.3-rc8
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 +3 -3
- 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,16 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { act, create } from 'react-test-renderer';
|
|
3
1
|
import MockAdapter from 'axios-mock-adapter';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import Toast from 'react-native-toast-message';
|
|
4
|
+
import { act, create } from 'react-test-renderer';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ViewButtonBottom } from '../../../commons';
|
|
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 { API } from '../../../configs';
|
|
11
|
-
import { ViewButtonBottom } from '../../../commons';
|
|
12
11
|
import api from '../../../utils/Apis/axios';
|
|
13
12
|
import { getTranslate } from '../../../utils/I18n';
|
|
13
|
+
import { EmergencyContactsSelectContacts } from '../EmergencyContactsSelectContacts';
|
|
14
14
|
|
|
15
15
|
const mock = new MockAdapter(api.axiosInstance);
|
|
16
16
|
|
|
@@ -79,7 +79,7 @@ describe('test EmergencyContactsSelectContacts', () => {
|
|
|
79
79
|
await act(async () => {
|
|
80
80
|
viewButtonBottom.props.onRightClick();
|
|
81
81
|
});
|
|
82
|
-
expect(Toast.show).
|
|
82
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
83
83
|
type: 'success',
|
|
84
84
|
position: 'bottom',
|
|
85
85
|
text1: getTranslate('en', 'saving_contact_successful'),
|
|
@@ -98,7 +98,7 @@ describe('test EmergencyContactsSelectContacts', () => {
|
|
|
98
98
|
await act(async () => {
|
|
99
99
|
viewButtonBottom.props.onRightClick();
|
|
100
100
|
});
|
|
101
|
-
expect(Toast.show).
|
|
101
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
102
102
|
type: 'error',
|
|
103
103
|
position: 'bottom',
|
|
104
104
|
text1: getTranslate('en', 'create_contact_failed'),
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
3
|
import { TouchableOpacity } from 'react-native';
|
|
4
|
-
import
|
|
4
|
+
import { act, create } from 'react-test-renderer';
|
|
5
5
|
|
|
6
|
+
import { useNavigation } from '@react-navigation/native';
|
|
7
|
+
import { API } from '../../../configs';
|
|
8
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
6
9
|
import { SCProvider } from '../../../context';
|
|
7
10
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
|
-
import EnterPassword from '../index';
|
|
9
|
-
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
10
|
-
import { API } from '../../../configs';
|
|
11
11
|
import api from '../../../utils/Apis/axios';
|
|
12
|
-
import
|
|
12
|
+
import EnterPassword from '../index';
|
|
13
13
|
|
|
14
14
|
const mock = new MockAdapter(api.axiosInstance);
|
|
15
15
|
|
|
@@ -103,7 +103,7 @@ describe('Test EnterPassword', () => {
|
|
|
103
103
|
await act(async () => {
|
|
104
104
|
await button[0].props.onPress();
|
|
105
105
|
});
|
|
106
|
-
expect(navigate).
|
|
106
|
+
expect(navigate).toHaveBeenCalled();
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
it('test EnterPassword button failure', async () => {
|
|
@@ -125,6 +125,6 @@ describe('Test EnterPassword', () => {
|
|
|
125
125
|
await act(async () => {
|
|
126
126
|
await button[0].props.onPress();
|
|
127
127
|
});
|
|
128
|
-
expect(navigate).not.
|
|
128
|
+
expect(navigate).not.toHaveBeenCalled();
|
|
129
129
|
});
|
|
130
130
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { act, create } from 'react-test-renderer';
|
|
3
3
|
|
|
4
|
+
import BottomSheet from '../../../../commons/BottomSheet';
|
|
4
5
|
import { SCProvider } from '../../../../context';
|
|
5
6
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
7
|
import AccessScheduleSheet from '../AccessScheduleSheet';
|
|
7
|
-
import BottomSheet from '../../../../commons/BottomSheet';
|
|
8
8
|
|
|
9
9
|
const wrapComponent = (props) => (
|
|
10
10
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -47,6 +47,6 @@ describe('AccessScheduleSheet', () => {
|
|
|
47
47
|
await act(async () => {
|
|
48
48
|
bottomSheet[0].props.onBackdropPress();
|
|
49
49
|
});
|
|
50
|
-
expect(mockOnHide).
|
|
50
|
+
expect(mockOnHide).toHaveBeenCalled();
|
|
51
51
|
});
|
|
52
52
|
});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { FlatList } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
+
import { act, create } from 'react-test-renderer';
|
|
5
5
|
|
|
6
|
+
import moment from 'moment';
|
|
7
|
+
import { MenuActionMore } from '../../../commons';
|
|
8
|
+
import Calendar from '../../../commons/Calendar';
|
|
9
|
+
import { API } from '../../../configs';
|
|
10
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
6
11
|
import { SCProvider } from '../../../context';
|
|
7
12
|
import { mockSCStore } from '../../../context/mockStore';
|
|
13
|
+
import api from '../../../utils/Apis/axios';
|
|
8
14
|
import HanetCameraDetail from '../Detail';
|
|
9
15
|
import CheckinHeader from '../components/CheckinHeader';
|
|
10
|
-
import moment from 'moment';
|
|
11
|
-
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
12
|
-
import Calendar from '../../../commons/Calendar';
|
|
13
|
-
import api from '../../../utils/Apis/axios';
|
|
14
|
-
import { API } from '../../../configs';
|
|
15
|
-
import { MenuActionMore } from '../../../commons';
|
|
16
16
|
|
|
17
17
|
const wrapComponent = (route) => (
|
|
18
18
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -103,7 +103,7 @@ describe('Test HanetCameraDetail', () => {
|
|
|
103
103
|
expect(textCountStranger.props.children).toBe(1);
|
|
104
104
|
const MenuActionMores = instance.findByType(MenuActionMore);
|
|
105
105
|
await MenuActionMores.props.onItemClick({ data: 'test' });
|
|
106
|
-
expect(global.mockedNavigate).
|
|
106
|
+
expect(global.mockedNavigate).toHaveBeenCalled();
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
it('Test change date', async () => {
|
|
@@ -1,19 +1,19 @@
|
|
|
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 { mockSCStore } from '../../../context/mockStore';
|
|
8
|
-
import HanetMemberInfo from '../MemberInfo';
|
|
6
|
+
import { useNavigation } from '@react-navigation/native';
|
|
9
7
|
import { AlertAction } from '../../../commons';
|
|
10
|
-
import TextInput from '../../../commons/Form/TextInput';
|
|
11
8
|
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
12
9
|
import BottomSheet from '../../../commons/BottomSheet';
|
|
10
|
+
import TextInput from '../../../commons/Form/TextInput';
|
|
11
|
+
import { API } from '../../../configs';
|
|
13
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
|
|
16
|
-
import { useNavigation } from '@react-navigation/native';
|
|
16
|
+
import HanetMemberInfo from '../MemberInfo';
|
|
17
17
|
|
|
18
18
|
const wrapComponent = (route) => (
|
|
19
19
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -113,7 +113,7 @@ describe('Test HanetMemberInfo', () => {
|
|
|
113
113
|
await chooseSetFaceIDOption(instance, 0);
|
|
114
114
|
|
|
115
115
|
expect(bottomSheet.props.isVisible).toBe(false);
|
|
116
|
-
expect(navigate).
|
|
116
|
+
expect(navigate).toHaveBeenCalled(); // navigate to HanetCaptureFaceID
|
|
117
117
|
});
|
|
118
118
|
|
|
119
119
|
it('Test set photo id choose file', async () => {
|
|
@@ -176,6 +176,6 @@ describe('Test HanetMemberInfo', () => {
|
|
|
176
176
|
await act(async () => {
|
|
177
177
|
await bottomButton.props.onPressMain();
|
|
178
178
|
});
|
|
179
|
-
expect(navigate).
|
|
179
|
+
expect(navigate).toHaveBeenCalled();
|
|
180
180
|
});
|
|
181
181
|
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
3
|
-
import { create } from 'react-test-renderer';
|
|
4
1
|
import { act } from '@testing-library/react-hooks';
|
|
2
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
3
|
+
import React from 'react';
|
|
5
4
|
import { TouchableOpacity } from 'react-native';
|
|
5
|
+
import { create } from 'react-test-renderer';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { API } from '../../../configs';
|
|
7
|
+
import { useNavigation } from '@react-navigation/native';
|
|
9
8
|
import MoveToAnotherSubUnit from '../';
|
|
9
|
+
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
10
|
+
import { API } from '../../../configs';
|
|
11
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
10
12
|
import { SCProvider } from '../../../context';
|
|
11
13
|
import { mockSCStore } from '../../../context/mockStore';
|
|
12
|
-
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
13
14
|
import api from '../../../utils/Apis/axios';
|
|
14
|
-
import { useNavigation } from '@react-navigation/native';
|
|
15
15
|
|
|
16
16
|
const mock = new MockAdapter(api.axiosInstance);
|
|
17
17
|
|
|
@@ -128,7 +128,7 @@ describe('Test Render ListSubUnit', () => {
|
|
|
128
128
|
await bottomButtonView.props.onPressMain();
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
-
expect(global.mockedNavigate).
|
|
131
|
+
expect(global.mockedNavigate).toHaveBeenCalled();
|
|
132
132
|
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
133
133
|
await act(async () => {
|
|
134
134
|
await touchableOpacities[2].props.onPress();
|
|
@@ -140,6 +140,6 @@ describe('Test Render ListSubUnit', () => {
|
|
|
140
140
|
await act(async () => {
|
|
141
141
|
await bottomButtonView.props.onPressMain();
|
|
142
142
|
});
|
|
143
|
-
expect(global.mockedNavigate).not.
|
|
143
|
+
expect(global.mockedNavigate).not.toHaveBeenCalled();
|
|
144
144
|
});
|
|
145
145
|
});
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { act, create } from 'react-test-renderer';
|
|
1
|
+
import { NavigationContext } from '@react-navigation/native';
|
|
3
2
|
import MockAdapter from 'axios-mock-adapter';
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { Animated, RefreshControl } from 'react-native';
|
|
5
|
-
import {
|
|
5
|
+
import { act, create } from 'react-test-renderer';
|
|
6
6
|
|
|
7
|
+
import { WrapHeaderScrollable } from '../../../commons';
|
|
8
|
+
import { API } from '../../../configs';
|
|
7
9
|
import { SCProvider } from '../../../context';
|
|
8
10
|
import { mockSCStore } from '../../../context/mockStore';
|
|
9
|
-
import Notification from '../index';
|
|
10
|
-
import NotificationItem from '../components/NotificationItem';
|
|
11
|
-
import { API } from '../../../configs';
|
|
12
11
|
import api from '../../../utils/Apis/axios';
|
|
13
|
-
import
|
|
12
|
+
import NotificationItem from '../components/NotificationItem';
|
|
13
|
+
import Notification from '../index';
|
|
14
14
|
|
|
15
|
-
import { getPusher } from '../../../utils/Pusher';
|
|
16
15
|
import { NOTIFICATION_TYPES } from '../../../configs/Constants';
|
|
16
|
+
import { getPusher } from '../../../utils/Pusher';
|
|
17
17
|
|
|
18
18
|
const wrapComponent = () => (
|
|
19
19
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -155,7 +155,7 @@ describe('test Notification', () => {
|
|
|
155
155
|
tree = await create(wrapComponent());
|
|
156
156
|
await tree.unmount();
|
|
157
157
|
});
|
|
158
|
-
expect(getPusher().unsubscribe).
|
|
158
|
+
expect(getPusher().unsubscribe).toHaveBeenCalledWith('private-user-1');
|
|
159
159
|
});
|
|
160
160
|
it('test render trigger script notification', async () => {
|
|
161
161
|
const response = {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { useRoute } from '@react-navigation/native';
|
|
2
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { TouchableOpacity } from 'react-native';
|
|
3
|
-
import { useRoute } from '@react-navigation/native';
|
|
4
5
|
import { act, create } from 'react-test-renderer';
|
|
5
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
6
6
|
|
|
7
7
|
import SelectUnit from '../';
|
|
8
|
+
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
9
|
+
import { API } from '../../../configs';
|
|
10
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
8
11
|
import { SCProvider } from '../../../context';
|
|
9
12
|
import { mockSCStore } from '../../../context/mockStore';
|
|
10
|
-
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
11
|
-
import Routes from '../../../utils/Route';
|
|
12
13
|
import api from '../../../utils/Apis/axios';
|
|
13
|
-
import
|
|
14
|
-
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
14
|
+
import Routes from '../../../utils/Route';
|
|
15
15
|
|
|
16
16
|
const mock = new MockAdapter(api.axiosInstance);
|
|
17
17
|
|
|
@@ -157,7 +157,7 @@ describe('Test Select unit screen', () => {
|
|
|
157
157
|
await act(async () => {
|
|
158
158
|
await iconClose[0].props.onPress();
|
|
159
159
|
});
|
|
160
|
-
expect(global.mockedNavigate).
|
|
160
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.ScriptDetail, {
|
|
161
161
|
id: 1,
|
|
162
162
|
havePermission: true,
|
|
163
163
|
isMultiUnits: undefined,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { act } from '@testing-library/react-hooks';
|
|
2
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { Alert } from 'react-native';
|
|
4
5
|
import { create } from 'react-test-renderer';
|
|
5
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
6
6
|
import { ViewButtonBottom } from '../../../commons';
|
|
7
|
+
import AccessibilityLabel from '../../../configs/AccessibilityLabel';
|
|
8
|
+
import API from '../../../configs/API';
|
|
7
9
|
import { SCProvider } from '../../../context';
|
|
8
10
|
import { mockSCStore } from '../../../context/mockStore';
|
|
9
|
-
import API from '../../../configs/API';
|
|
10
11
|
import api from '../../../utils/Apis/axios';
|
|
11
12
|
import UpdateShareDevice from '../UpdateShareDevice';
|
|
12
|
-
import AccessibilityLabel from '../../../configs/AccessibilityLabel';
|
|
13
13
|
|
|
14
14
|
const mock = new MockAdapter(api.axiosInstance);
|
|
15
15
|
jest.spyOn(Alert, 'alert').mockImplementation(() => {});
|
|
@@ -151,7 +151,7 @@ describe('Test UpdateShareDevice', () => {
|
|
|
151
151
|
await act(async () => {
|
|
152
152
|
ViewButtonBottomElement[0].props.onRightClick();
|
|
153
153
|
});
|
|
154
|
-
expect(global.mockedGoBack).
|
|
154
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
155
155
|
expect(mock.history.post[0].data).toEqual(
|
|
156
156
|
JSON.stringify({
|
|
157
157
|
phone: '0901234567',
|
|
@@ -185,7 +185,7 @@ describe('Test UpdateShareDevice', () => {
|
|
|
185
185
|
await act(async () => {
|
|
186
186
|
ViewButtonBottomElement[0].props.onRightClick();
|
|
187
187
|
});
|
|
188
|
-
expect(global.mockedGoBack).
|
|
188
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
189
189
|
expect(mock.history.post[0].data).toEqual(
|
|
190
190
|
JSON.stringify({
|
|
191
191
|
phone: '',
|
|
@@ -217,7 +217,7 @@ describe('Test UpdateShareDevice', () => {
|
|
|
217
217
|
await act(async () => {
|
|
218
218
|
ViewButtonBottomElement[0].props.onRightClick();
|
|
219
219
|
});
|
|
220
|
-
expect(global.mockedGoBack).not.
|
|
220
|
+
expect(global.mockedGoBack).not.toHaveBeenCalled();
|
|
221
221
|
expect(mock.history.post[0].data).toEqual(
|
|
222
222
|
JSON.stringify({
|
|
223
223
|
phone: '',
|
|
@@ -274,7 +274,7 @@ describe('Test UpdateShareDevice', () => {
|
|
|
274
274
|
await act(async () => {
|
|
275
275
|
ViewButtonBottomElement[0].props.onLeftClick();
|
|
276
276
|
});
|
|
277
|
-
expect(global.mockedGoBack).
|
|
277
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
278
278
|
});
|
|
279
279
|
|
|
280
280
|
it('user not choose device click button next', async () => {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import MockAdapter from 'axios-mock-adapter';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
4
|
|
|
5
5
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
6
6
|
|
|
7
|
-
import { SCProvider } from '../../../context';
|
|
8
|
-
import { mockSCStore } from '../../../context/mockStore';
|
|
9
|
-
import SideMenuDetail from '../index';
|
|
10
|
-
import { API } from '../../../configs';
|
|
11
7
|
import { TouchableOpacity } from 'react-native';
|
|
12
8
|
import { ModalCustom } from '../../../commons/Modal';
|
|
13
|
-
import {
|
|
9
|
+
import { API } from '../../../configs';
|
|
10
|
+
import { SCProvider } from '../../../context';
|
|
11
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
14
12
|
import api from '../../../utils/Apis/axios';
|
|
13
|
+
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
14
|
+
import SideMenuDetail from '../index';
|
|
15
15
|
|
|
16
16
|
const mock = new MockAdapter(api.axiosInstance);
|
|
17
17
|
|
|
@@ -158,7 +158,7 @@ describe('Test SideMenuDetail', () => {
|
|
|
158
158
|
const instance = tree.root;
|
|
159
159
|
await chooseUser(instance);
|
|
160
160
|
await onPressSubmitData(instance);
|
|
161
|
-
expect(spyToastError).
|
|
161
|
+
expect(spyToastError).toHaveBeenCalled();
|
|
162
162
|
|
|
163
163
|
await enterPasscode(instance);
|
|
164
164
|
await onPressSubmitData(instance);
|
|
@@ -174,6 +174,6 @@ describe('Test SideMenuDetail', () => {
|
|
|
174
174
|
},
|
|
175
175
|
})
|
|
176
176
|
);
|
|
177
|
-
expect(spyToastSuccess).
|
|
177
|
+
expect(spyToastSuccess).toHaveBeenCalled();
|
|
178
178
|
});
|
|
179
179
|
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { act, create } from 'react-test-renderer';
|
|
3
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
import { act, create } from 'react-test-renderer';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { useNavigation } from '@react-navigation/native';
|
|
6
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
7
|
+
import Text from '../../../../commons/Text';
|
|
8
|
+
import { API } from '../../../../configs';
|
|
9
|
+
import AccessibilityLabel from '../../../../configs/AccessibilityLabel';
|
|
6
10
|
import { SCProvider } from '../../../../context';
|
|
7
11
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
8
|
-
import Text from '../../../../commons/Text';
|
|
9
12
|
import api from '../../../../utils/Apis/axios';
|
|
10
|
-
import { API } from '../../../../configs';
|
|
11
13
|
import Routes from '../../../../utils/Route';
|
|
12
|
-
import
|
|
13
|
-
import AccessibilityLabel from '../../../../configs/AccessibilityLabel';
|
|
14
|
-
import { useNavigation } from '@react-navigation/native';
|
|
14
|
+
import ListDevice from '../index';
|
|
15
15
|
|
|
16
16
|
const mock = new MockAdapter(api.axiosInstance);
|
|
17
17
|
|
|
@@ -78,7 +78,7 @@ describe('Test ListDeviceSmartAccount', () => {
|
|
|
78
78
|
await touchs[touchs.length - 1].props.onPress();
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
expect(navigate).
|
|
81
|
+
expect(navigate).toHaveBeenCalledWith(Routes.AddDeviceStack, {
|
|
82
82
|
screen: Routes.AddCommonSelectSubUnit,
|
|
83
83
|
params: {
|
|
84
84
|
addType: 'AddHassiDevice',
|
package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
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
|
|
5
|
+
import _TextInput from '../../../../commons/Form/TextInput';
|
|
6
|
+
import { API } from '../../../../configs';
|
|
7
|
+
import AccessibilityLabel from '../../../../configs/AccessibilityLabel';
|
|
6
8
|
import { SCProvider } from '../../../../context';
|
|
7
9
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
8
10
|
import api from '../../../../utils/Apis/axios';
|
|
9
|
-
import { API } from '../../../../configs';
|
|
10
|
-
import AccessibilityLabel from '../../../../configs/AccessibilityLabel';
|
|
11
11
|
import Routes from '../../../../utils/Route';
|
|
12
|
-
import _TextInput from '../../../../commons/Form/TextInput';
|
|
13
12
|
import { flushPromises } from '../../../AllGateway/test-utils';
|
|
13
|
+
import SuccessfullyConnected from '../index';
|
|
14
14
|
|
|
15
15
|
const mock = new MockAdapter(api.axiosInstance);
|
|
16
16
|
|
|
@@ -100,7 +100,7 @@ describe('Test SuccessfullyConnected', () => {
|
|
|
100
100
|
await act(async () => {
|
|
101
101
|
handleContinue.props.onPress();
|
|
102
102
|
});
|
|
103
|
-
expect(global.mockedNavigate).
|
|
103
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
104
104
|
Routes.ListDeviceSmartAccount,
|
|
105
105
|
{
|
|
106
106
|
smart_account_id: 1,
|
|
@@ -125,7 +125,7 @@ describe('Test SuccessfullyConnected', () => {
|
|
|
125
125
|
await act(async () => {
|
|
126
126
|
handleFinish.props.onPress();
|
|
127
127
|
});
|
|
128
|
-
expect(global.mockedDispatch).
|
|
128
|
+
expect(global.mockedDispatch).toHaveBeenCalledWith({
|
|
129
129
|
payload: {
|
|
130
130
|
index: 0,
|
|
131
131
|
routes: [
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import renderer, { act } from 'react-test-renderer';
|
|
4
|
+
import Text from '../../../commons/Text';
|
|
5
|
+
import { API } from '../../../configs';
|
|
3
6
|
import { SCProvider } from '../../../context';
|
|
4
7
|
import { mockSCStore } from '../../../context/mockStore';
|
|
5
|
-
import
|
|
6
|
-
import Text from '../../../commons/Text';
|
|
7
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
8
|
+
import t from '../../../hooks/Common/useTranslations';
|
|
8
9
|
import api from '../../../utils/Apis/axios';
|
|
9
|
-
import { API } from '../../../configs';
|
|
10
10
|
import Routes from '../../../utils/Route';
|
|
11
|
-
import
|
|
11
|
+
import SmartAccountConnecting from '../Connecting';
|
|
12
12
|
|
|
13
13
|
const mock = new MockAdapter(api.axiosInstance);
|
|
14
14
|
|
|
@@ -53,7 +53,7 @@ describe('Test Connecting', () => {
|
|
|
53
53
|
await act(async () => {
|
|
54
54
|
tree = await renderer.create(wrapComponent(route));
|
|
55
55
|
});
|
|
56
|
-
expect(global.mockedNavigate).
|
|
56
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.SmartAccount, {
|
|
57
57
|
params: {},
|
|
58
58
|
});
|
|
59
59
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import Toast from 'react-native-toast-message';
|
|
4
2
|
import { ScrollView, TouchableOpacity } from 'react-native';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import SmartAccount from '../index';
|
|
8
|
-
import AccessibilityLabel from '../../../configs/AccessibilityLabel';
|
|
3
|
+
import Toast from 'react-native-toast-message';
|
|
4
|
+
import renderer, { act } from 'react-test-renderer';
|
|
9
5
|
import TextInput from '../../../commons/Form/TextInput';
|
|
10
6
|
import _TextInputPassword from '../../../commons/Form/TextInputPassword';
|
|
7
|
+
import AccessibilityLabel from '../../../configs/AccessibilityLabel';
|
|
8
|
+
import { SCProvider } from '../../../context';
|
|
9
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
11
10
|
import Routes from '../../../utils/Route';
|
|
11
|
+
import SmartAccount from '../index';
|
|
12
12
|
|
|
13
13
|
const wrapComponent = (route) => (
|
|
14
14
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -98,7 +98,7 @@ describe('Test SmartAccount', () => {
|
|
|
98
98
|
await act(async () => {
|
|
99
99
|
await touchableOpacity.props.onPress();
|
|
100
100
|
});
|
|
101
|
-
expect(Toast.show).
|
|
101
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
102
102
|
type: 'error',
|
|
103
103
|
position: 'bottom',
|
|
104
104
|
text1: 'Please select a supplier',
|
|
@@ -152,7 +152,7 @@ describe('Test SmartAccount', () => {
|
|
|
152
152
|
await act(async () => {
|
|
153
153
|
await touchableOpacity.props.onPress();
|
|
154
154
|
});
|
|
155
|
-
expect(global.mockedNavigate).
|
|
155
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
156
156
|
Routes.SmartAccountConnecting,
|
|
157
157
|
{
|
|
158
158
|
brand: 'google_home',
|
|
@@ -206,7 +206,7 @@ describe('Test SmartAccount', () => {
|
|
|
206
206
|
await act(async () => {
|
|
207
207
|
await touchableOpacity.props.onPress();
|
|
208
208
|
});
|
|
209
|
-
expect(global.mockedNavigate).
|
|
209
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.AddDeviceStack, {
|
|
210
210
|
screen: 'AddCommonSelectUnit',
|
|
211
211
|
params: {
|
|
212
212
|
addType: 'AddHassioDevice',
|
|
@@ -236,7 +236,7 @@ describe('Test SmartAccount', () => {
|
|
|
236
236
|
await touchSupplierItem[1].props.onPress();
|
|
237
237
|
});
|
|
238
238
|
expect(touchSupplierItem).toBeDefined();
|
|
239
|
-
expect(global.mockedNavigate).
|
|
239
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.Browser, {
|
|
240
240
|
// eslint-disable-next-line max-len
|
|
241
241
|
link: 'https://qt-vn.m.lgaccount.com/emp/v2/authorize?client_id=2b85aee334f046848341547894bb7c4e&redirect_uri=app://eoh/sync-lg-device&response_type=code&state=1',
|
|
242
242
|
});
|
|
@@ -64,7 +64,7 @@ const AddSubUnit = ({ route }) => {
|
|
|
64
64
|
lat: location.latitude,
|
|
65
65
|
lng: location.longitude,
|
|
66
66
|
};
|
|
67
|
-
const formData = createFormData(dataObj, ['background']);
|
|
67
|
+
const formData = createFormData(dataObj, ['background', 'lat', 'lng']);
|
|
68
68
|
const { success, data } = await axiosPost(
|
|
69
69
|
API.UNIT.CREATE_UNIT(),
|
|
70
70
|
formData,
|
|
@@ -120,9 +120,7 @@ const AddSubUnit = ({ route }) => {
|
|
|
120
120
|
routeName: Routes.DashboardStack,
|
|
121
121
|
};
|
|
122
122
|
if (isInsideUnit) {
|
|
123
|
-
navigate(Routes.UnitDetail,
|
|
124
|
-
params: commonPrams,
|
|
125
|
-
});
|
|
123
|
+
navigate(Routes.UnitDetail, commonPrams);
|
|
126
124
|
} else {
|
|
127
125
|
dispatch(
|
|
128
126
|
replace(Routes.UnitStack, {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { act, create } from 'react-test-renderer';
|
|
3
2
|
import DraggableFlatList from 'react-native-draggable-flatlist';
|
|
3
|
+
import { act, create } from 'react-test-renderer';
|
|
4
4
|
|
|
5
|
+
import { useRoute } from '@react-navigation/native';
|
|
6
|
+
import { TouchableOpacity } from 'react-native';
|
|
7
|
+
import Text from '../../../commons/Text';
|
|
5
8
|
import { SCProvider } from '../../../context';
|
|
6
9
|
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
-
import EditTemplate from '../EditTemplate';
|
|
8
|
-
import Text from '../../../commons/Text';
|
|
9
|
-
import { useRoute } from '@react-navigation/native';
|
|
10
10
|
import { getTranslate } from '../../../utils/I18n';
|
|
11
|
-
import
|
|
11
|
+
import EditTemplate from '../EditTemplate';
|
|
12
12
|
|
|
13
13
|
const wrapComponent = () => (
|
|
14
14
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -67,7 +67,7 @@ describe('Test EditTemplate', () => {
|
|
|
67
67
|
await firstItem.props.onLongPress();
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
expect(global.mockedGoBack).
|
|
70
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
71
71
|
|
|
72
72
|
await act(async () => {
|
|
73
73
|
await DraggableFlatLists[0].props.onDragEnd({
|
|
@@ -79,6 +79,6 @@ describe('Test EditTemplate', () => {
|
|
|
79
79
|
.findByProps({ accessibilityLabel: 'Save' })
|
|
80
80
|
.props.onPress();
|
|
81
81
|
});
|
|
82
|
-
expect(global.mockedGoBack).
|
|
82
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
83
83
|
});
|
|
84
84
|
});
|