@eohjsc/react-native-smart-city 0.7.3-rc0 → 0.7.3-rc10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -15
- package/src/commons/Action/__test__/ItemQuickAction.test.js +5 -5
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +5 -5
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonCircle.test.js +2 -2
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonDefault.test.js +2 -2
- package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +9 -10
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +5 -5
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +5 -5
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +8 -8
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +6 -6
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +1 -1
- package/src/commons/ActionGroup/__test__/index.test.js +8 -8
- package/src/commons/ActionTemplate/__test__/index.test.js +4 -4
- package/src/commons/Automate/__test__/ItemAutomate.test.js +2 -2
- package/src/commons/ChartAggregationOption/__test__/FourButtonFilterHistory.test.js +2 -2
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +8 -9
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +7 -7
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +1 -1
- package/src/commons/Device/FlatListItems.js +17 -16
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -3
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -3
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +6 -6
- package/src/commons/FlatListDnD/__test__/index.test.js +4 -4
- package/src/commons/FlatListDnD/index.js +12 -9
- package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +3 -3
- package/src/commons/Header/__test__/HeaderCT.test.js +3 -3
- package/src/commons/IconComponent/index.js +1 -1
- package/src/commons/ImagePicker/__test__/ImagePicker.test.js +5 -5
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +6 -4
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +5 -5
- package/src/commons/Popover/__test__/index.test.js +3 -3
- package/src/commons/Processing/__test__/Connecting.test.js +4 -4
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +5 -5
- package/src/commons/SubUnit/OneTap/index.js +9 -8
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +8 -8
- package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +9 -13
- package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +5 -5
- package/src/hooks/IoT/__test__/useHomeAssistantConnection.test.js +12 -12
- package/src/hooks/IoT/__test__/useWatchConfigs.test.js +3 -3
- package/src/hooks/IoT/useRemoteControl.js +6 -6
- package/src/hooks/useMqtt.js +2 -2
- package/src/iot/RemoteControl/Internet.js +2 -2
- package/src/iot/RemoteControl/__test__/Internet.test.js +7 -7
- package/src/screens/AddLocationMaps/__test__/index.test.js +12 -12
- package/src/screens/AddNewGateway/ShareWifiPassword.js +16 -15
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -7
- package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +8 -8
- package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +7 -7
- package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +8 -8
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +5 -5
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +4 -4
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -6
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -6
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +0 -4
- package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +2 -2
- package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +19 -17
- package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +19 -17
- package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +18 -16
- package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +43 -35
- package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +13 -13
- package/src/screens/AllGateway/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/components/Detail/__test__/index.test.js +3 -5
- package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +3 -3
- package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/hooks/__test__/index.test.js +2 -2
- package/src/screens/AllGateway/test-utils.js +3 -4
- package/src/screens/Automate/AddNewAction/NewActionWrapper.js +7 -7
- package/src/screens/Automate/AddNewAction/SelectControlDevices.js +3 -3
- package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +13 -13
- package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +14 -8
- package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +13 -7
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptDelay.test.js +9 -9
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +10 -10
- package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +4 -3
- package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +13 -8
- package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +8 -8
- package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +6 -6
- package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +7 -7
- package/src/screens/Automate/EditActionsList/index.js +19 -17
- package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +16 -7
- package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +15 -7
- package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +4 -7
- package/src/screens/Automate/ScriptDetail/__test__/index.test.js +1 -1
- package/src/screens/Automate/ScriptDetail/__test__/useStarredScript.test.js +6 -6
- package/src/screens/Automate/ScriptDetail/index.js +18 -18
- package/src/screens/Automate/SetSchedule/__test__/SelectWeekday.test.js +4 -4
- package/src/screens/Automate/SetSchedule/__test__/index.test.js +28 -18
- package/src/screens/Automate/SetSchedule/index.js +7 -7
- package/src/screens/ChangePosition/__test__/index.test.js +6 -6
- package/src/screens/ChangePosition/index.js +2 -1
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +9 -9
- package/src/screens/Device/__test__/detail.test.js +12 -12
- package/src/screens/Device/__test__/mqttDetail.test.js +9 -9
- package/src/screens/Device/components/SensorDisplayItem.js +5 -5
- package/src/screens/Drawer/Drawer.test.js +2 -2
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -7
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +8 -8
- package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +3 -3
- package/src/screens/HanetCamera/__test__/Detail.test.js +9 -9
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -10
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +9 -9
- package/src/screens/Notification/__test__/Notification.test.js +9 -9
- package/src/screens/Notification/components/NotificationItem.js +1 -2
- package/src/screens/Notification/styles/NotificationItemStyles.js +0 -1
- package/src/screens/PlayBackCamera/__test__/index.test.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
- package/src/screens/SelectUnit/__test__/index.test.js +7 -7
- package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +7 -7
- package/src/screens/SideMenuDetail/__test__/index.test.js +8 -8
- package/src/screens/SmartAccount/Connecting/index.js +5 -5
- package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +8 -8
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +7 -7
- package/src/screens/SmartAccount/__test__/Connecting.test.js +6 -6
- package/src/screens/SmartAccount/__test__/SmartAccount.test.js +10 -10
- package/src/screens/SubUnit/AddSubUnit.js +2 -4
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -11
- package/src/screens/Template/EditTemplate.js +6 -4
- package/src/screens/Template/__test__/EditTemplate.test.js +7 -7
- package/src/screens/Template/__test__/detail.test.js +4 -4
- package/src/screens/Template/__test__/index.test.js +1 -1
- package/src/screens/Unit/Station/__test__/index.test.js +1 -1
- package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +9 -9
- package/src/screens/Unit/__test__/SelectAddress.test.js +11 -17
- package/src/screens/Unit/__test__/Summaries.test.js +7 -7
- package/src/screens/Unit/components/__test__/AutomateScript.test.js +3 -3
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +8 -8
- package/src/screens/Unit/hook/__test__/useUnitConnectRemoteDevices.test.js +2 -2
- package/src/utils/__test__/Utils.test.js +16 -16
|
@@ -1,34 +1,37 @@
|
|
|
1
|
+
import { useNavigation, useRoute } 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
|
-
const wrapComponent = (route) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
const wrapComponent = (route) => {
|
|
20
|
+
useRoute.mockReturnValue(route);
|
|
21
|
+
return (
|
|
22
|
+
<SCProvider initState={mockSCStore({})}>
|
|
23
|
+
<SetSchedule route={route} />
|
|
24
|
+
</SCProvider>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
24
27
|
|
|
25
28
|
describe('Test SetSchedule', () => {
|
|
26
29
|
let tree;
|
|
27
30
|
let route = {
|
|
28
31
|
params: {
|
|
29
|
-
type: 'schedule',
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
automate: { type: 'schedule', unit: 1 },
|
|
33
|
+
unitId: 1,
|
|
34
|
+
closeScreen: 'UnitDetail',
|
|
32
35
|
},
|
|
33
36
|
};
|
|
34
37
|
|
|
@@ -70,7 +73,11 @@ describe('Test SetSchedule', () => {
|
|
|
70
73
|
await act(async () => {
|
|
71
74
|
await header.props.onPress();
|
|
72
75
|
});
|
|
73
|
-
expect(global.mockedNavigate).
|
|
76
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith('UnitDetail', {
|
|
77
|
+
automate: { type: 'schedule', unit: 1 },
|
|
78
|
+
closeScreen: 'UnitDetail',
|
|
79
|
+
unitId: 1,
|
|
80
|
+
});
|
|
74
81
|
});
|
|
75
82
|
|
|
76
83
|
it('test repeat options popup', async () => {
|
|
@@ -137,7 +144,10 @@ describe('Test SetSchedule', () => {
|
|
|
137
144
|
repeat: 'once',
|
|
138
145
|
time_repeat: '12:00:00',
|
|
139
146
|
weekday_repeat: [],
|
|
147
|
+
type: 'schedule',
|
|
148
|
+
unit: 1,
|
|
140
149
|
},
|
|
150
|
+
closeScreen: 'UnitDetail',
|
|
141
151
|
});
|
|
142
152
|
});
|
|
143
153
|
});
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import React, { memo, useCallback, useState } from 'react';
|
|
2
|
-
import { ScrollView } from 'react-native';
|
|
3
1
|
import { useNavigation } from '@react-navigation/native';
|
|
4
2
|
import moment from 'moment';
|
|
5
|
-
import
|
|
3
|
+
import React, { memo, useCallback, useState } from 'react';
|
|
4
|
+
import { ScrollView } from 'react-native';
|
|
6
5
|
import Calendar from '../../../commons/Calendar';
|
|
6
|
+
import WheelDateTimePicker from '../../../commons/WheelDateTimePicker';
|
|
7
|
+
import { useBoolean } from '../../../hooks/Common';
|
|
8
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
9
|
+
import Routes from '../../../utils/Route';
|
|
10
|
+
import NewActionWrapper from '../AddNewAction/NewActionWrapper';
|
|
7
11
|
import RepeatOptionsPopup, {
|
|
8
12
|
REPEAT_OPTIONS,
|
|
9
13
|
} from './components/RepeatOptionsPopup';
|
|
10
14
|
import RowItem from './components/RowItem';
|
|
11
15
|
import SelectWeekday from './components/SelectWeekday';
|
|
12
|
-
import { useBoolean } from '../../../hooks/Common';
|
|
13
|
-
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
14
16
|
import styles from './styles/indexStyles';
|
|
15
|
-
import Routes from '../../../utils/Route';
|
|
16
|
-
import NewActionWrapper from '../AddNewAction/NewActionWrapper';
|
|
17
17
|
|
|
18
18
|
const SetSchedule = ({ route }) => {
|
|
19
19
|
const t = useTranslations();
|
|
@@ -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
|
});
|
|
@@ -49,7 +49,8 @@ const ChangePosition = () => {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
const renderItem = ({ item,
|
|
52
|
+
const renderItem = ({ item, getIndex, drag, isActive }) => {
|
|
53
|
+
const index = getIndex();
|
|
53
54
|
return (
|
|
54
55
|
<View style={styles.widgetItem}>
|
|
55
56
|
<View style={[styles.itemOrder, isActive ? styles.isDragging : {}]}>
|
|
@@ -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) => {
|
|
@@ -13,19 +13,19 @@ import ListQualityIndicator from '../../../commons/Device/WaterQualitySensor/Lis
|
|
|
13
13
|
import Compass from '../../../commons/Device/WindDirection/Compass';
|
|
14
14
|
import Anemometer from '../../../commons/Device/WindSpeed/Anemometer';
|
|
15
15
|
import MediaPlayerDetail from '../../../commons/MediaPlayerDetail';
|
|
16
|
+
import IFrame from '../../../commons/Widgets/IFrame/IFrame';
|
|
17
|
+
import IFrameWithConfig from '../../../commons/Widgets/IFrameWithConfig/IFrameWithConfig';
|
|
18
|
+
import { Device } from '../../../configs';
|
|
16
19
|
import { AccessibilityLabel, WIDGET_TYPE } from '../../../configs/Constants';
|
|
17
20
|
import { useSCContextSelector } from '../../../context';
|
|
18
21
|
import { useRemoteControl } from '../../../hooks/IoT';
|
|
19
22
|
import { useConfigGlobalState } from '../../../iot/states';
|
|
20
23
|
import SmartIr from '../../../screens/SmartIr';
|
|
24
|
+
import { standardizeCameraScreenSize } from '../../../utils/Utils';
|
|
21
25
|
import { useEvaluateValue } from '../hooks/useEvaluateValue';
|
|
22
26
|
import styles from '../styles';
|
|
23
|
-
import VisualChart from './VisualChart';
|
|
24
|
-
import { standardizeCameraScreenSize } from '../../../utils/Utils';
|
|
25
|
-
import { Device } from '../../../configs';
|
|
26
27
|
import DonutCharts from './DonutChart';
|
|
27
|
-
import
|
|
28
|
-
import IFrameWithConfig from '../../../commons/Widgets/IFrameWithConfig/IFrameWithConfig';
|
|
28
|
+
import VisualChart from './VisualChart';
|
|
29
29
|
|
|
30
30
|
const { standardizeWidth, standardizeHeight } = standardizeCameraScreenSize(
|
|
31
31
|
Device.screenWidth - 32
|
|
@@ -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
|
});
|
|
@@ -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 = {
|
|
@@ -5,11 +5,11 @@ import { Calendar } from 'react-native-calendars';
|
|
|
5
5
|
|
|
6
6
|
import { act, create } from 'react-test-renderer';
|
|
7
7
|
import PlayBackCamera from '..';
|
|
8
|
+
import MediaPlayerFull from '../../../commons/MediaPlayerDetail/MediaPlayerFull';
|
|
8
9
|
import Text from '../../../commons/Text';
|
|
9
10
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
10
11
|
import { SCProvider } from '../../../context';
|
|
11
12
|
import { mockSCStore } from '../../../context/mockStore';
|
|
12
|
-
import MediaPlayerFull from '../../../commons/MediaPlayerDetail/MediaPlayerFull';
|
|
13
13
|
import Timer from '../Timer';
|
|
14
14
|
|
|
15
15
|
const wrapComponent = () => (
|