@eohjsc/react-native-smart-city 0.7.3-rc6 → 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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eohjsc/react-native-smart-city",
|
|
3
3
|
"title": "React Native Smart Home",
|
|
4
|
-
"version": "0.7.3-
|
|
4
|
+
"version": "0.7.3-rc8",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
"react-native-dash": "^0.0.11",
|
|
149
149
|
"react-native-deep-linking": "^2.2.0",
|
|
150
150
|
"react-native-device-info": "^10.3.0",
|
|
151
|
-
"react-native-draggable-flatlist": "^
|
|
151
|
+
"react-native-draggable-flatlist": "^4.0.1",
|
|
152
152
|
"react-native-fast-image": "^8.6.3",
|
|
153
153
|
"react-native-geocoder": "^0.5.0",
|
|
154
154
|
"react-native-gesture-handler": "^2.17.1",
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
"react-native-iphone-x-helper": "^1.2.1",
|
|
160
160
|
"react-native-linear-gradient": "^2.5.6",
|
|
161
161
|
"react-native-localize": "^1.4.1",
|
|
162
|
-
"react-native-maps": "
|
|
162
|
+
"react-native-maps": "1.17.3",
|
|
163
163
|
"react-native-modal": "^13.0.1",
|
|
164
164
|
"react-native-modal-datetime-picker": "^17.1.0",
|
|
165
165
|
"react-native-new-snap-carousel": "^3.9.3",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { factory } from 'factory-girl';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { TouchableOpacity } from 'react-native';
|
|
4
|
+
import Toast from 'react-native-toast-message';
|
|
5
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
3
6
|
import { act, create } from 'react-test-renderer';
|
|
4
|
-
import ItemQuickAction from '../ItemQuickAction';
|
|
5
7
|
import { Colors } from '../../../configs';
|
|
6
8
|
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
7
|
-
import { factory } from 'factory-girl';
|
|
8
9
|
import IconComponent from '../../IconComponent';
|
|
9
|
-
import
|
|
10
|
-
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
10
|
+
import ItemQuickAction from '../ItemQuickAction';
|
|
11
11
|
class Sensor {}
|
|
12
12
|
|
|
13
13
|
factory.define('Sensor', Sensor, {});
|
|
@@ -256,7 +256,7 @@ describe('Test ItemQuickAction', () => {
|
|
|
256
256
|
await act(async () => {
|
|
257
257
|
await buttonOnActionPress.props.onPress();
|
|
258
258
|
});
|
|
259
|
-
expect(Toast.show).not.
|
|
259
|
+
expect(Toast.show).not.toHaveBeenCalled();
|
|
260
260
|
});
|
|
261
261
|
it('test config value 0 on_state_values 0', async () => {
|
|
262
262
|
sensor.quick_action.on_state_values = [0];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { act, create } from 'react-test-renderer';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { useNavigation } from '@react-navigation/native';
|
|
5
|
+
import { TouchableOpacity } from 'react-native';
|
|
5
6
|
import { AccessibilityLabel } from '../../../../../configs/Constants';
|
|
6
7
|
import { SCProvider } from '../../../../../context';
|
|
7
|
-
import
|
|
8
|
-
import { TouchableOpacity } from 'react-native';
|
|
8
|
+
import { mockSCStore } from '../../../../../context/mockStore';
|
|
9
9
|
import Routes from '../../../../../utils/Route';
|
|
10
|
-
import
|
|
10
|
+
import PasscodeList from '../index';
|
|
11
11
|
|
|
12
12
|
const wrapComponent = () => (
|
|
13
13
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -41,7 +41,7 @@ describe('Test SetupGeneratePasscode', () => {
|
|
|
41
41
|
await act(async () => {
|
|
42
42
|
await passcode_list[0].props.onPress();
|
|
43
43
|
});
|
|
44
|
-
expect(global.mockedNavigate).
|
|
44
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.SmartLockStack, {
|
|
45
45
|
screen: Routes.ItemPasscode,
|
|
46
46
|
params: {
|
|
47
47
|
item: { code: 123361, name: 'Do Loi' },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import renderer, { act } from 'react-test-renderer';
|
|
3
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
import renderer, { act } from 'react-test-renderer';
|
|
4
4
|
|
|
5
5
|
import { SCProvider } from '../../../../context';
|
|
6
6
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
@@ -47,6 +47,6 @@ describe('Test ThreeButtonCircle', () => {
|
|
|
47
47
|
await act(async () => {
|
|
48
48
|
touchableOpacities[0].props.onPress();
|
|
49
49
|
});
|
|
50
|
-
expect(mockOnButton1Press).
|
|
50
|
+
expect(mockOnButton1Press).toHaveBeenCalled();
|
|
51
51
|
});
|
|
52
52
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import renderer, { act } from 'react-test-renderer';
|
|
3
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
import renderer, { act } from 'react-test-renderer';
|
|
4
4
|
|
|
5
5
|
import { SCProvider } from '../../../../context';
|
|
6
6
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
@@ -47,6 +47,6 @@ describe('Test ThreeButtonDefault', () => {
|
|
|
47
47
|
await act(async () => {
|
|
48
48
|
touchableOpacities[0].props.onPress();
|
|
49
49
|
});
|
|
50
|
-
expect(mockOnButton1Press).
|
|
50
|
+
expect(mockOnButton1Press).toHaveBeenCalled();
|
|
51
51
|
});
|
|
52
52
|
});
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
2
1
|
import React, { useContext } from 'react';
|
|
2
|
+
import ColorPicker from 'react-native-wheel-color-picker';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
|
-
import
|
|
5
|
-
import { WheelColorPicker } from '../ColorPickerTemplate';
|
|
4
|
+
import { DEVICE_TYPE } from '../../../configs/Constants';
|
|
6
5
|
import { SCProvider } from '../../../context';
|
|
7
6
|
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
+
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
8
8
|
import { useConfigGlobalState } from '../../../iot/states';
|
|
9
|
-
import
|
|
10
|
-
import { DEVICE_TYPE } from '../../../configs/Constants';
|
|
9
|
+
import ColorPickerTemplate, { WheelColorPicker } from '../ColorPickerTemplate';
|
|
11
10
|
|
|
12
11
|
const mockSetAction = jest.fn();
|
|
13
12
|
|
|
@@ -106,7 +105,7 @@ describe('Test ColorPickerTemplate', () => {
|
|
|
106
105
|
await act(async () => {
|
|
107
106
|
await wheelpicker.props.onStart();
|
|
108
107
|
});
|
|
109
|
-
expect(mockSetAction).
|
|
108
|
+
expect(mockSetAction).toHaveBeenCalled();
|
|
110
109
|
});
|
|
111
110
|
|
|
112
111
|
it('test WheelColorPicker onChangeColorComplete', async () => {
|
|
@@ -123,13 +122,13 @@ describe('Test ColorPickerTemplate', () => {
|
|
|
123
122
|
await act(async () => {
|
|
124
123
|
await wheelpicker.props.onStart();
|
|
125
124
|
});
|
|
126
|
-
expect(mockSetAction).
|
|
127
|
-
expect(mockDoAction).
|
|
125
|
+
expect(mockSetAction).toHaveBeenCalledTimes(1);
|
|
126
|
+
expect(mockDoAction).toHaveBeenCalledTimes(0);
|
|
128
127
|
|
|
129
128
|
await act(async () => {
|
|
130
129
|
await wheelpicker.props.onChangeColorComplete('#ffffff');
|
|
131
130
|
});
|
|
132
|
-
expect(mockSetAction).
|
|
133
|
-
expect(mockDoAction).
|
|
131
|
+
expect(mockSetAction).toHaveBeenCalledTimes(2);
|
|
132
|
+
expect(mockDoAction).toHaveBeenCalledTimes(1);
|
|
134
133
|
});
|
|
135
134
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
2
|
-
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import { act, create } from 'react-test-renderer';
|
|
5
|
-
import
|
|
3
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
6
4
|
import { SCProvider } from '../../../context';
|
|
7
5
|
import { mockSCStore } from '../../../context/mockStore';
|
|
6
|
+
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
8
7
|
import { useConfigGlobalState } from '../../../iot/states';
|
|
8
|
+
import OnOffSmartLock from '../OnOffSmartLock/OnOffSmartLock';
|
|
9
9
|
|
|
10
10
|
jest.mock('../../../iot/Monitor');
|
|
11
11
|
const mockDoAction = jest.fn();
|
|
@@ -76,7 +76,7 @@ describe('Test OnOffTemplate', () => {
|
|
|
76
76
|
await act(async () => {
|
|
77
77
|
await button.props.onPress();
|
|
78
78
|
});
|
|
79
|
-
expect(mockDoAction).
|
|
79
|
+
expect(mockDoAction).toHaveBeenCalledWith(actionOnData, '{"door_lock":0}');
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
it('render with template OnOffSmartLockActionTemplate doAction unlock', async () => {
|
|
@@ -96,6 +96,6 @@ describe('Test OnOffTemplate', () => {
|
|
|
96
96
|
await act(async () => {
|
|
97
97
|
await button.props.onPress();
|
|
98
98
|
});
|
|
99
|
-
expect(mockDoAction).
|
|
99
|
+
expect(mockDoAction).toHaveBeenCalledWith(actionOffData, '{"door_lock":1}');
|
|
100
100
|
});
|
|
101
101
|
});
|
|
@@ -2,12 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import { act, create } from 'react-test-renderer';
|
|
3
3
|
|
|
4
4
|
import { DEVICE_TYPE } from '../../../configs/Constants';
|
|
5
|
+
import { SCProvider } from '../../../context';
|
|
6
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
5
7
|
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
6
8
|
import OnOffTemplate from '../OnOffTemplate';
|
|
7
9
|
import OnOffButtonTemplate from '../OnOffTemplate/OnOffButtonTemplate';
|
|
8
10
|
import OnOffSimpleTemplate from '../OnOffTemplate/OnOffSimpleTemplate';
|
|
9
|
-
import { mockSCStore } from '../../../context/mockStore';
|
|
10
|
-
import { SCProvider } from '../../../context';
|
|
11
11
|
|
|
12
12
|
const wrapComponent = (item, mockDoAction, sensor) => (
|
|
13
13
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -118,7 +118,7 @@ describe('Test OnOffTemplate', () => {
|
|
|
118
118
|
const instance = tree.root;
|
|
119
119
|
const template = instance.findAllByType(OnOffSimpleTemplate);
|
|
120
120
|
expect(template).toHaveLength(1);
|
|
121
|
-
expect(watchMultiConfigs).
|
|
121
|
+
expect(watchMultiConfigs).toHaveBeenCalledTimes(0);
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
it('template OnOffSimpleActionTemplate doAction with is_on_value, match configValue', async () => {
|
|
@@ -135,7 +135,7 @@ describe('Test OnOffTemplate', () => {
|
|
|
135
135
|
await template.props.triggerAction();
|
|
136
136
|
});
|
|
137
137
|
expect(mockDoAction).toHaveBeenCalledWith(actionOffData, undefined, false);
|
|
138
|
-
expect(watchMultiConfigs).
|
|
138
|
+
expect(watchMultiConfigs).toHaveBeenCalledTimes(0);
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
it('template OnOffSimpleActionTemplate doAction with is_on_value, not match configValue', async () => {
|
|
@@ -167,7 +167,7 @@ describe('Test OnOffTemplate', () => {
|
|
|
167
167
|
await template.props.triggerAction();
|
|
168
168
|
});
|
|
169
169
|
expect(mockDoAction).toHaveBeenCalledWith(actionOffData, undefined, false);
|
|
170
|
-
expect(watchMultiConfigs).
|
|
170
|
+
expect(watchMultiConfigs).toHaveBeenCalledTimes(0);
|
|
171
171
|
});
|
|
172
172
|
|
|
173
173
|
it('render with template OnOffSimpleActionTemplate with just action_data', async () => {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import OptionsDropdownActionTemplate from '../../../commons/ActionGroup/OptionsDropdownActionTemplate';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { TouchableOpacity } from 'react-native';
|
|
4
3
|
import { act, create } from 'react-test-renderer';
|
|
5
|
-
import Text from '../../../commons/Text';
|
|
6
|
-
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
7
4
|
import { AlertAction, RadioCircle } from '../../../commons';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
5
|
+
import OptionsDropdownActionTemplate from '../../../commons/ActionGroup/OptionsDropdownActionTemplate';
|
|
6
|
+
import Text from '../../../commons/Text';
|
|
7
|
+
import { AccessibilityLabel, DEVICE_TYPE } from '../../../configs/Constants';
|
|
10
8
|
import { SCProvider } from '../../../context';
|
|
11
9
|
import { mockSCStore } from '../../../context/mockStore';
|
|
10
|
+
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
11
|
+
import { getTranslate } from '../../../utils/I18n';
|
|
12
12
|
|
|
13
|
-
import SvgDoorState from '../../../../assets/images/Device/door-state.svg';
|
|
14
13
|
import SvgCurrentState from '../../../../assets/images/Device/current-state.svg';
|
|
14
|
+
import SvgDoorState from '../../../../assets/images/Device/door-state.svg';
|
|
15
15
|
import SvgWindStrength from '../../../../assets/images/Device/wind-strength.svg';
|
|
16
16
|
|
|
17
17
|
const wrapComponent = (item, mockDoAction, sensor) => (
|
|
@@ -190,8 +190,8 @@ describe('Test OptionsDropdownActionTemplate', () => {
|
|
|
190
190
|
value: 1,
|
|
191
191
|
});
|
|
192
192
|
is_managed_by_backend
|
|
193
|
-
? expect(watchMultiConfigs).not.
|
|
194
|
-
: expect(watchMultiConfigs).not.
|
|
193
|
+
? expect(watchMultiConfigs).not.toHaveBeenCalled()
|
|
194
|
+
: expect(watchMultiConfigs).not.toHaveBeenCalled();
|
|
195
195
|
|
|
196
196
|
expect(texts[1].props.children).toEqual('Level2'); // TODO: should be Level1, configValues make change again
|
|
197
197
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
|
+
import { DEVICE_TYPE } from '../../../configs/Constants';
|
|
4
5
|
import Text from '../../Text';
|
|
5
6
|
import StatesGridActionTemplate from '../StatesGridActionTemplate';
|
|
6
|
-
import { DEVICE_TYPE } from '../../../configs/Constants';
|
|
7
7
|
|
|
8
8
|
const mockDoAction = jest.fn();
|
|
9
9
|
const mockActionData = jest.fn();
|
|
@@ -74,7 +74,7 @@ describe('Test StatesGridActionTemplate', () => {
|
|
|
74
74
|
await act(async () => {
|
|
75
75
|
await touchableOpacities[0].props.onPress();
|
|
76
76
|
});
|
|
77
|
-
expect(mockDoAction).
|
|
77
|
+
expect(mockDoAction).toHaveBeenCalledWith(mockActionData, null);
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
it('test trigger special action', async () => {
|
|
@@ -96,7 +96,7 @@ describe('Test StatesGridActionTemplate', () => {
|
|
|
96
96
|
await act(async () => {
|
|
97
97
|
await touchableOpacities[0].props.onPress();
|
|
98
98
|
});
|
|
99
|
-
expect(mockDoAction).
|
|
99
|
+
expect(mockDoAction).toHaveBeenCalledWith(
|
|
100
100
|
mockActionData,
|
|
101
101
|
JSON.stringify({ config_id: 1, config_value: undefined })
|
|
102
102
|
);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Switch, TouchableOpacity } from 'react-native';
|
|
3
|
-
import { act, create } from 'react-test-renderer';
|
|
4
|
-
import TimerActionTemplate from '../TimerActionTemplate';
|
|
5
3
|
import DateTimePickerModal from 'react-native-modal-datetime-picker';
|
|
6
4
|
import ScrollPicker from 'react-native-wheel-scrollview-picker';
|
|
5
|
+
import { act, create } from 'react-test-renderer';
|
|
6
|
+
import TimerActionTemplate from '../TimerActionTemplate';
|
|
7
7
|
|
|
8
8
|
import moment from 'moment';
|
|
9
|
-
import Text from '../../Text';
|
|
10
|
-
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
11
9
|
import { SCProvider } from '../../../context';
|
|
12
10
|
import { mockSCStore } from '../../../context/mockStore';
|
|
11
|
+
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
12
|
+
import Text from '../../Text';
|
|
13
13
|
|
|
14
14
|
jest.mock('../../../iot/Monitor');
|
|
15
15
|
|
|
@@ -81,7 +81,7 @@ describe('Test TimerActionTemplate success with config value', () => {
|
|
|
81
81
|
await act(async () => {
|
|
82
82
|
await switchButton.props.onValueChange();
|
|
83
83
|
});
|
|
84
|
-
expect(mockDoAction).
|
|
84
|
+
expect(mockDoAction).toHaveBeenCalled();
|
|
85
85
|
|
|
86
86
|
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
87
87
|
await act(async () => {
|
|
@@ -128,6 +128,6 @@ describe('Test TimerActionTemplate success with config value', () => {
|
|
|
128
128
|
await act(async () => {
|
|
129
129
|
await touchableOpacities[2].props.onPress(3);
|
|
130
130
|
});
|
|
131
|
-
expect(mockDoAction).
|
|
131
|
+
expect(mockDoAction).toHaveBeenCalled();
|
|
132
132
|
});
|
|
133
133
|
});
|
|
@@ -123,7 +123,7 @@ describe('Test TwoButtonTemplate', () => {
|
|
|
123
123
|
expect(touchableOpacities.length).toEqual(2);
|
|
124
124
|
await touchableOpacities[0].props.onPress();
|
|
125
125
|
await touchableOpacities[1].props.onPress();
|
|
126
|
-
expect(mockDoAction).
|
|
126
|
+
expect(mockDoAction).toHaveBeenCalled();
|
|
127
127
|
});
|
|
128
128
|
|
|
129
129
|
it('render TouchableOpacity TwoButtonTemplate without is_on_value', async () => {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
3
|
|
|
4
|
+
import Modal from 'react-native-modal';
|
|
4
5
|
import ActionTemplate from '..';
|
|
6
|
+
import AccessibilityLabel from '../../../configs/AccessibilityLabel';
|
|
5
7
|
import { SCProvider } from '../../../context';
|
|
6
8
|
import { mockSCStore } from '../../../context/mockStore';
|
|
7
9
|
import SelectActionCard from '../../SelectActionCard';
|
|
8
|
-
import Modal from 'react-native-modal';
|
|
9
|
-
import ThreeButtonAction from '../ThreeButtonAction';
|
|
10
|
-
import AccessibilityLabel from '../../../configs/AccessibilityLabel';
|
|
11
10
|
import Text from '../../Text';
|
|
11
|
+
import ThreeButtonAction from '../ThreeButtonAction';
|
|
12
12
|
import { showAllCards } from './utils';
|
|
13
13
|
|
|
14
14
|
const mockOnSelectAction = jest.fn();
|
|
@@ -81,7 +81,7 @@ describe('Test ActionTemplate', () => {
|
|
|
81
81
|
template: 'three_button_action_template',
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
|
-
expect(mockOnSelectAction).
|
|
84
|
+
expect(mockOnSelectAction).toHaveBeenCalledWith({
|
|
85
85
|
action: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
86
86
|
action_name: 'OPEN',
|
|
87
87
|
data: null,
|
|
@@ -1,6 +1,6 @@
|
|
|
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
5
|
import { SCProvider } from '../../../context';
|
|
6
6
|
import { mockSCStore } from '../../../context/mockStore';
|
|
@@ -41,6 +41,6 @@ describe('Test ItemAutomate', () => {
|
|
|
41
41
|
await act(async () => {
|
|
42
42
|
touchableOpacities[0].props.onPress();
|
|
43
43
|
});
|
|
44
|
-
expect(mockOnPress).
|
|
44
|
+
expect(mockOnPress).toHaveBeenCalledTimes(1);
|
|
45
45
|
});
|
|
46
46
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { TouchableOpacity } from 'react-native';
|
|
2
3
|
import { act, create } from 'react-test-renderer';
|
|
3
4
|
import { SCProvider } from '../../../context';
|
|
4
5
|
import { mockSCStore } from '../../../context/mockStore';
|
|
5
6
|
import ChartAggregationOption from '../index';
|
|
6
|
-
import { TouchableOpacity } from 'react-native';
|
|
7
7
|
|
|
8
8
|
const wrapComponent = (props) => (
|
|
9
9
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -31,7 +31,7 @@ it('test', async () => {
|
|
|
31
31
|
await act(async () => {
|
|
32
32
|
await buttons[index].props.onPress();
|
|
33
33
|
});
|
|
34
|
-
expect(mockSetGroupBy).
|
|
34
|
+
expect(mockSetGroupBy).toHaveBeenCalledWith(data);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
await clickButton(0, 'date');
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React, { useContext } from 'react';
|
|
2
3
|
import { act, create } from 'react-test-renderer';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { Text, TouchableOpacity } from 'react-native';
|
|
6
|
+
import { API } from '../../../../configs';
|
|
7
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
8
8
|
import { SCProvider } from '../../../../context';
|
|
9
|
+
import { Action } from '../../../../context/actionType';
|
|
9
10
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
10
|
-
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
11
|
-
import { API } from '../../../../configs';
|
|
12
|
-
import { TouchableOpacity } from 'react-native';
|
|
13
11
|
import api from '../../../../utils/Apis/axios';
|
|
12
|
+
import { getTranslate } from '../../../../utils/I18n';
|
|
14
13
|
import SharedUnit from '../../../Unit/SharedUnit';
|
|
15
|
-
import
|
|
14
|
+
import MyPinnedSharedUnit from '../index';
|
|
16
15
|
|
|
17
16
|
const mock = new MockAdapter(api.axiosInstance);
|
|
18
17
|
|
|
@@ -61,7 +60,7 @@ describe('Test MyPinnedSharedUnit', () => {
|
|
|
61
60
|
goToAllSharedUnits.props.onPress();
|
|
62
61
|
});
|
|
63
62
|
expect(global.mockedNavigate).toHaveBeenCalled();
|
|
64
|
-
expect(mockSetAction).
|
|
63
|
+
expect(mockSetAction).toHaveBeenCalledWith(
|
|
65
64
|
Action.IS_CHECK_CLEAR_CACHE_UNITS,
|
|
66
65
|
false
|
|
67
66
|
);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
4
|
|
|
5
|
+
import FastImage from 'react-native-fast-image';
|
|
5
6
|
import MyUnit from '..';
|
|
6
|
-
import
|
|
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';
|
|
11
|
+
import { flushPromises } from '../../../../screens/AllGateway/test-utils';
|
|
12
|
+
import MyUnitDevice from '../../../../screens/Unit/components/MyUnitDevice';
|
|
10
13
|
import api from '../../../../utils/Apis/axios';
|
|
11
|
-
import { API } from '../../../../configs';
|
|
12
14
|
import Routes from '../../../../utils/Route';
|
|
13
|
-
import { flushPromises } from '../../../../screens/AllGateway/test-utils';
|
|
14
|
-
import FastImage from 'react-native-fast-image';
|
|
15
15
|
import { removeMultiple, STORAGE_KEY } from '../../../../utils/Storage';
|
|
16
16
|
|
|
17
17
|
const mock = new MockAdapter(api.axiosInstance);
|
|
@@ -103,7 +103,7 @@ describe('Test MyUnit', () => {
|
|
|
103
103
|
await act(async () => {
|
|
104
104
|
await button.props.onPress(data[0]);
|
|
105
105
|
});
|
|
106
|
-
expect(global.mockedNavigate).
|
|
106
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.UnitStack, {
|
|
107
107
|
params: { unitId: 1 },
|
|
108
108
|
screen: Routes.UnitDetail,
|
|
109
109
|
});
|
|
@@ -123,7 +123,7 @@ describe('Test MyUnit', () => {
|
|
|
123
123
|
await act(async () => {
|
|
124
124
|
await button.props.onPress(data[1]);
|
|
125
125
|
});
|
|
126
|
-
expect(global.mockedNavigate).
|
|
126
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith('UnitStack', {
|
|
127
127
|
params: { unitId: 2 },
|
|
128
128
|
screen: 'UnitDetail',
|
|
129
129
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { TouchableWithoutFeedback } from 'react-native';
|
|
3
4
|
import renderer, { act } from 'react-test-renderer';
|
|
4
|
-
import ItemHanetDevice from './ItemHanetDevice';
|
|
5
5
|
import { SCProvider } from '../../../context';
|
|
6
6
|
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
-
import
|
|
7
|
+
import ItemHanetDevice from './ItemHanetDevice';
|
|
8
8
|
|
|
9
9
|
const wrapComponent = (props) => (
|
|
10
10
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -35,7 +35,7 @@ describe('Test ItemHanetDevice', () => {
|
|
|
35
35
|
await act(async () => {
|
|
36
36
|
tree = touches[0].props.onPress();
|
|
37
37
|
});
|
|
38
|
-
expect(navigate).
|
|
38
|
+
expect(navigate).toHaveBeenCalled();
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
it('render ItemHanetDevice sensor has icon', async () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { act, create } from 'react-test-renderer';
|
|
3
3
|
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
4
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
5
4
|
import { SCProvider } from '../../../../context';
|
|
5
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
6
|
import PasscodeField from '../index';
|
|
7
7
|
|
|
8
8
|
const mockSetDataForm = jest.fn();
|
|
@@ -59,7 +59,7 @@ describe('Test PasscodeField', () => {
|
|
|
59
59
|
await act(async () => {
|
|
60
60
|
await inputPasscode.props.onChangeText('123');
|
|
61
61
|
});
|
|
62
|
-
expect(mockSetDataForm).
|
|
62
|
+
expect(mockSetDataForm).toHaveBeenCalledWith([
|
|
63
63
|
{
|
|
64
64
|
key: 'passcode',
|
|
65
65
|
type: 'passcode',
|
|
@@ -74,7 +74,7 @@ describe('Test PasscodeField', () => {
|
|
|
74
74
|
await act(async () => {
|
|
75
75
|
await inputPasscode.props.onChangeText('123456');
|
|
76
76
|
});
|
|
77
|
-
expect(mockSetDataForm).
|
|
77
|
+
expect(mockSetDataForm).toHaveBeenCalledWith([
|
|
78
78
|
{
|
|
79
79
|
key: 'passcode',
|
|
80
80
|
type: 'passcode',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { TouchableOpacity } from 'react-native';
|
|
2
3
|
import { act, create } from 'react-test-renderer';
|
|
3
|
-
import {
|
|
4
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
4
5
|
import { SCProvider } from '../../../../context';
|
|
6
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
5
7
|
import ScheduleField from '../index';
|
|
6
|
-
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
7
|
-
import { TouchableOpacity } from 'react-native';
|
|
8
8
|
|
|
9
9
|
const mockSetDataForm = jest.fn();
|
|
10
10
|
|
|
@@ -69,7 +69,7 @@ describe('Test ScheduleField', () => {
|
|
|
69
69
|
await act(async () => {
|
|
70
70
|
await recurring.props.onPress();
|
|
71
71
|
});
|
|
72
|
-
expect(mockSetDataForm).
|
|
72
|
+
expect(mockSetDataForm).toHaveBeenCalledWith([
|
|
73
73
|
{
|
|
74
74
|
key: 'schedule',
|
|
75
75
|
type: 'schedule',
|
|
@@ -99,7 +99,7 @@ describe('Test ScheduleField', () => {
|
|
|
99
99
|
await schedule.props.onPress();
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
-
expect(mockSetDataForm).
|
|
102
|
+
expect(mockSetDataForm).toHaveBeenCalledWith([
|
|
103
103
|
{
|
|
104
104
|
key: 'schedule',
|
|
105
105
|
type: 'schedule',
|
|
@@ -152,7 +152,7 @@ describe('Test ScheduleField', () => {
|
|
|
152
152
|
await act(async () => {
|
|
153
153
|
tree = await create(wrapComponent());
|
|
154
154
|
});
|
|
155
|
-
expect(mockSetDataForm).
|
|
155
|
+
expect(mockSetDataForm).toHaveBeenCalledWith([
|
|
156
156
|
{
|
|
157
157
|
key: 'schedule',
|
|
158
158
|
type: 'schedule',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import renderer, { act } from 'react-test-renderer';
|
|
3
2
|
import DraggableFlatList from 'react-native-draggable-flatlist';
|
|
3
|
+
import renderer, { act } from 'react-test-renderer';
|
|
4
4
|
|
|
5
|
-
import FlatListDnD from '../index';
|
|
6
5
|
import { SCProvider } from '../../../context';
|
|
7
6
|
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
+
import FlatListDnD from '../index';
|
|
8
8
|
|
|
9
9
|
const wrapComponent = ({ ...rest }) => (
|
|
10
10
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -31,7 +31,7 @@ describe('Test FlatListDnD', () => {
|
|
|
31
31
|
await act(async () => {
|
|
32
32
|
draggableFlatList[0].props.onDragEnd({ data: [{ id: 2 }, { id: 1 }] });
|
|
33
33
|
});
|
|
34
|
-
expect(setData).
|
|
34
|
+
expect(setData).toHaveBeenCalledWith([{ id: 2 }, { id: 1 }]);
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
it('render FlatListDnD onDragEnd', async () => {
|
|
@@ -44,6 +44,6 @@ describe('Test FlatListDnD', () => {
|
|
|
44
44
|
await act(async () => {
|
|
45
45
|
draggableFlatList[0].props.onDragEnd({ data: [{ id: 2 }, { id: 1 }] });
|
|
46
46
|
});
|
|
47
|
-
expect(setData).
|
|
47
|
+
expect(setData).toHaveBeenCalledWith([{ id: 2 }, { id: 1 }]);
|
|
48
48
|
});
|
|
49
49
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
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 { AccessibilityLabel } from '../../../configs/Constants';
|
|
6
5
|
import GroupCheckBox from '..';
|
|
6
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
7
7
|
|
|
8
8
|
describe('Test Group CheckBox', () => {
|
|
9
9
|
let tree;
|
|
@@ -59,7 +59,7 @@ describe('Test Group CheckBox', () => {
|
|
|
59
59
|
await act(async () => {
|
|
60
60
|
buttons[0].props.onPress();
|
|
61
61
|
});
|
|
62
|
-
expect(mockFunc).
|
|
62
|
+
expect(mockFunc).toHaveBeenCalledTimes(2);
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('render Group CheckBox with foundIndex === -1 multiple false', async () => {
|