@eohjsc/react-native-smart-city 0.7.3-rc7 → 0.7.3-rc9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/commons/Action/__test__/ItemQuickAction.test.js +5 -5
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +5 -5
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonCircle.test.js +2 -2
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonDefault.test.js +2 -2
- package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +9 -10
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +5 -5
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +5 -5
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +8 -8
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +6 -6
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +1 -1
- package/src/commons/ActionTemplate/__test__/index.test.js +4 -4
- package/src/commons/Automate/__test__/ItemAutomate.test.js +2 -2
- package/src/commons/ChartAggregationOption/__test__/FourButtonFilterHistory.test.js +2 -2
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +8 -9
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +7 -7
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +1 -1
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -3
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -3
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +6 -6
- package/src/commons/FlatListDnD/__test__/index.test.js +4 -4
- package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +3 -3
- package/src/commons/Header/__test__/HeaderCT.test.js +3 -3
- package/src/commons/IconComponent/index.js +1 -1
- package/src/commons/ImagePicker/__test__/ImagePicker.test.js +5 -5
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +6 -4
- package/src/commons/Popover/__test__/index.test.js +3 -3
- package/src/commons/Processing/__test__/Connecting.test.js +4 -4
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +5 -5
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +8 -8
- package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +1 -1
- package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +5 -5
- package/src/hooks/IoT/__test__/useHomeAssistantConnection.test.js +12 -12
- package/src/hooks/IoT/__test__/useWatchConfigs.test.js +3 -3
- package/src/iot/RemoteControl/__test__/Internet.test.js +7 -7
- package/src/screens/AddLocationMaps/__test__/index.test.js +12 -12
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -7
- package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +8 -8
- package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +7 -7
- package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +8 -8
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +5 -5
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +4 -4
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -6
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -6
- package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +2 -2
- package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +19 -17
- package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +19 -17
- package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +18 -16
- package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +43 -35
- package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +13 -13
- package/src/screens/AllGateway/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +3 -3
- package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/hooks/__test__/index.test.js +2 -2
- package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +3 -3
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptDelay.test.js +9 -9
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +10 -10
- package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +11 -8
- package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +8 -8
- package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +6 -6
- package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +7 -7
- package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +6 -6
- package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +6 -6
- package/src/screens/Automate/ScriptDetail/__test__/useStarredScript.test.js +6 -6
- package/src/screens/Automate/ScriptDetail/index.js +18 -18
- package/src/screens/Automate/SetSchedule/__test__/SelectWeekday.test.js +4 -4
- package/src/screens/Automate/SetSchedule/__test__/index.test.js +10 -10
- package/src/screens/ChangePosition/__test__/index.test.js +6 -6
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +9 -9
- package/src/screens/Device/__test__/detail.test.js +12 -12
- package/src/screens/Device/__test__/mqttDetail.test.js +9 -9
- package/src/screens/Drawer/Drawer.test.js +2 -2
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -7
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +8 -8
- package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +3 -3
- package/src/screens/HanetCamera/__test__/Detail.test.js +9 -9
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -10
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +9 -9
- package/src/screens/Notification/__test__/Notification.test.js +9 -9
- package/src/screens/Notification/components/NotificationItem.js +1 -2
- package/src/screens/Notification/styles/NotificationItemStyles.js +0 -1
- package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
- package/src/screens/SelectUnit/__test__/index.test.js +7 -7
- package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +7 -7
- package/src/screens/SideMenuDetail/__test__/index.test.js +8 -8
- package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +8 -8
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +7 -7
- package/src/screens/SmartAccount/__test__/Connecting.test.js +6 -6
- package/src/screens/SmartAccount/__test__/SmartAccount.test.js +10 -10
- package/src/screens/SubUnit/AddSubUnit.js +2 -4
- package/src/screens/Template/__test__/EditTemplate.test.js +7 -7
- package/src/screens/Template/__test__/detail.test.js +4 -4
- package/src/screens/Template/__test__/index.test.js +1 -1
- package/src/screens/Unit/Station/__test__/index.test.js +1 -1
- package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +9 -9
- package/src/screens/Unit/__test__/SelectAddress.test.js +10 -0
- package/src/screens/Unit/__test__/Summaries.test.js +7 -7
- package/src/screens/Unit/components/__test__/AutomateScript.test.js +3 -3
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +8 -8
- package/src/screens/Unit/hook/__test__/useUnitConnectRemoteDevices.test.js +2 -2
- package/src/utils/__test__/Utils.test.js +16 -16
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { act, create } from 'react-test-renderer';
|
|
3
3
|
|
|
4
|
-
import SelectModbusGateway from '../SelectModbusGateway';
|
|
5
|
-
import { SCProvider } from '../../../context';
|
|
6
|
-
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
-
import SelectGateway from '../../../commons/SelectGateway';
|
|
8
|
-
import Routes from '../../../utils/Route';
|
|
9
4
|
import { useNavigation } from '@react-navigation/native';
|
|
10
5
|
import MockAdapter from 'axios-mock-adapter';
|
|
6
|
+
import SelectGateway from '../../../commons/SelectGateway';
|
|
7
|
+
import { SCProvider } from '../../../context';
|
|
8
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
11
9
|
import api from '../../../utils/Apis/axios';
|
|
10
|
+
import Routes from '../../../utils/Route';
|
|
11
|
+
import SelectModbusGateway from '../SelectModbusGateway';
|
|
12
12
|
|
|
13
13
|
new MockAdapter(api.axiosInstance);
|
|
14
14
|
|
|
@@ -60,7 +60,7 @@ describe('Test select modbus gateway', () => {
|
|
|
60
60
|
selectGateway.props.onPressNext({ id: 3 });
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
expect(global.mockedNavigate).
|
|
63
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
64
64
|
Routes.ConnectingModbusDevice,
|
|
65
65
|
{
|
|
66
66
|
unit: {
|
|
@@ -1,14 +1,14 @@
|
|
|
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 MockAdapter from 'axios-mock-adapter';
|
|
6
|
+
import SelectGateway from '../../../commons/SelectGateway';
|
|
5
7
|
import { SCProvider } from '../../../context';
|
|
6
8
|
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
-
import SelectGateway from '../../../commons/SelectGateway';
|
|
8
|
-
import Routes from '../../../utils/Route';
|
|
9
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
10
9
|
import api from '../../../utils/Apis/axios';
|
|
11
|
-
import
|
|
10
|
+
import Routes from '../../../utils/Route';
|
|
11
|
+
import SelectZigbeeGateway from '../SelectZigbeeGateway';
|
|
12
12
|
|
|
13
13
|
new MockAdapter(api.axiosInstance);
|
|
14
14
|
|
|
@@ -60,7 +60,7 @@ describe('Test select zigbee gateway', () => {
|
|
|
60
60
|
selectGateway.props.onPressNext({ id: 3 });
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
expect(global.mockedNavigate).
|
|
63
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
64
64
|
Routes.ZigbeeDeviceConnectGuide,
|
|
65
65
|
{
|
|
66
66
|
unit: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { act, renderHook } from '@testing-library/react-hooks';
|
|
2
2
|
|
|
3
|
-
import { useWifiManage } from '../useWifiManage';
|
|
4
3
|
import WifiManager from 'react-native-wifi-reborn';
|
|
4
|
+
import { useWifiManage } from '../useWifiManage';
|
|
5
5
|
|
|
6
6
|
describe('Test useWifiManage', () => {
|
|
7
7
|
it('test getCurrentWifiSSID', async () => {
|
|
@@ -18,6 +18,6 @@ describe('Test useWifiManage', () => {
|
|
|
18
18
|
await act(async () => {
|
|
19
19
|
await result.current.disconnectWifi(123);
|
|
20
20
|
});
|
|
21
|
-
expect(WifiManager.disconnectFromSSID).
|
|
21
|
+
expect(WifiManager.disconnectFromSSID).toHaveBeenCalledWith(123);
|
|
22
22
|
});
|
|
23
23
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
1
|
import { useRoute } from '@react-navigation/native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { act, create } from 'react-test-renderer';
|
|
4
4
|
|
|
5
|
+
import DetailConfigActionModbus from '..';
|
|
5
6
|
import { SCProvider } from '../../../../context';
|
|
6
7
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
7
|
-
import DetailConfigAction from '../../components/DetailConfigAction';
|
|
8
|
-
import DetailActionModbus from '../../components/DetailActionModbus';
|
|
9
8
|
import Routes from '../../../../utils/Route';
|
|
10
|
-
import
|
|
9
|
+
import DetailActionModbus from '../../components/DetailActionModbus';
|
|
10
|
+
import DetailConfigAction from '../../components/DetailConfigAction';
|
|
11
11
|
|
|
12
12
|
const wrapComponent = () => (
|
|
13
13
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -93,7 +93,7 @@ describe('Test DetailConfigActionZigbee', () => {
|
|
|
93
93
|
})();
|
|
94
94
|
});
|
|
95
95
|
expect(detailActionModbus).toHaveLength(1);
|
|
96
|
-
expect(global.mockedNavigate).
|
|
96
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
97
97
|
Routes.DetailChildConfigActionModbus,
|
|
98
98
|
{
|
|
99
99
|
isChildAction: true,
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
-
import { useRoute } from '@react-navigation/native';
|
|
5
1
|
import SegmentedControl from '@react-native-segmented-control/segmented-control';
|
|
2
|
+
import { useRoute } from '@react-navigation/native';
|
|
3
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
+
import React from 'react';
|
|
6
5
|
import Toast from 'react-native-toast-message';
|
|
6
|
+
import { act, create } from 'react-test-renderer';
|
|
7
7
|
|
|
8
|
-
import { SCProvider } from '../../../../context';
|
|
9
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
10
8
|
import DeviceInternalDetail from '..';
|
|
11
9
|
import { HeaderCustom } from '../../../../commons';
|
|
12
|
-
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
13
|
-
import Routes from '../../../../utils/Route';
|
|
14
|
-
import TabPaneCT from '../../components/TabPaneCT';
|
|
15
10
|
import MenuActionMore from '../../../../commons/MenuActionMore';
|
|
16
|
-
import
|
|
11
|
+
import ModalPopupCT from '../../../../commons/ModalPopupCT';
|
|
17
12
|
import { API } from '../../../../configs';
|
|
18
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
AccessibilityLabel,
|
|
15
|
+
PERMISSION_TYPE,
|
|
16
|
+
} from '../../../../configs/Constants';
|
|
17
|
+
import { SCProvider } from '../../../../context';
|
|
18
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
19
|
+
import api from '../../../../utils/Apis/axios';
|
|
20
|
+
import Routes from '../../../../utils/Route';
|
|
19
21
|
import Detail from '../../components/Detail';
|
|
20
|
-
import
|
|
22
|
+
import TabPaneCT from '../../components/TabPaneCT';
|
|
21
23
|
import { fetchGatewayCT, flushPromises } from '../../test-utils';
|
|
22
24
|
|
|
23
25
|
const mock = new MockAdapter(api.axiosInstance);
|
|
@@ -167,8 +169,8 @@ describe('Test DeviceInternalDetail', () => {
|
|
|
167
169
|
await act(async () => {
|
|
168
170
|
await modal.props.onPressConfirm();
|
|
169
171
|
});
|
|
170
|
-
expect(global.mockedPop).
|
|
171
|
-
expect(Toast.show).
|
|
172
|
+
expect(global.mockedPop).toHaveBeenCalledWith(1);
|
|
173
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
172
174
|
position: 'bottom',
|
|
173
175
|
text1: 'Delete successfully!',
|
|
174
176
|
text2: undefined,
|
|
@@ -253,7 +255,7 @@ describe('Test DeviceInternalDetail', () => {
|
|
|
253
255
|
await act(async () => {
|
|
254
256
|
await detail.props.onPressRow(1);
|
|
255
257
|
});
|
|
256
|
-
expect(global.mockedNavigate).
|
|
258
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
257
259
|
Routes.DetailConfigActionInternal,
|
|
258
260
|
{
|
|
259
261
|
device: {
|
|
@@ -307,7 +309,7 @@ describe('Test DeviceInternalDetail', () => {
|
|
|
307
309
|
await act(async () => {
|
|
308
310
|
await detail.props.onPressRow(1);
|
|
309
311
|
});
|
|
310
|
-
expect(global.mockedNavigate).
|
|
312
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
311
313
|
Routes.DetailConfigActionInternal,
|
|
312
314
|
{
|
|
313
315
|
device: {
|
|
@@ -332,7 +334,7 @@ describe('Test DeviceInternalDetail', () => {
|
|
|
332
334
|
await act(async () => {
|
|
333
335
|
await detail.props.onPressRow(1);
|
|
334
336
|
});
|
|
335
|
-
expect(global.mockedNavigate).
|
|
337
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
336
338
|
Routes.DetailConfigActionInternal,
|
|
337
339
|
{
|
|
338
340
|
device: {
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
-
import { useRoute } from '@react-navigation/native';
|
|
5
1
|
import SegmentedControl from '@react-native-segmented-control/segmented-control';
|
|
2
|
+
import { useRoute } from '@react-navigation/native';
|
|
3
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
+
import React from 'react';
|
|
6
5
|
import Toast from 'react-native-toast-message';
|
|
6
|
+
import { act, create } from 'react-test-renderer';
|
|
7
7
|
|
|
8
|
-
import { SCProvider } from '../../../../context';
|
|
9
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
10
8
|
import DeviceModbusDetail from '..';
|
|
11
9
|
import { HeaderCustom } from '../../../../commons';
|
|
12
|
-
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
13
|
-
import Routes from '../../../../utils/Route';
|
|
14
|
-
import TabPaneCT from '../../components/TabPaneCT';
|
|
15
10
|
import MenuActionMore from '../../../../commons/MenuActionMore';
|
|
16
|
-
import
|
|
11
|
+
import ModalPopupCT from '../../../../commons/ModalPopupCT';
|
|
17
12
|
import { API } from '../../../../configs';
|
|
18
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
AccessibilityLabel,
|
|
15
|
+
PERMISSION_TYPE,
|
|
16
|
+
} from '../../../../configs/Constants';
|
|
17
|
+
import { SCProvider } from '../../../../context';
|
|
18
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
19
|
+
import api from '../../../../utils/Apis/axios';
|
|
20
|
+
import Routes from '../../../../utils/Route';
|
|
19
21
|
import Detail from '../../components/Detail';
|
|
20
|
-
import
|
|
22
|
+
import TabPaneCT from '../../components/TabPaneCT';
|
|
21
23
|
import { fetchGatewayCT, flushPromises } from '../../test-utils';
|
|
22
24
|
|
|
23
25
|
const mock = new MockAdapter(api.axiosInstance);
|
|
@@ -141,8 +143,8 @@ describe('Test DeviceModbusDetail', () => {
|
|
|
141
143
|
});
|
|
142
144
|
await flushPromises();
|
|
143
145
|
|
|
144
|
-
expect(global.mockedPop).
|
|
145
|
-
expect(Toast.show).
|
|
146
|
+
expect(global.mockedPop).toHaveBeenCalledWith(1);
|
|
147
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
146
148
|
position: 'bottom',
|
|
147
149
|
text1: 'Delete successfully!',
|
|
148
150
|
text2: undefined,
|
|
@@ -228,7 +230,7 @@ describe('Test DeviceModbusDetail', () => {
|
|
|
228
230
|
await act(async () => {
|
|
229
231
|
await detail.props.onPressRow(1);
|
|
230
232
|
});
|
|
231
|
-
expect(global.mockedNavigate).
|
|
233
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
232
234
|
Routes.DetailConfigActionModbus,
|
|
233
235
|
{
|
|
234
236
|
gatewayId: 1,
|
|
@@ -262,7 +264,7 @@ describe('Test DeviceModbusDetail', () => {
|
|
|
262
264
|
await act(async () => {
|
|
263
265
|
await detail.props.onPressRow(1);
|
|
264
266
|
});
|
|
265
|
-
expect(global.mockedNavigate).
|
|
267
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
266
268
|
Routes.DetailConfigActionModbus,
|
|
267
269
|
{
|
|
268
270
|
gatewayId: 1,
|
|
@@ -289,7 +291,7 @@ describe('Test DeviceModbusDetail', () => {
|
|
|
289
291
|
await act(async () => {
|
|
290
292
|
await detail.props.onPressRow(1);
|
|
291
293
|
});
|
|
292
|
-
expect(global.mockedNavigate).
|
|
294
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
293
295
|
Routes.DetailConfigActionModbus,
|
|
294
296
|
{
|
|
295
297
|
gatewayId: 1,
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
-
import Toast from 'react-native-toast-message';
|
|
5
1
|
import SegmentedControl from '@react-native-segmented-control/segmented-control';
|
|
6
2
|
import { useRoute } from '@react-navigation/native';
|
|
3
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import Toast from 'react-native-toast-message';
|
|
6
|
+
import { act, create } from 'react-test-renderer';
|
|
7
7
|
|
|
8
|
-
import { SCProvider } from '../../../../context';
|
|
9
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
10
8
|
import DeviceZigbeeDetail from '..';
|
|
11
9
|
import { HeaderCustom } from '../../../../commons';
|
|
12
|
-
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
13
|
-
import Routes from '../../../../utils/Route';
|
|
14
|
-
import TabPaneCT from '../../components/TabPaneCT';
|
|
15
10
|
import MenuActionMore from '../../../../commons/MenuActionMore';
|
|
16
|
-
import
|
|
11
|
+
import ModalPopupCT from '../../../../commons/ModalPopupCT';
|
|
17
12
|
import { API } from '../../../../configs';
|
|
18
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
AccessibilityLabel,
|
|
15
|
+
PERMISSION_TYPE,
|
|
16
|
+
} from '../../../../configs/Constants';
|
|
17
|
+
import { SCProvider } from '../../../../context';
|
|
18
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
19
|
+
import api from '../../../../utils/Apis/axios';
|
|
20
|
+
import Routes from '../../../../utils/Route';
|
|
19
21
|
import Detail from '../../components/Detail';
|
|
20
|
-
import
|
|
22
|
+
import TabPaneCT from '../../components/TabPaneCT';
|
|
21
23
|
import { fetchGatewayCT } from '../../test-utils';
|
|
22
24
|
|
|
23
25
|
const mock = new MockAdapter(api.axiosInstance);
|
|
@@ -127,8 +129,8 @@ describe('Test DeviceZigbeeDetail', () => {
|
|
|
127
129
|
await modal.props.onPressConfirm();
|
|
128
130
|
});
|
|
129
131
|
|
|
130
|
-
expect(global.mockedPop).
|
|
131
|
-
expect(Toast.show).
|
|
132
|
+
expect(global.mockedPop).toHaveBeenCalledWith(1);
|
|
133
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
132
134
|
position: 'bottom',
|
|
133
135
|
text1: 'Delete successfully!',
|
|
134
136
|
text2: undefined,
|
|
@@ -184,7 +186,7 @@ describe('Test DeviceZigbeeDetail', () => {
|
|
|
184
186
|
await act(async () => {
|
|
185
187
|
await detail.props.onPressRow(1);
|
|
186
188
|
});
|
|
187
|
-
expect(global.mockedNavigate).
|
|
189
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
188
190
|
Routes.DetailConfigActionZigbee,
|
|
189
191
|
{
|
|
190
192
|
gatewayId: 1,
|
|
@@ -211,7 +213,7 @@ describe('Test DeviceZigbeeDetail', () => {
|
|
|
211
213
|
await act(async () => {
|
|
212
214
|
await detail.props.onPressRow(1);
|
|
213
215
|
});
|
|
214
|
-
expect(global.mockedNavigate).
|
|
216
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
215
217
|
Routes.DetailConfigActionZigbee,
|
|
216
218
|
{
|
|
217
219
|
gatewayId: 1,
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
|
-
import Toast from 'react-native-toast-message';
|
|
4
1
|
import SegmentedControl from '@react-native-segmented-control/segmented-control';
|
|
5
2
|
import { useRoute } from '@react-navigation/native';
|
|
6
3
|
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import Toast from 'react-native-toast-message';
|
|
6
|
+
import { act, create } from 'react-test-renderer';
|
|
7
7
|
|
|
8
|
-
import { SCProvider } from '../../../../context';
|
|
9
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
10
8
|
import GatewayDetail from '..';
|
|
11
9
|
import { HeaderCustom } from '../../../../commons';
|
|
12
|
-
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
13
|
-
import Routes from '../../../../utils/Route';
|
|
14
|
-
import TabPaneCT from '../../components/TabPaneCT';
|
|
15
10
|
import MenuActionMore from '../../../../commons/MenuActionMore';
|
|
16
|
-
import
|
|
11
|
+
import ModalPopupCT from '../../../../commons/ModalPopupCT';
|
|
17
12
|
import { API } from '../../../../configs';
|
|
18
|
-
import { DEVICE_TYPE } from '../../../../configs/Constants';
|
|
13
|
+
import { AccessibilityLabel, DEVICE_TYPE } from '../../../../configs/Constants';
|
|
14
|
+
import { SCProvider } from '../../../../context';
|
|
15
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
16
|
+
import api from '../../../../utils/Apis/axios';
|
|
17
|
+
import Routes from '../../../../utils/Route';
|
|
19
18
|
import Detail from '../../components/Detail';
|
|
20
|
-
import
|
|
19
|
+
import TabPaneCT from '../../components/TabPaneCT';
|
|
21
20
|
import { flushPromises } from '../../test-utils';
|
|
22
21
|
|
|
23
22
|
const mock = new MockAdapter(api.axiosInstance);
|
|
@@ -149,7 +148,7 @@ describe('Test GatewayDetail', () => {
|
|
|
149
148
|
await act(async () => {
|
|
150
149
|
await modal.props.onPressConfirm();
|
|
151
150
|
});
|
|
152
|
-
expect(global.mockedPop).
|
|
151
|
+
expect(global.mockedPop).toHaveBeenCalledWith(1);
|
|
153
152
|
});
|
|
154
153
|
|
|
155
154
|
it('test render GatewayDetail onPress more and onPress Delete', async () => {
|
|
@@ -170,7 +169,7 @@ describe('Test GatewayDetail', () => {
|
|
|
170
169
|
await act(async () => {
|
|
171
170
|
await modal.props.onPressConfirm();
|
|
172
171
|
});
|
|
173
|
-
expect(global.mockedPop).
|
|
172
|
+
expect(global.mockedPop).toHaveBeenCalledWith(1);
|
|
174
173
|
});
|
|
175
174
|
|
|
176
175
|
it('test render GatewayDetail onPress TabPanel internal', async () => {
|
|
@@ -221,13 +220,16 @@ describe('Test GatewayDetail', () => {
|
|
|
221
220
|
await act(async () => {
|
|
222
221
|
await detail.props.onPressRow(1);
|
|
223
222
|
});
|
|
224
|
-
expect(global.mockedNavigate).
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
223
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
224
|
+
Routes.DeviceInternalDetail,
|
|
225
|
+
{
|
|
226
|
+
device: 1,
|
|
227
|
+
gatewayId: 1,
|
|
228
|
+
isInternal: true,
|
|
229
|
+
isModbus: false,
|
|
230
|
+
isZigbee: false,
|
|
231
|
+
}
|
|
232
|
+
);
|
|
231
233
|
});
|
|
232
234
|
|
|
233
235
|
it('test render GatewayDetail onPress TabPanel zigbee onPressRow', async () => {
|
|
@@ -235,13 +237,16 @@ describe('Test GatewayDetail', () => {
|
|
|
235
237
|
await act(async () => {
|
|
236
238
|
await detail.props.onPressRow(1);
|
|
237
239
|
});
|
|
238
|
-
expect(global.mockedNavigate).
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
240
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
241
|
+
Routes.DeviceZigbeeDetail,
|
|
242
|
+
{
|
|
243
|
+
device: 1,
|
|
244
|
+
gatewayId: 1,
|
|
245
|
+
isInternal: false,
|
|
246
|
+
isModbus: false,
|
|
247
|
+
isZigbee: true,
|
|
248
|
+
}
|
|
249
|
+
);
|
|
245
250
|
});
|
|
246
251
|
|
|
247
252
|
it('test render GatewayDetail onPress TabPanel modbus onPressRow', async () => {
|
|
@@ -250,13 +255,16 @@ describe('Test GatewayDetail', () => {
|
|
|
250
255
|
await act(async () => {
|
|
251
256
|
await detail.props.onPressRow(1);
|
|
252
257
|
});
|
|
253
|
-
expect(global.mockedNavigate).
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
259
|
+
Routes.DeviceModbusDetail,
|
|
260
|
+
{
|
|
261
|
+
device: 1,
|
|
262
|
+
gatewayId: 1,
|
|
263
|
+
isInternal: false,
|
|
264
|
+
isModbus: true,
|
|
265
|
+
isZigbee: false,
|
|
266
|
+
}
|
|
267
|
+
);
|
|
260
268
|
});
|
|
261
269
|
|
|
262
270
|
it('test render GatewayDetail onPress TabPanel error onPressRow', async () => {
|
|
@@ -274,7 +282,7 @@ describe('Test GatewayDetail', () => {
|
|
|
274
282
|
await act(async () => {
|
|
275
283
|
await detail.props.onPressRow(1);
|
|
276
284
|
});
|
|
277
|
-
expect(global.mockedNavigate).
|
|
285
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith('', {
|
|
278
286
|
device: 1,
|
|
279
287
|
gatewayId: null,
|
|
280
288
|
isInternal: false,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
import { useRoute } from '@react-navigation/native';
|
|
2
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
3
|
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
4
|
import { FlatList } from 'react-native';
|
|
4
|
-
import
|
|
5
|
-
import { useRoute } from '@react-navigation/native';
|
|
5
|
+
import { act, create } from 'react-test-renderer';
|
|
6
6
|
|
|
7
|
-
import { SCProvider } from '../../../../context';
|
|
8
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
9
|
-
import { HeaderCustom, Text } from '../../../../commons';
|
|
10
|
-
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
11
|
-
import API from '../../../../configs/API';
|
|
12
|
-
import Routes from '../../../../utils/Route';
|
|
13
|
-
import api from '../../../../utils/Apis/axios';
|
|
14
7
|
import GatewayInfo from '..';
|
|
15
|
-
import
|
|
8
|
+
import { HeaderCustom, Text } from '../../../../commons';
|
|
16
9
|
import ModalPopupCT from '../../../../commons/ModalPopupCT';
|
|
17
10
|
import { SCConfig } from '../../../../configs';
|
|
11
|
+
import API from '../../../../configs/API';
|
|
12
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
13
|
+
import { SCProvider } from '../../../../context';
|
|
14
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
15
|
+
import t from '../../../../hooks/Common/useTranslations';
|
|
16
|
+
import api from '../../../../utils/Apis/axios';
|
|
17
|
+
import Routes from '../../../../utils/Route';
|
|
18
18
|
|
|
19
19
|
const mock = new MockAdapter(api.axiosInstance);
|
|
20
20
|
const wrapComponent = () => (
|
|
@@ -92,7 +92,7 @@ describe('Test GatewayInfo', () => {
|
|
|
92
92
|
await act(async () => {
|
|
93
93
|
btnConnect.props.onPress();
|
|
94
94
|
});
|
|
95
|
-
expect(global.mockedNavigate).
|
|
95
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
96
96
|
Routes.GatewayConnectionMethods,
|
|
97
97
|
{
|
|
98
98
|
methodsConnection: [],
|
|
@@ -116,6 +116,6 @@ describe('Test GatewayInfo', () => {
|
|
|
116
116
|
await act(async () => {
|
|
117
117
|
await modal.props.onPressConfirm();
|
|
118
118
|
});
|
|
119
|
-
expect(global.mockedPop).
|
|
119
|
+
expect(global.mockedPop).toHaveBeenCalledWith(2);
|
|
120
120
|
});
|
|
121
121
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { FlatList } from 'react-native';
|
|
3
4
|
import { act, create } from 'react-test-renderer';
|
|
4
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
5
5
|
|
|
6
|
+
import Gateway from '..';
|
|
7
|
+
import API from '../../../configs/API';
|
|
8
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
6
9
|
import { SCProvider } from '../../../context';
|
|
7
10
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
|
-
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
9
11
|
import api from '../../../utils/Apis/axios';
|
|
10
|
-
import GatewayItem from '../components/GatewayItem';
|
|
11
|
-
import API from '../../../configs/API';
|
|
12
12
|
import Routes from '../../../utils/Route';
|
|
13
|
-
import
|
|
13
|
+
import GatewayItem from '../components/GatewayItem';
|
|
14
14
|
const mock = new MockAdapter(api.axiosInstance);
|
|
15
15
|
|
|
16
16
|
const wrapComponent = (
|
|
@@ -58,7 +58,7 @@ describe('Test Gateway screen', () => {
|
|
|
58
58
|
await act(async () => {
|
|
59
59
|
await gatewayItems[0].props.onPress();
|
|
60
60
|
});
|
|
61
|
-
expect(global.mockedNavigate).
|
|
61
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.AllGatewayStack, {
|
|
62
62
|
params: {
|
|
63
63
|
item: {
|
|
64
64
|
id: 1,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
import { act, create } from 'react-test-renderer';
|
|
4
4
|
|
|
5
|
+
import GatewayItem from '..';
|
|
5
6
|
import { SCProvider } from '../../../../../context';
|
|
6
7
|
import { mockSCStore } from '../../../../../context/mockStore';
|
|
7
|
-
import GatewayItem from '..';
|
|
8
8
|
|
|
9
9
|
const mockOnPressItem = jest.fn();
|
|
10
10
|
|
|
@@ -67,6 +67,6 @@ describe('Test GatewayItem', () => {
|
|
|
67
67
|
await act(async () => {
|
|
68
68
|
await buttons[0].props.onPress();
|
|
69
69
|
});
|
|
70
|
-
expect(mockOnPressItem).
|
|
70
|
+
expect(mockOnPressItem).toHaveBeenCalledTimes(1);
|
|
71
71
|
});
|
|
72
72
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
1
|
import SegmentedControl from '@react-native-segmented-control/segmented-control';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import Carousel from 'react-native-new-snap-carousel';
|
|
4
|
+
import { act, create } from 'react-test-renderer';
|
|
5
5
|
|
|
6
|
+
import TabPaneCT from '..';
|
|
7
|
+
import { DEVICE_TYPE } from '../../../../../configs/Constants';
|
|
6
8
|
import { SCProvider } from '../../../../../context';
|
|
7
9
|
import { mockSCStore } from '../../../../../context/mockStore';
|
|
8
|
-
import { DEVICE_TYPE } from '../../../../../configs/Constants';
|
|
9
|
-
import TabPaneCT from '..';
|
|
10
10
|
|
|
11
11
|
const mockSetSelectedIndex = jest.fn();
|
|
12
12
|
const wrapComponent = (item = []) => (
|
|
@@ -58,7 +58,7 @@ describe('Test TabPaneCT', () => {
|
|
|
58
58
|
nativeEvent: { selectedSegmentIndex: 1 },
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
-
expect(mockSetSelectedIndex).
|
|
61
|
+
expect(mockSetSelectedIndex).toHaveBeenCalledWith(1);
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
it('test render TabPaneCT onChange Carousel', async () => {
|
|
@@ -72,7 +72,7 @@ describe('Test TabPaneCT', () => {
|
|
|
72
72
|
await act(async () => {
|
|
73
73
|
await carousel[0].props.onSnapToItem(1);
|
|
74
74
|
});
|
|
75
|
-
expect(mockSetSelectedIndex).
|
|
75
|
+
expect(mockSetSelectedIndex).toHaveBeenCalledWith(1);
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
it('test render TabPaneCT none list', async () => {
|
|
@@ -2,8 +2,8 @@ import { act, renderHook } from '@testing-library/react-hooks';
|
|
|
2
2
|
import MockAdapter from 'axios-mock-adapter';
|
|
3
3
|
import Toast from 'react-native-toast-message';
|
|
4
4
|
|
|
5
|
-
import api from '../../../../utils/Apis/axios';
|
|
6
5
|
import { API } from '../../../../configs';
|
|
6
|
+
import api from '../../../../utils/Apis/axios';
|
|
7
7
|
import { useGateway } from '../useGateway';
|
|
8
8
|
|
|
9
9
|
const mock = new MockAdapter(api.axiosInstance);
|
|
@@ -98,7 +98,7 @@ describe('Test useGateway', () => {
|
|
|
98
98
|
await act(async () => {
|
|
99
99
|
await hook.result.current.deleteGatewayDetail(1);
|
|
100
100
|
});
|
|
101
|
-
expect(Toast.show).
|
|
101
|
+
expect(Toast.show).toHaveBeenCalledWith({
|
|
102
102
|
position: 'bottom',
|
|
103
103
|
text1: 'Delete successfully!',
|
|
104
104
|
text2: undefined,
|
|
@@ -391,7 +391,7 @@ describe('Test ChooseAction', () => {
|
|
|
391
391
|
await act(async () => {
|
|
392
392
|
tree = await renderer.create(wrapComponent(route));
|
|
393
393
|
});
|
|
394
|
-
expect(spyToastError).
|
|
394
|
+
expect(spyToastError).toHaveBeenCalledWith(
|
|
395
395
|
getTranslate('en', 'template_not_supported', {
|
|
396
396
|
template: response[0].template,
|
|
397
397
|
}),
|
|
@@ -459,7 +459,7 @@ describe('Test ChooseAction', () => {
|
|
|
459
459
|
await buttonSave.props.onPress();
|
|
460
460
|
});
|
|
461
461
|
|
|
462
|
-
expect(spyToastError).
|
|
462
|
+
expect(spyToastError).toHaveBeenCalledWith(
|
|
463
463
|
'You can only add more 0 action',
|
|
464
464
|
null,
|
|
465
465
|
3000
|
|
@@ -617,7 +617,7 @@ describe('Test ChooseAction', () => {
|
|
|
617
617
|
await buttonSave.props.onPress();
|
|
618
618
|
});
|
|
619
619
|
|
|
620
|
-
expect(spyToastError).
|
|
620
|
+
expect(spyToastError).toHaveBeenCalledWith(
|
|
621
621
|
'You can only add more 2 actions',
|
|
622
622
|
null,
|
|
623
623
|
3000
|