@eohjsc/react-native-smart-city 0.7.3-rc1 → 0.7.3-rc11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -15
- package/src/commons/Action/__test__/ItemQuickAction.test.js +6 -6
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +5 -5
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonCircle.test.js +2 -2
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonDefault.test.js +2 -2
- package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +9 -10
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +5 -5
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +5 -5
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +8 -8
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +6 -6
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +1 -1
- package/src/commons/ActionGroup/__test__/index.test.js +6 -6
- package/src/commons/ActionTemplate/__test__/index.test.js +4 -4
- package/src/commons/Automate/__test__/ItemAutomate.test.js +2 -2
- package/src/commons/ChartAggregationOption/__test__/FourButtonFilterHistory.test.js +2 -2
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +8 -9
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +7 -7
- package/src/commons/DateTimeRangeChange/DateTimeButton.js +1 -1
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +1 -1
- package/src/commons/Device/FlatListItems.js +17 -16
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -3
- package/src/commons/Device/HorizontalBarChart.js +54 -34
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -3
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +6 -6
- package/src/commons/FlatListDnD/__test__/index.test.js +4 -4
- package/src/commons/FlatListDnD/index.js +12 -9
- package/src/commons/Grid/GridItem.js +10 -2
- package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +3 -3
- package/src/commons/Header/__test__/HeaderCT.test.js +3 -3
- package/src/commons/IconComponent/index.js +3 -3
- package/src/commons/ImagePicker/__test__/ImagePicker.test.js +5 -5
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +6 -4
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +1 -1
- package/src/commons/Popover/__test__/index.test.js +3 -3
- package/src/commons/Processing/__test__/Connecting.test.js +4 -4
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +5 -5
- package/src/commons/SubUnit/OneTap/index.js +9 -8
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +8 -8
- package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +9 -13
- package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +5 -5
- package/src/hooks/IoT/__test__/useHomeAssistantConnection.test.js +12 -12
- package/src/hooks/IoT/__test__/useWatchConfigs.test.js +3 -3
- package/src/hooks/IoT/useRemoteControl.js +6 -6
- package/src/hooks/useMqtt.js +2 -2
- package/src/iot/RemoteControl/Internet.js +2 -2
- package/src/iot/RemoteControl/__test__/Internet.test.js +7 -7
- package/src/screens/AddLocationMaps/__test__/index.test.js +12 -12
- package/src/screens/AddNewGateway/ShareWifiPassword.js +16 -15
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -7
- package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +8 -8
- package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +7 -7
- package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +8 -8
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +5 -5
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +4 -4
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -6
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -6
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +0 -4
- package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +2 -2
- package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +19 -17
- package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +19 -17
- package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +18 -16
- package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +43 -35
- package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +13 -13
- package/src/screens/AllGateway/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/components/Detail/__test__/index.test.js +3 -5
- package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +3 -3
- package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/hooks/__test__/index.test.js +2 -2
- package/src/screens/AllGateway/test-utils.js +3 -4
- package/src/screens/Automate/AddNewAction/NewActionWrapper.js +7 -7
- package/src/screens/Automate/AddNewAction/SelectControlDevices.js +3 -3
- package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +35 -32
- package/src/screens/Automate/AddNewAction/Styles/SetupSensorStyles.js +20 -4
- package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +12 -12
- package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +14 -8
- package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +13 -7
- package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +12 -11
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptDelay.test.js +9 -9
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +10 -10
- package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +4 -3
- package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +13 -8
- package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +8 -8
- package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +6 -6
- package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +7 -7
- package/src/screens/Automate/EditActionsList/index.js +19 -17
- package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +16 -7
- package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +15 -7
- package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +4 -7
- package/src/screens/Automate/ScriptDetail/__test__/index.test.js +1 -1
- package/src/screens/Automate/ScriptDetail/__test__/useStarredScript.test.js +6 -6
- package/src/screens/Automate/ScriptDetail/index.js +18 -18
- package/src/screens/Automate/SetSchedule/__test__/SelectWeekday.test.js +4 -4
- package/src/screens/Automate/SetSchedule/__test__/index.test.js +28 -18
- package/src/screens/Automate/SetSchedule/components/RowItem.js +5 -5
- package/src/screens/Automate/SetSchedule/index.js +7 -7
- package/src/screens/ChangePosition/__test__/index.test.js +6 -6
- package/src/screens/ChangePosition/index.js +2 -1
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +9 -9
- package/src/screens/Device/__test__/detail.test.js +12 -12
- package/src/screens/Device/__test__/mqttDetail.test.js +9 -9
- package/src/screens/Device/components/SensorDisplayItem.js +5 -5
- package/src/screens/Drawer/Drawer.test.js +2 -2
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -7
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +8 -8
- package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +3 -3
- package/src/screens/HanetCamera/__test__/Detail.test.js +9 -9
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -10
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +9 -9
- package/src/screens/Notification/__test__/Notification.test.js +9 -9
- package/src/screens/Notification/components/NotificationItem.js +2 -3
- package/src/screens/Notification/styles/NotificationItemStyles.js +0 -1
- package/src/screens/PlayBackCamera/__test__/index.test.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
- package/src/screens/SelectUnit/__test__/index.test.js +7 -7
- package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +7 -7
- package/src/screens/SideMenuDetail/__test__/index.test.js +8 -8
- package/src/screens/SmartAccount/Connecting/index.js +5 -5
- package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +8 -8
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +7 -7
- package/src/screens/SmartAccount/__test__/Connecting.test.js +6 -6
- package/src/screens/SmartAccount/__test__/SmartAccount.test.js +10 -10
- package/src/screens/SubUnit/AddSubUnit.js +2 -4
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -11
- package/src/screens/Template/EditTemplate.js +6 -4
- package/src/screens/Template/__test__/EditTemplate.test.js +7 -7
- package/src/screens/Template/__test__/detail.test.js +4 -4
- package/src/screens/Template/__test__/index.test.js +1 -1
- package/src/screens/Unit/Station/__test__/index.test.js +1 -1
- package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +9 -9
- package/src/screens/Unit/__test__/SelectAddress.test.js +11 -17
- package/src/screens/Unit/__test__/Summaries.test.js +7 -7
- package/src/screens/Unit/components/__test__/AutomateScript.test.js +3 -3
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +8 -8
- package/src/screens/Unit/hook/__test__/useUnitConnectRemoteDevices.test.js +2 -2
- package/src/utils/I18n/translations/en.js +1 -1
- package/src/utils/I18n/translations/vi.js +1 -1
- package/src/utils/__test__/Utils.test.js +16 -16
|
@@ -9,6 +9,7 @@ import React, {
|
|
|
9
9
|
import { Image, TouchableOpacity, View } from 'react-native';
|
|
10
10
|
import DraggableFlatList from 'react-native-draggable-flatlist';
|
|
11
11
|
|
|
12
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
12
13
|
import { EmptyComponent } from '../../commons/DevMode';
|
|
13
14
|
import { HeaderCustom } from '../../commons/Header';
|
|
14
15
|
import Text from '../../commons/Text';
|
|
@@ -16,9 +17,9 @@ import { Images } from '../../configs';
|
|
|
16
17
|
import { SCContext } from '../../context';
|
|
17
18
|
import { Action } from '../../context/actionType';
|
|
18
19
|
import t from '../../hooks/Common/useTranslations';
|
|
20
|
+
import { notImplemented } from '../../utils/Utils';
|
|
19
21
|
import { SensorDisplayItem } from '../Device/components/SensorDisplayItem';
|
|
20
22
|
import styles from './Styles/EditTemplateStyle';
|
|
21
|
-
import { notImplemented } from '../../utils/Utils';
|
|
22
23
|
|
|
23
24
|
const EditTemplate = () => {
|
|
24
25
|
const { setAction } = useContext(SCContext);
|
|
@@ -100,7 +101,7 @@ const EditTemplate = () => {
|
|
|
100
101
|
{!actionsList?.length ? (
|
|
101
102
|
renderEmpty
|
|
102
103
|
) : (
|
|
103
|
-
|
|
104
|
+
<GestureHandlerRootView>
|
|
104
105
|
<View style={styles.wrapDescription}>
|
|
105
106
|
<Text style={styles.description}>
|
|
106
107
|
{t('hold_and_hover_description')}
|
|
@@ -109,7 +110,8 @@ const EditTemplate = () => {
|
|
|
109
110
|
<DraggableFlatList
|
|
110
111
|
showsVerticalScrollIndicator={false}
|
|
111
112
|
data={actionsList}
|
|
112
|
-
renderItem={({ item,
|
|
113
|
+
renderItem={({ item, getIndex, drag }) => {
|
|
114
|
+
const index = getIndex();
|
|
113
115
|
return (
|
|
114
116
|
<TouchableOpacity
|
|
115
117
|
onLongPress={onDrag(item, drag)}
|
|
@@ -153,7 +155,7 @@ const EditTemplate = () => {
|
|
|
153
155
|
<Text style={styles.save}>{t('save')}</Text>
|
|
154
156
|
</TouchableOpacity>
|
|
155
157
|
</View>
|
|
156
|
-
|
|
158
|
+
</GestureHandlerRootView>
|
|
157
159
|
)}
|
|
158
160
|
</View>
|
|
159
161
|
);
|
|
@@ -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
|
});
|
|
@@ -4,13 +4,13 @@ import React from 'react';
|
|
|
4
4
|
import { TouchableOpacity } from 'react-native';
|
|
5
5
|
import { act, create } from 'react-test-renderer';
|
|
6
6
|
|
|
7
|
+
import MenuActionMore from '../../../commons/MenuActionMore';
|
|
8
|
+
import ModalPopupCT from '../../../commons/ModalPopupCT';
|
|
7
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
13
|
import Detail from '../detail';
|
|
12
|
-
import ModalPopupCT from '../../../commons/ModalPopupCT';
|
|
13
|
-
import MenuActionMore from '../../../commons/MenuActionMore';
|
|
14
14
|
|
|
15
15
|
const mock = new MockAdapter(api.axiosInstance);
|
|
16
16
|
|
|
@@ -59,7 +59,7 @@ describe('Test Detail', () => {
|
|
|
59
59
|
const instance = tree.root;
|
|
60
60
|
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
61
61
|
await touchableOpacities[0].props.onPress();
|
|
62
|
-
expect(global.mockedGoBack).
|
|
62
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('Test render onClick more header onPress delete', async () => {
|
|
@@ -95,7 +95,7 @@ describe('Test Detail', () => {
|
|
|
95
95
|
await act(async () => {
|
|
96
96
|
await menuActionMore.props.onItemClick(item);
|
|
97
97
|
});
|
|
98
|
-
expect(mockDoAction).
|
|
98
|
+
expect(mockDoAction).toHaveBeenCalled();
|
|
99
99
|
const modalPopupCT = instance.findByType(ModalPopupCT);
|
|
100
100
|
mock.onGet(API.DEV_MODE.DASHBOARD.DETAIL(1)).reply(200);
|
|
101
101
|
await act(async () => {
|
|
@@ -27,7 +27,7 @@ describe('Test Template screen', () => {
|
|
|
27
27
|
expect(FlatLists).toHaveLength(1);
|
|
28
28
|
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
29
29
|
await touchableOpacities[0].props.onPress();
|
|
30
|
-
expect(global.mockedNavigate).
|
|
30
|
+
expect(global.mockedNavigate).toHaveBeenCalled();
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
it('Test onSearch', async () => {
|
|
@@ -52,6 +52,6 @@ describe('Test Station', () => {
|
|
|
52
52
|
});
|
|
53
53
|
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
54
54
|
await touchableOpacities[0].props.onPress();
|
|
55
|
-
expect(mockOnSnapToItem).
|
|
55
|
+
expect(mockOnSnapToItem).toHaveBeenCalled();
|
|
56
56
|
});
|
|
57
57
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { act, create } from 'react-test-renderer';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
4
|
|
|
5
|
+
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
6
|
+
import NavBar from '../../../commons/NavBar';
|
|
7
|
+
import { API } from '../../../configs';
|
|
5
8
|
import { SCProvider } from '../../../context';
|
|
6
9
|
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
-
import
|
|
8
|
-
import NavBar from '../../../commons/NavBar';
|
|
10
|
+
import api from '../../../utils/Apis/axios';
|
|
9
11
|
import Device from '../../Automate/AddNewAction/Device';
|
|
10
12
|
import AutomateScript from '../components/AutomateScript';
|
|
11
|
-
import
|
|
12
|
-
import { API } from '../../../configs';
|
|
13
|
-
import api from '../../../utils/Apis/axios';
|
|
13
|
+
import SelectAddToFavorites from '../SelectAddToFavorites';
|
|
14
14
|
|
|
15
15
|
const wrapComponent = (route) => (
|
|
16
16
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -154,7 +154,7 @@ describe('Test SelectAddToFavorites', () => {
|
|
|
154
154
|
await bottomButton.props.onPressMain();
|
|
155
155
|
});
|
|
156
156
|
expect(mock.history.post).toHaveLength(2);
|
|
157
|
-
expect(global.mockedGoBack).
|
|
157
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
158
158
|
});
|
|
159
159
|
|
|
160
160
|
it('test select only devices then click done', async () => {
|
|
@@ -187,7 +187,7 @@ describe('Test SelectAddToFavorites', () => {
|
|
|
187
187
|
await bottomButton.props.onPressMain();
|
|
188
188
|
});
|
|
189
189
|
expect(mock.history.post).toHaveLength(1);
|
|
190
|
-
expect(global.mockedGoBack).
|
|
190
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
191
191
|
});
|
|
192
192
|
|
|
193
193
|
it('test select only scripts then click done', async () => {
|
|
@@ -216,7 +216,7 @@ describe('Test SelectAddToFavorites', () => {
|
|
|
216
216
|
await bottomButton.props.onPressMain();
|
|
217
217
|
});
|
|
218
218
|
expect(mock.history.post).toHaveLength(1);
|
|
219
|
-
expect(global.mockedGoBack).
|
|
219
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
220
220
|
});
|
|
221
221
|
|
|
222
222
|
it('test click done call api fail not goBack', async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Alert } from 'react-native';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
4
|
import MockAdapter from 'axios-mock-adapter';
|
|
@@ -71,14 +71,6 @@ jest.mock('react-native-permissions', () => {
|
|
|
71
71
|
return require('react-native-permissions/mock');
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
jest.mock('react', () => {
|
|
75
|
-
return {
|
|
76
|
-
...jest.requireActual('react'),
|
|
77
|
-
memo: (x) => x,
|
|
78
|
-
useRef: jest.fn(),
|
|
79
|
-
};
|
|
80
|
-
});
|
|
81
|
-
|
|
82
74
|
describe('Test SelectAddress', () => {
|
|
83
75
|
let tree, route, Platform;
|
|
84
76
|
const mockUpdateLocation = jest.fn();
|
|
@@ -166,14 +158,16 @@ describe('Test SelectAddress', () => {
|
|
|
166
158
|
expect(global.mockedGoBack).toBeCalled();
|
|
167
159
|
});
|
|
168
160
|
|
|
161
|
+
// useRef same issue with src/commons/Widgets/IFrame/__tests__/IFrame.test.js
|
|
169
162
|
it('test chose search result will center map', async () => {
|
|
170
|
-
const animateToRegion = jest.fn();
|
|
171
|
-
const mapRef = {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
};
|
|
176
|
-
useRef.mockImplementation(() => mapRef);
|
|
163
|
+
// const animateToRegion = jest.fn();
|
|
164
|
+
// const mapRef = {
|
|
165
|
+
// current: {
|
|
166
|
+
// animateToRegion,
|
|
167
|
+
// },
|
|
168
|
+
// };
|
|
169
|
+
// useRef.mockImplementation(() => mapRef);
|
|
170
|
+
|
|
177
171
|
await act(async () => {
|
|
178
172
|
tree = await create(wrapComponent(route));
|
|
179
173
|
});
|
|
@@ -214,7 +208,7 @@ describe('Test SelectAddress', () => {
|
|
|
214
208
|
await act(async () => {
|
|
215
209
|
await rowLocations[0].props.onPress({ place_id: 1, description: '1' });
|
|
216
210
|
});
|
|
217
|
-
expect(animateToRegion).toBeCalled();
|
|
211
|
+
// expect(animateToRegion).toBeCalled();
|
|
218
212
|
});
|
|
219
213
|
|
|
220
214
|
it('test get lat lng of location failed', async () => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { useIsFocused } from '@react-navigation/native';
|
|
2
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { ScrollView } from 'react-native';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
5
|
import renderer, { act } from 'react-test-renderer';
|
|
6
|
+
import SummaryItem from '../../../commons/SummaryItem';
|
|
5
7
|
import { API } from '../../../configs';
|
|
6
8
|
import { SCProvider } from '../../../context';
|
|
7
9
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
|
-
import Summaries from '../Summaries';
|
|
9
|
-
import SummaryItem from '../../../commons/SummaryItem';
|
|
10
|
-
import api from '../../../utils/Apis/axios';
|
|
11
10
|
import { useReceiveNotifications } from '../../../hooks';
|
|
12
|
-
import
|
|
11
|
+
import api from '../../../utils/Apis/axios';
|
|
12
|
+
import Summaries from '../Summaries';
|
|
13
13
|
|
|
14
14
|
const mock = new MockAdapter(api.axiosInstance);
|
|
15
15
|
|
|
@@ -64,7 +64,7 @@ describe('Test Summaries', () => {
|
|
|
64
64
|
await act(async () => {
|
|
65
65
|
items[0].props.goToSummary({ id: 1 });
|
|
66
66
|
});
|
|
67
|
-
expect(global.mockedNavigate).
|
|
67
|
+
expect(global.mockedNavigate).toHaveBeenCalled();
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
it('render Summaries receive noti with summary_id then not reload', async () => {
|
|
@@ -80,7 +80,7 @@ describe('Test Summaries', () => {
|
|
|
80
80
|
await act(async () => {
|
|
81
81
|
tree = await renderer.create(wrapComponent(props));
|
|
82
82
|
});
|
|
83
|
-
expect(global.mockedNavigate).not.
|
|
83
|
+
expect(global.mockedNavigate).not.toHaveBeenCalled();
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
it('fetch data non-stop', async () => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TouchableWithoutFeedback, View } from 'react-native';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
|
+
import FImage from '../../../../commons/FImage';
|
|
5
|
+
import Text from '../../../../commons/Text';
|
|
4
6
|
import { AUTOMATE_TYPE } from '../../../../configs/Constants';
|
|
5
7
|
import { SCProvider } from '../../../../context';
|
|
6
8
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
7
9
|
import AutomateScript from '../AutomateScript';
|
|
8
|
-
import Text from '../../../../commons/Text';
|
|
9
|
-
import FImage from '../../../../commons/FImage';
|
|
10
10
|
|
|
11
11
|
const mockOnPress = jest.fn();
|
|
12
12
|
|
|
@@ -34,7 +34,7 @@ describe('test AutomateScript screen', () => {
|
|
|
34
34
|
TouchableWithoutFeedback
|
|
35
35
|
);
|
|
36
36
|
await TouchableWithoutFeedbacks[0].props.onPress();
|
|
37
|
-
expect(mockOnPress).
|
|
37
|
+
expect(mockOnPress).toHaveBeenCalledWith(automate);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
it('Test isSelected=true', async () => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
|
-
import moment from 'moment';
|
|
4
1
|
import { useNavigation } from '@react-navigation/native';
|
|
5
2
|
import MockAdapter from 'axios-mock-adapter';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
3
|
+
import moment from 'moment';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { act, create } from 'react-test-renderer';
|
|
8
6
|
import { API } from '../../../../configs';
|
|
9
|
-
import
|
|
7
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
10
8
|
import { SCProvider } from '../../../../context';
|
|
11
9
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
12
10
|
import api from '../../../../utils/Apis/axios';
|
|
11
|
+
import Routes from '../../../../utils/Route';
|
|
12
|
+
import SharedUnit from '../SharedUnit';
|
|
13
13
|
|
|
14
14
|
const mock = new MockAdapter(api.axiosInstance);
|
|
15
15
|
|
|
@@ -114,7 +114,7 @@ describe('Test SharedUnit', () => {
|
|
|
114
114
|
);
|
|
115
115
|
mock.onPost(API.UNIT.UNSTAR_UNIT(3)).reply(200);
|
|
116
116
|
await iconRemoveStarSharedUnit.props.onPress();
|
|
117
|
-
expect(mockRenewItem).
|
|
117
|
+
expect(mockRenewItem).toHaveBeenCalled();
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
it('test create SharedUnit unit is pin, is star with call api failure', async () => {
|
|
@@ -140,6 +140,6 @@ describe('Test SharedUnit', () => {
|
|
|
140
140
|
);
|
|
141
141
|
mock.onPost(API.UNIT.UNSTAR_UNIT(3)).reply(200);
|
|
142
142
|
await iconRemoveStarSharedUnit.props.onPress();
|
|
143
|
-
expect(mockRenewItem).
|
|
143
|
+
expect(mockRenewItem).toHaveBeenCalled();
|
|
144
144
|
});
|
|
145
145
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { renderHook } from '@testing-library/react-hooks';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { SCProvider } from '../../../../context';
|
|
4
4
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
5
5
|
import { useUnitConnectRemoteDevices } from '../useUnitConnectRemoteDevices';
|
|
@@ -52,6 +52,6 @@ describe('Test useUnitConnectRemoteDevices', () => {
|
|
|
52
52
|
renderHook(() => useUnitConnectRemoteDevices(unit), {
|
|
53
53
|
wrapper,
|
|
54
54
|
});
|
|
55
|
-
expect(mockSetAction).not.
|
|
55
|
+
expect(mockSetAction).not.toHaveBeenCalled();
|
|
56
56
|
});
|
|
57
57
|
});
|
|
@@ -840,7 +840,7 @@ export default {
|
|
|
840
840
|
select_unit_members: 'Select from Unit members',
|
|
841
841
|
select_contacts: 'Select contacts',
|
|
842
842
|
no_contact: 'No contacts',
|
|
843
|
-
|
|
843
|
+
is_equal: 'is equal',
|
|
844
844
|
is_below: 'is below',
|
|
845
845
|
is_above: 'is above',
|
|
846
846
|
text_notification_content_air_quality_high:
|
|
@@ -94,8 +94,8 @@ export default {
|
|
|
94
94
|
verify: 'Xác nhận',
|
|
95
95
|
text_new_unit: 'Địa điểm',
|
|
96
96
|
text_sub_units: 'Khu vực',
|
|
97
|
+
is_equal: 'bằng',
|
|
97
98
|
is_below: 'dưới',
|
|
98
|
-
is: 'bằng',
|
|
99
99
|
is_above: 'trên',
|
|
100
100
|
edit_actions_list: 'Chỉnh sửa danh sách hành động',
|
|
101
101
|
des_edit_actions_list:
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { Linking } from 'react-native';
|
|
2
|
-
import { act } from 'react-test-renderer';
|
|
3
2
|
import Toast from 'react-native-toast-message';
|
|
3
|
+
import { act } from 'react-test-renderer';
|
|
4
4
|
|
|
5
5
|
import api from '../Apis/axios';
|
|
6
6
|
import {
|
|
7
|
-
|
|
7
|
+
deleteDefaultAuthToken,
|
|
8
8
|
formatMoney,
|
|
9
|
+
formatNumberCompact,
|
|
10
|
+
getDateRangeOfWeek,
|
|
9
11
|
insertToString,
|
|
10
|
-
removeFromString,
|
|
11
12
|
isObjectEmpty,
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
notImplemented,
|
|
14
|
+
objectIds,
|
|
15
|
+
openMapDirection,
|
|
16
|
+
removeFromString,
|
|
17
|
+
roundNumber,
|
|
14
18
|
setAxiosDefaultAuthToken,
|
|
19
|
+
setAxiosDefaultLanguage,
|
|
15
20
|
shortEmailName,
|
|
16
|
-
formatNumberCompact,
|
|
17
21
|
standardizeCameraScreenSize,
|
|
18
|
-
openMapDirection,
|
|
19
22
|
ToastBottomHelper,
|
|
20
|
-
|
|
21
|
-
notImplemented,
|
|
22
|
-
roundNumber,
|
|
23
|
-
getDateRangeOfWeek,
|
|
23
|
+
validateEmail,
|
|
24
24
|
} from '../Utils';
|
|
25
25
|
|
|
26
26
|
describe('Test utils', () => {
|
|
@@ -90,7 +90,7 @@ describe('Test utils', () => {
|
|
|
90
90
|
await act(async () => {
|
|
91
91
|
await openMapDirection({ lat: 10, lng: 10 })();
|
|
92
92
|
});
|
|
93
|
-
expect(Linking.openURL).
|
|
93
|
+
expect(Linking.openURL).toHaveBeenCalledWith(
|
|
94
94
|
'https://www.google.com/maps/dir/?api=1&origin=&destination=10,10'
|
|
95
95
|
);
|
|
96
96
|
});
|
|
@@ -99,7 +99,7 @@ describe('Test utils', () => {
|
|
|
99
99
|
await act(async () => {
|
|
100
100
|
ToastBottomHelper.success('msg', 'line2');
|
|
101
101
|
});
|
|
102
|
-
expect(Toast.show).
|
|
102
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
103
103
|
position: 'bottom',
|
|
104
104
|
text1: 'msg',
|
|
105
105
|
text2: 'line2',
|
|
@@ -110,7 +110,7 @@ describe('Test utils', () => {
|
|
|
110
110
|
await act(async () => {
|
|
111
111
|
ToastBottomHelper.error('msg', 'line2');
|
|
112
112
|
});
|
|
113
|
-
expect(Toast.show).
|
|
113
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
114
114
|
position: 'bottom',
|
|
115
115
|
text1: 'msg',
|
|
116
116
|
text2: 'line2',
|
|
@@ -121,7 +121,7 @@ describe('Test utils', () => {
|
|
|
121
121
|
await act(async () => {
|
|
122
122
|
ToastBottomHelper.info('msg', 'line2');
|
|
123
123
|
});
|
|
124
|
-
expect(Toast.show).
|
|
124
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
125
125
|
position: 'bottom',
|
|
126
126
|
text1: 'msg',
|
|
127
127
|
text2: 'line2',
|
|
@@ -170,7 +170,7 @@ describe('Test utils', () => {
|
|
|
170
170
|
await act(async () => {
|
|
171
171
|
notImplemented(mockTranslate);
|
|
172
172
|
});
|
|
173
|
-
expect(mockTranslate).
|
|
173
|
+
expect(mockTranslate).toHaveBeenCalledWith('feature_under_development');
|
|
174
174
|
});
|
|
175
175
|
|
|
176
176
|
it('Test roundNumber', async () => {
|