@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.
Files changed (103) hide show
  1. package/package.json +3 -3
  2. package/src/commons/Action/__test__/ItemQuickAction.test.js +5 -5
  3. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +5 -5
  4. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonCircle.test.js +2 -2
  5. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonDefault.test.js +2 -2
  6. package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +9 -10
  7. package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +5 -5
  8. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +5 -5
  9. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +8 -8
  10. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +3 -3
  11. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +6 -6
  12. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +1 -1
  13. package/src/commons/ActionTemplate/__test__/index.test.js +4 -4
  14. package/src/commons/Automate/__test__/ItemAutomate.test.js +2 -2
  15. package/src/commons/ChartAggregationOption/__test__/FourButtonFilterHistory.test.js +2 -2
  16. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +8 -9
  17. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +7 -7
  18. package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +1 -1
  19. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -3
  20. package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -3
  21. package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +6 -6
  22. package/src/commons/FlatListDnD/__test__/index.test.js +4 -4
  23. package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +3 -3
  24. package/src/commons/Header/__test__/HeaderCT.test.js +3 -3
  25. package/src/commons/IconComponent/index.js +1 -1
  26. package/src/commons/ImagePicker/__test__/ImagePicker.test.js +5 -5
  27. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +6 -4
  28. package/src/commons/Popover/__test__/index.test.js +3 -3
  29. package/src/commons/Processing/__test__/Connecting.test.js +4 -4
  30. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +5 -5
  31. package/src/commons/SubUnit/__test__/ShortDetail.test.js +8 -8
  32. package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +1 -1
  33. package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +5 -5
  34. package/src/hooks/IoT/__test__/useHomeAssistantConnection.test.js +12 -12
  35. package/src/hooks/IoT/__test__/useWatchConfigs.test.js +3 -3
  36. package/src/iot/RemoteControl/__test__/Internet.test.js +7 -7
  37. package/src/screens/AddLocationMaps/__test__/index.test.js +12 -12
  38. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -7
  39. package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +8 -8
  40. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +7 -7
  41. package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +8 -8
  42. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +5 -5
  43. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +4 -4
  44. package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -6
  45. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -6
  46. package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +2 -2
  47. package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +6 -6
  48. package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +19 -17
  49. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +19 -17
  50. package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +18 -16
  51. package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +43 -35
  52. package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +13 -13
  53. package/src/screens/AllGateway/__test__/index.test.js +6 -6
  54. package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +3 -3
  55. package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +6 -6
  56. package/src/screens/AllGateway/hooks/__test__/index.test.js +2 -2
  57. package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +3 -3
  58. package/src/screens/Automate/AddNewAction/__test__/SetupScriptDelay.test.js +9 -9
  59. package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +10 -10
  60. package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +11 -8
  61. package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +8 -8
  62. package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +6 -6
  63. package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +7 -7
  64. package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +6 -6
  65. package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +6 -6
  66. package/src/screens/Automate/ScriptDetail/__test__/useStarredScript.test.js +6 -6
  67. package/src/screens/Automate/ScriptDetail/index.js +18 -18
  68. package/src/screens/Automate/SetSchedule/__test__/SelectWeekday.test.js +4 -4
  69. package/src/screens/Automate/SetSchedule/__test__/index.test.js +10 -10
  70. package/src/screens/ChangePosition/__test__/index.test.js +6 -6
  71. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +9 -9
  72. package/src/screens/Device/__test__/detail.test.js +12 -12
  73. package/src/screens/Device/__test__/mqttDetail.test.js +9 -9
  74. package/src/screens/Drawer/Drawer.test.js +2 -2
  75. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -7
  76. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +8 -8
  77. package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +3 -3
  78. package/src/screens/HanetCamera/__test__/Detail.test.js +9 -9
  79. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -10
  80. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +9 -9
  81. package/src/screens/Notification/__test__/Notification.test.js +9 -9
  82. package/src/screens/Notification/components/NotificationItem.js +1 -2
  83. package/src/screens/Notification/styles/NotificationItemStyles.js +0 -1
  84. package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
  85. package/src/screens/SelectUnit/__test__/index.test.js +7 -7
  86. package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +7 -7
  87. package/src/screens/SideMenuDetail/__test__/index.test.js +8 -8
  88. package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +8 -8
  89. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +7 -7
  90. package/src/screens/SmartAccount/__test__/Connecting.test.js +6 -6
  91. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +10 -10
  92. package/src/screens/SubUnit/AddSubUnit.js +2 -4
  93. package/src/screens/Template/__test__/EditTemplate.test.js +7 -7
  94. package/src/screens/Template/__test__/detail.test.js +4 -4
  95. package/src/screens/Template/__test__/index.test.js +1 -1
  96. package/src/screens/Unit/Station/__test__/index.test.js +1 -1
  97. package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +9 -9
  98. package/src/screens/Unit/__test__/SelectAddress.test.js +10 -0
  99. package/src/screens/Unit/__test__/Summaries.test.js +7 -7
  100. package/src/screens/Unit/components/__test__/AutomateScript.test.js +3 -3
  101. package/src/screens/Unit/components/__test__/SharedUnit.test.js +8 -8
  102. package/src/screens/Unit/hook/__test__/useUnitConnectRemoteDevices.test.js +2 -2
  103. 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).toBeCalledWith(
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 SelectZigbeeGateway from '../SelectZigbeeGateway';
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 { useNavigation } from '@react-navigation/native';
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).toBeCalledWith(
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).toBeCalledWith(123);
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 DetailConfigActionModbus from '..';
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).toBeCalledWith(
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 api from '../../../../utils/Apis/axios';
11
+ import ModalPopupCT from '../../../../commons/ModalPopupCT';
17
12
  import { API } from '../../../../configs';
18
- import { PERMISSION_TYPE } from '../../../../configs/Constants';
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 ModalPopupCT from '../../../../commons/ModalPopupCT';
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).toBeCalledWith(1);
171
- expect(Toast.show).toBeCalledWith({
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).toBeCalledWith(
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).toBeCalledWith(
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).toBeCalledWith(
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 api from '../../../../utils/Apis/axios';
11
+ import ModalPopupCT from '../../../../commons/ModalPopupCT';
17
12
  import { API } from '../../../../configs';
18
- import { PERMISSION_TYPE } from '../../../../configs/Constants';
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 ModalPopupCT from '../../../../commons/ModalPopupCT';
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).toBeCalledWith(1);
145
- expect(Toast.show).toBeCalledWith({
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).toBeCalledWith(
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).toBeCalledWith(
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).toBeCalledWith(
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 api from '../../../../utils/Apis/axios';
11
+ import ModalPopupCT from '../../../../commons/ModalPopupCT';
17
12
  import { API } from '../../../../configs';
18
- import { PERMISSION_TYPE } from '../../../../configs/Constants';
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 ModalPopupCT from '../../../../commons/ModalPopupCT';
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).toBeCalledWith(1);
131
- expect(Toast.show).toBeCalledWith({
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).toBeCalledWith(
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).toBeCalledWith(
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 api from '../../../../utils/Apis/axios';
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 ModalPopupCT from '../../../../commons/ModalPopupCT';
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).toBeCalledWith(1);
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).toBeCalledWith(1);
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).toBeCalledWith(Routes.DeviceInternalDetail, {
225
- device: 1,
226
- gatewayId: 1,
227
- isInternal: true,
228
- isModbus: false,
229
- isZigbee: false,
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).toBeCalledWith(Routes.DeviceZigbeeDetail, {
239
- device: 1,
240
- gatewayId: 1,
241
- isInternal: false,
242
- isModbus: false,
243
- isZigbee: true,
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).toBeCalledWith(Routes.DeviceModbusDetail, {
254
- device: 1,
255
- gatewayId: 1,
256
- isInternal: false,
257
- isModbus: true,
258
- isZigbee: false,
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).toBeCalledWith('', {
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 MockAdapter from 'axios-mock-adapter';
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 t from '../../../../hooks/Common/useTranslations';
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).toBeCalledWith(
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).toBeCalledWith(2);
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 Gateway from '..';
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).toBeCalledWith(Routes.AllGatewayStack, {
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).toBeCalledTimes(1);
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).toBeCalledWith(1);
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).toBeCalledWith(1);
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).toBeCalledWith({
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).toBeCalledWith(
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).toBeCalledWith(
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).toBeCalledWith(
620
+ expect(spyToastError).toHaveBeenCalledWith(
621
621
  'You can only add more 2 actions',
622
622
  null,
623
623
  3000