@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.
Files changed (103) hide show
  1. package/package.json +4 -4
  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,6 +1,6 @@
1
+ import { act } from '@testing-library/react-hooks';
1
2
  import React from 'react';
2
3
  import { TouchableOpacity } from 'react-native';
3
- import { act } from '@testing-library/react-hooks';
4
4
  import { create } from 'react-test-renderer';
5
5
  import { HeaderCustom } from '..';
6
6
  import { SCProvider } from '../../../context';
@@ -44,11 +44,11 @@ describe('Test HeaderCustom', () => {
44
44
  await act(async () => {
45
45
  TouchableOpacityElement[1].props.onPress();
46
46
  });
47
- expect(mockOnRefresh).toBeCalled();
47
+ expect(mockOnRefresh).toHaveBeenCalled();
48
48
  await act(async () => {
49
49
  TouchableOpacityElement[2].props.onPress();
50
50
  });
51
- expect(mockShowPopoverWithRef).toBeCalled();
51
+ expect(mockShowPopoverWithRef).toHaveBeenCalled();
52
52
  });
53
53
 
54
54
  it('Test render without props', async () => {
@@ -30,7 +30,7 @@ const IconComponent = memo(
30
30
  } else if (newIcon.includes('TwoTone')) {
31
31
  newIcon = newIcon.substring(0, newIcon.length - 'TwoTone'.length);
32
32
  }
33
- newIcon = newIcon.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());
33
+ newIcon = newIcon.replace(/[A-Z]/g, (m) => m.toLowerCase());
34
34
  }
35
35
  return newIcon;
36
36
  }, [icon]);
@@ -2,10 +2,10 @@ import React from 'react';
2
2
  import { Platform } from 'react-native';
3
3
  import { act, create } from 'react-test-renderer';
4
4
 
5
- import ImagePicker from '../index';
6
- import ButtonPopup from '../../ButtonPopup';
7
5
  import { SCProvider } from '../../../context';
8
6
  import { mockSCStore } from '../../../context/mockStore';
7
+ import ButtonPopup from '../../ButtonPopup';
8
+ import ImagePicker from '../index';
9
9
 
10
10
  const mockSetImageUrl = jest.fn();
11
11
  const mockSetShowImagePicker = jest.fn();
@@ -56,7 +56,7 @@ describe('Test ImagePicker', () => {
56
56
  await act(async () => {
57
57
  textInputs[0].props.onPressMain();
58
58
  });
59
- expect(mockSetImageUrl).toBeCalledWith({ path: 'path_from_camera' });
59
+ expect(mockSetImageUrl).toHaveBeenCalledWith({ path: 'path_from_camera' });
60
60
  });
61
61
 
62
62
  it('create ImagePicker onChooseFile', async () => {
@@ -69,7 +69,7 @@ describe('Test ImagePicker', () => {
69
69
  await act(async () => {
70
70
  buttonPopup.props.onPressSecondary();
71
71
  });
72
- expect(mockSetImageUrl).toBeCalledWith({
72
+ expect(mockSetImageUrl).toHaveBeenCalledWith({
73
73
  path: 'file:///data/user/0/com.eohjsc.eohmobile/cache/Camera/80fbbd4b-926d-425f-a081-e21b13f2f7d0.jpg',
74
74
  });
75
75
  });
@@ -84,6 +84,6 @@ describe('Test ImagePicker', () => {
84
84
  await act(async () => {
85
85
  await buttonPopup.props.onClose();
86
86
  });
87
- expect(mockSetShowImagePicker).toBeCalledWith(false);
87
+ expect(mockSetShowImagePicker).toHaveBeenCalledWith(false);
88
88
  });
89
89
  });
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
+ import { Text, TouchableOpacity } from 'react-native';
2
3
  import { act, create } from 'react-test-renderer';
3
- import { TouchableOpacity, Text } from 'react-native';
4
- import MediaPlayerDetail from '../index';
5
4
  import PauseIcon from '../../../assets/images/Common/Pause.svg';
6
5
  import { SCProvider } from '../../../context';
7
6
  import { mockSCStore } from '../../../context/mockStore';
8
- import { ToastBottomHelper } from '../../../utils/Utils';
9
7
  import { getTranslate } from '../../../utils/I18n';
8
+ import { ToastBottomHelper } from '../../../utils/Utils';
9
+ import MediaPlayerDetail from '../index';
10
10
 
11
11
  const wrapComponent = (uri) => (
12
12
  <SCProvider initState={mockSCStore({})}>
@@ -53,6 +53,8 @@ describe('Test MediaPlayerDetail', () => {
53
53
  await act(async () => {
54
54
  wrapper = await create(wrapComponent(uri));
55
55
  });
56
- expect(spyToastError).toBeCalledWith(getTranslate('en', 'uri_invalid'));
56
+ expect(spyToastError).toHaveBeenCalledWith(
57
+ getTranslate('en', 'uri_invalid')
58
+ );
57
59
  });
58
60
  });
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import { create, act } from 'react-test-renderer';
2
+ import Popover from 'react-native-popover-view';
3
+ import { act, create } from 'react-test-renderer';
3
4
  import { SCProvider } from '../../../context';
4
5
  import { mockSCStore } from '../../../context/mockStore';
5
6
  import PopoverComponent from '../index';
6
- import Popover from 'react-native-popover-view';
7
7
 
8
8
  const wrapComponent = (data) => (
9
9
  <SCProvider initState={mockSCStore({})}>
@@ -26,6 +26,6 @@ describe('Test PopoverComponent', () => {
26
26
  popover.props.onCloseComplete();
27
27
  });
28
28
  expect(popover.props.isVisible).toEqual(true);
29
- expect(mockOnCloseComplete).toBeCalled();
29
+ expect(mockOnCloseComplete).toHaveBeenCalled();
30
30
  });
31
31
  });
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
- import { act, create } from 'react-test-renderer';
3
- import * as Progress from 'react-native-progress';
4
- import Processing from '../index';
5
2
  import { Text } from 'react-native';
3
+ import * as Progress from 'react-native-progress';
4
+ import { act, create } from 'react-test-renderer';
6
5
  import { SCProvider } from '../../../context';
7
6
  import { mockSCStore } from '../../../context/mockStore';
8
7
  import { getPusher } from '../../../utils/Pusher';
9
8
  import ViewButtonBottom from '../../ViewButtonBottom';
9
+ import Processing from '../index';
10
10
 
11
11
  const wrapComponent = (props) => (
12
12
  <SCProvider initState={mockSCStore({})}>
@@ -73,7 +73,7 @@ describe('Test Processing', () => {
73
73
  tree = await create(wrapComponent({ onReady: setChannelName }));
74
74
  await tree.unmount();
75
75
  });
76
- expect(getPusher().unsubscribe).toBeCalledWith(channelName);
76
+ expect(getPusher().unsubscribe).toHaveBeenCalledWith(channelName);
77
77
  });
78
78
 
79
79
  it('test click ok', async () => {
@@ -1,15 +1,15 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React from 'react';
2
- import renderer, { act } from 'react-test-renderer';
3
3
  import { Platform } from 'react-native';
4
- import MockAdapter from 'axios-mock-adapter';
4
+ import renderer, { act } from 'react-test-renderer';
5
5
 
6
- import SelectUnit from '../index';
7
6
  import Text from '../../../commons/Text';
7
+ import { API } from '../../../configs';
8
8
  import AccessibilityLabel from '../../../configs/AccessibilityLabel';
9
9
  import { SCProvider } from '../../../context';
10
10
  import { mockSCStore } from '../../../context/mockStore';
11
11
  import api from '../../../utils/Apis/axios';
12
- import { API } from '../../../configs';
12
+ import SelectUnit from '../index';
13
13
 
14
14
  const mock = new MockAdapter(api.axiosInstance);
15
15
 
@@ -103,6 +103,6 @@ describe('test single SelectUnit', () => {
103
103
  await act(async () => {
104
104
  goBack.props.onPress();
105
105
  });
106
- expect(global.mockedGoBack).toBeCalled();
106
+ expect(global.mockedGoBack).toHaveBeenCalled();
107
107
  });
108
108
  });
@@ -1,19 +1,19 @@
1
1
  import React from 'react';
2
2
  import { Image, View } from 'react-native';
3
- import { act, create } from 'react-test-renderer';
4
3
  import mock from 'react-native-permissions/mock';
4
+ import { act, create } from 'react-test-renderer';
5
5
  import { AccessibilityLabel } from '../../../configs/Constants';
6
6
  import { SCProvider } from '../../../context';
7
7
  import { mockSCStore } from '../../../context/mockStore';
8
- import ShortDetailSubUnit from '../ShortDetail';
9
- import ItemAddNew from '../../Device/ItemAddNew';
10
- import Routes from '../../../utils/Route';
8
+ import { watchMultiConfigs } from '../../../iot/Monitor';
11
9
  import { keyPermission } from '../../../utils/Permission/common';
12
- import ItemDevice from '../../Device/ItemDevice';
13
- import { DeviceTemplate } from '../DeviceTemplate/DeviceTemplate';
10
+ import Routes from '../../../utils/Route';
14
11
  import ItemHanetDevice from '../../Device/Hanet/ItemHanetDevice';
15
- import { watchMultiConfigs } from '../../../iot/Monitor';
12
+ import ItemAddNew from '../../Device/ItemAddNew';
13
+ import ItemDevice from '../../Device/ItemDevice';
16
14
  import Text from '../../Text';
15
+ import { DeviceTemplate } from '../DeviceTemplate/DeviceTemplate';
16
+ import ShortDetailSubUnit from '../ShortDetail';
17
17
 
18
18
  jest.mock('../../../iot/Monitor');
19
19
 
@@ -179,7 +179,7 @@ describe('test ShortDetail Subunit', () => {
179
179
  tree = await create(wrapComponent(props));
180
180
  });
181
181
  jest.runOnlyPendingTimers();
182
- expect(watchMultiConfigs).toBeCalledWith([1]);
182
+ expect(watchMultiConfigs).toHaveBeenCalledWith([1]);
183
183
  });
184
184
 
185
185
  ['ConfigAndEvaluation', 'ConfigValue', 'EvaluationOverConfig'].forEach(
@@ -63,7 +63,7 @@ describe('Test IFrame', () => {
63
63
 
64
64
  // expect(mockReload).toHaveBeenCalledTimes(1);
65
65
 
66
- // conflict with at current (node_modules/react-native/Libraries/Utilities/useRefEffect.js:36:20)
66
+ // conflict with current (node_modules/react-native/Libraries/Utilities/useRefEffect.js:36:20)
67
67
 
68
68
  // if current = null, conflict with
69
69
  // at __restoreDefaultValues (node_modules/react-native/Libraries/Animated/useAnimatedProps.js:160:16)
@@ -1,10 +1,10 @@
1
+ import { useNavigation } from '@react-navigation/native';
2
+ import { renderHook } from '@testing-library/react-hooks';
1
3
  import React from 'react';
2
4
  import { Platform } from 'react-native';
3
- import { renderHook } from '@testing-library/react-hooks';
4
- import { useAndroidTranslucentStatusBar } from '../index';
5
5
  import { SCProvider } from '../../../context';
6
6
  import { mockSCStore } from '../../../context/mockStore';
7
- import { useNavigation } from '@react-navigation/native';
7
+ import { useAndroidTranslucentStatusBar } from '../index';
8
8
 
9
9
  const mockedSetAction = jest.fn();
10
10
 
@@ -28,7 +28,7 @@ describe('test useAndroidTranslucentStatusBar', () => {
28
28
  wrapper,
29
29
  }
30
30
  );
31
- expect(addListener).not.toBeCalled();
31
+ expect(addListener).not.toHaveBeenCalled();
32
32
  });
33
33
 
34
34
  it('test useAndroidTranslucentStatusBar ios', async () => {
@@ -39,6 +39,6 @@ describe('test useAndroidTranslucentStatusBar', () => {
39
39
  wrapper,
40
40
  }
41
41
  );
42
- expect(addListener).not.toBeCalled();
42
+ expect(addListener).not.toHaveBeenCalled();
43
43
  });
44
44
  });
@@ -1,13 +1,13 @@
1
- import React from 'react';
2
1
  import { act, renderHook } from '@testing-library/react-hooks';
3
- import { createConnection, getStates } from 'home-assistant-js-websocket';
4
2
  import MockAdapter from 'axios-mock-adapter';
5
- import api from '../../../utils/Apis/axios';
6
- import { useHomeAssistantConnection } from '../index';
3
+ import { createConnection, getStates } from 'home-assistant-js-websocket';
4
+ import React from 'react';
5
+ import { API } from '../../../configs';
7
6
  import { SCProvider } from '../../../context';
8
- import { mockSCStore } from '../../../context/mockStore';
9
7
  import { Action } from '../../../context/actionType';
10
- import { API } from '../../../configs';
8
+ import { mockSCStore } from '../../../context/mockStore';
9
+ import api from '../../../utils/Apis/axios';
10
+ import { useHomeAssistantConnection } from '../index';
11
11
 
12
12
  const mock = new MockAdapter(api.axiosInstance);
13
13
 
@@ -124,7 +124,7 @@ describe('Test useHomeAssistantConnection', () => {
124
124
  await act(async () => {
125
125
  await result.current.connectHomeAssistant(options);
126
126
  });
127
- expect(mockedSetAction).toBeCalledWith(
127
+ expect(mockedSetAction).toHaveBeenCalledWith(
128
128
  Action.SET_HOME_ASSISTANT_CONNECTIONS,
129
129
  conns
130
130
  );
@@ -145,7 +145,7 @@ describe('Test useHomeAssistantConnection', () => {
145
145
  await act(async () => {
146
146
  await result.current.connectHomeAssistant(options);
147
147
  });
148
- expect(mockedSetAction).toBeCalledWith(
148
+ expect(mockedSetAction).toHaveBeenCalledWith(
149
149
  Action.SET_HOME_ASSISTANT_CONNECTIONS,
150
150
  conns
151
151
  );
@@ -167,12 +167,12 @@ describe('Test useHomeAssistantConnection', () => {
167
167
  await act(async () => {
168
168
  await result.current.connectHomeAssistant(options);
169
169
  });
170
- expect(mockedSetAction).toBeCalledTimes(2);
171
- expect(mockedSetAction).toBeCalledWith(
170
+ expect(mockedSetAction).toHaveBeenCalledTimes(2);
171
+ expect(mockedSetAction).toHaveBeenCalledWith(
172
172
  Action.SET_HOME_ASSISTANT_CONNECTIONS,
173
173
  conns
174
174
  );
175
- expect(mockedSetAction).toBeCalledWith(Action.LIST_DEVICE_TYPES, {
175
+ expect(mockedSetAction).toHaveBeenCalledWith(Action.LIST_DEVICE_TYPES, {
176
176
  chipId: options[0].chip_id,
177
177
  sentEmail: true,
178
178
  });
@@ -190,7 +190,7 @@ describe('Test useHomeAssistantConnection', () => {
190
190
  await act(async () => {
191
191
  await result.current.disconnectHomeAssistant(conns, options);
192
192
  });
193
- expect(mockedSetAction).toBeCalledWith(
193
+ expect(mockedSetAction).toHaveBeenCalledWith(
194
194
  Action.SET_HOME_ASSISTANT_CONNECTIONS,
195
195
  {}
196
196
  );
@@ -1,9 +1,9 @@
1
- import React, { useContext } from 'react';
2
1
  import { renderHook } from '@testing-library/react-hooks';
2
+ import React, { useContext } from 'react';
3
3
  import { SCProvider } from '../../../context';
4
4
  import { mockSCStore } from '../../../context/mockStore';
5
+ import { unwatchMultiConfigs, watchMultiConfigs } from '../../../iot/Monitor';
5
6
  import { useWatchConfigs } from '../index';
6
- import { watchMultiConfigs, unwatchMultiConfigs } from '../../../iot/Monitor';
7
7
 
8
8
  const mockedSetAction = jest.fn();
9
9
 
@@ -27,6 +27,6 @@ describe('Test useWatchConfigs', () => {
27
27
  wrapper,
28
28
  });
29
29
  jest.runOnlyPendingTimers();
30
- expect(watchMultiConfigs).toBeCalledWith([1]);
30
+ expect(watchMultiConfigs).toHaveBeenCalledWith([1]);
31
31
  });
32
32
  });
@@ -1,8 +1,8 @@
1
- import Toast from 'react-native-toast-message';
2
1
  import MockAdapter from 'axios-mock-adapter';
3
- import { sendCommandOverInternet } from '../Internet';
4
- import api from '../../../utils/Apis/axios';
2
+ import Toast from 'react-native-toast-message';
5
3
  import { API } from '../../../configs';
4
+ import api from '../../../utils/Apis/axios';
5
+ import { sendCommandOverInternet } from '../Internet';
6
6
 
7
7
  const mock = new MockAdapter(api.axiosInstance);
8
8
 
@@ -14,24 +14,24 @@ describe('Test IOT Remote Control Internet', () => {
14
14
  it('Trigger action via request POST', async () => {
15
15
  mock.onPost(API.DEVICE.TRIGGER_ACTION()).reply(200);
16
16
  await sendCommandOverInternet({}, {}, 'internet');
17
- expect(Toast.show).toBeCalledTimes(2);
17
+ expect(Toast.show).toHaveBeenCalledTimes(2);
18
18
  });
19
19
 
20
20
  it('Trigger action via request POST with data isInteger', async () => {
21
21
  mock.onPost(API.DEVICE.TRIGGER_ACTION()).reply(200);
22
22
  await sendCommandOverInternet({}, {}, 1);
23
- expect(Toast.show).toBeCalledTimes(2);
23
+ expect(Toast.show).toHaveBeenCalledTimes(2);
24
24
  });
25
25
 
26
26
  it('Trigger action via request POST with data is null', async () => {
27
27
  mock.onPost(API.DEVICE.TRIGGER_ACTION()).reply(200);
28
28
  await sendCommandOverInternet({}, {}, null);
29
- expect(Toast.show).toBeCalledTimes(2);
29
+ expect(Toast.show).toHaveBeenCalledTimes(2);
30
30
  });
31
31
 
32
32
  it('Trigger action fail show error', async () => {
33
33
  mock.onPost(API.DEVICE.TRIGGER_ACTION()).reply(400);
34
34
  await sendCommandOverInternet({}, {}, 'internet');
35
- expect(Toast.show).toBeCalled();
35
+ expect(Toast.show).toHaveBeenCalled();
36
36
  });
37
37
  });
@@ -1,22 +1,22 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React from 'react';
2
3
  import { Alert } from 'react-native';
3
- import { act, create } from 'react-test-renderer';
4
- import MockAdapter from 'axios-mock-adapter';
5
- import RNP from 'react-native-permissions';
6
4
  import RNAndroidLocationEnabler from 'react-native-android-location-enabler';
5
+ import RNP from 'react-native-permissions';
6
+ import { act, create } from 'react-test-renderer';
7
7
 
8
- import { SCProvider } from '../../../context';
9
- import { mockSCStore } from '../../../context/mockStore';
10
- import AddLocationMaps from '../index';
8
+ import { useNavigation } from '@react-navigation/native';
9
+ import { RESULTS } from 'react-native-permissions';
11
10
  import { API } from '../../../configs';
12
11
  import { AccessibilityLabel } from '../../../configs/Constants';
12
+ import { SCProvider } from '../../../context';
13
+ import { mockSCStore } from '../../../context/mockStore';
13
14
  import api from '../../../utils/Apis/axios';
14
15
  import {
15
16
  GEOLOCATION_ERROR,
16
17
  OpenSetting,
17
18
  } from '../../../utils/Permission/common';
18
- import { RESULTS } from 'react-native-permissions';
19
- import { useNavigation } from '@react-navigation/native';
19
+ import AddLocationMaps from '../index';
20
20
 
21
21
  const wrapComponent = (route) => (
22
22
  <SCProvider initState={mockSCStore({})}>
@@ -171,7 +171,7 @@ describe('Test SelectAddress', () => {
171
171
  });
172
172
  expect(
173
173
  RNAndroidLocationEnabler.promptForEnableLocationIfNeeded
174
- ).toBeCalled();
174
+ ).toHaveBeenCalled();
175
175
 
176
176
  RNAndroidLocationEnabler.promptForEnableLocationIfNeeded.mockClear();
177
177
 
@@ -184,7 +184,7 @@ describe('Test SelectAddress', () => {
184
184
  });
185
185
  expect(
186
186
  RNAndroidLocationEnabler.promptForEnableLocationIfNeeded
187
- ).toBeCalled();
187
+ ).toHaveBeenCalled();
188
188
  });
189
189
 
190
190
  it('test get current location failed location not enabled ios', async () => {
@@ -233,7 +233,7 @@ describe('Test SelectAddress', () => {
233
233
  await act(async () => {
234
234
  await button.props.onPress();
235
235
  });
236
- expect(OpenSetting).toBeCalledTimes(0);
236
+ expect(OpenSetting).toHaveBeenCalledTimes(0);
237
237
  OpenSetting.mockClear();
238
238
  });
239
239
 
@@ -249,6 +249,6 @@ describe('Test SelectAddress', () => {
249
249
  await act(async () => {
250
250
  await button.props.onPress();
251
251
  });
252
- expect(navigate).toBeCalled();
252
+ expect(navigate).toHaveBeenCalled();
253
253
  });
254
254
  });
@@ -1,17 +1,17 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React from 'react';
2
3
  import { act, create } from 'react-test-renderer';
3
- import MockAdapter from 'axios-mock-adapter';
4
4
 
5
- import AddNewGateway from '../index';
5
+ import { useNavigation } from '@react-navigation/native';
6
+ import { TextInput } from 'react-native';
7
+ import { ViewButtonBottom } from '../../../commons';
6
8
  import GroupCheckBox from '../../../commons/GroupCheckBox';
7
9
  import { AccessibilityLabel } from '../../../configs/Constants';
8
- import { ViewButtonBottom } from '../../../commons';
9
- import { TextInput } from 'react-native';
10
- import { getTranslate } from '../../../utils/I18n';
11
10
  import { SCProvider } from '../../../context';
12
11
  import { mockSCStore } from '../../../context/mockStore';
13
12
  import api from '../../../utils/Apis/axios';
14
- import { useNavigation } from '@react-navigation/native';
13
+ import { getTranslate } from '../../../utils/I18n';
14
+ import AddNewGateway from '../index';
15
15
 
16
16
  const wrapComponent = (route) => (
17
17
  <SCProvider initState={mockSCStore({})}>
@@ -147,6 +147,6 @@ describe('Test AddNewGateway', () => {
147
147
  await act(async () => {
148
148
  viewButtonBottom.props.onRightClick();
149
149
  });
150
- expect(global.mockedNavigate).not.toBeCalled();
150
+ expect(global.mockedNavigate).not.toHaveBeenCalled();
151
151
  });
152
152
  });
@@ -1,17 +1,17 @@
1
+ import NetInfo from '@react-native-community/netinfo';
2
+ import MockAdapter from 'axios-mock-adapter';
1
3
  import React from 'react';
2
4
  import { Alert } from 'react-native';
3
5
  import { act, create } from 'react-test-renderer';
4
- import MockAdapter from 'axios-mock-adapter';
5
- import NetInfo from '@react-native-community/netinfo';
6
6
 
7
- import ConnectingWifiDevice from '../ConnectingWifiDevice';
7
+ import { useNavigation } from '@react-navigation/native';
8
+ import Processing from '../../../commons/Processing';
9
+ import { API } from '../../../configs';
8
10
  import { SCProvider } from '../../../context';
9
11
  import { mockSCStore } from '../../../context/mockStore';
10
12
  import api from '../../../utils/Apis/axios';
11
- import Processing from '../../../commons/Processing';
12
13
  import ConnectingDevice from '../ConnectingDevice';
13
- import { API } from '../../../configs';
14
- import { useNavigation } from '@react-navigation/native';
14
+ import ConnectingWifiDevice from '../ConnectingWifiDevice';
15
15
 
16
16
  const wrapComponent = (route) => (
17
17
  <SCProvider initState={mockSCStore({})}>
@@ -59,7 +59,7 @@ describe('Test connecting wifi device', () => {
59
59
  await act(async () => {
60
60
  jest.runAllTimers();
61
61
  });
62
- expect(NetInfo.addEventListener).toBeCalled();
62
+ expect(NetInfo.addEventListener).toHaveBeenCalled();
63
63
  };
64
64
 
65
65
  it('onReady call api scan chip', async () => {
@@ -81,6 +81,6 @@ describe('Test connecting wifi device', () => {
81
81
  await act(async () => {
82
82
  Alert.alert.mock.calls[1][2][0].onPress();
83
83
  });
84
- expect(goBack).toBeCalled();
84
+ expect(goBack).toHaveBeenCalled();
85
85
  });
86
86
  });
@@ -1,14 +1,14 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React from 'react';
3
+ import { Alert } from 'react-native';
2
4
  import { act, create } from 'react-test-renderer';
3
- import MockAdapter from 'axios-mock-adapter';
4
- import { getPusher } from '../../../utils/Pusher';
5
- import Routes from '../../../utils/Route';
6
- import ConnectingZigbeeDevice from '../ConnectingZigbeeDevice';
5
+ import Processing from '../../../commons/Processing';
7
6
  import { SCProvider } from '../../../context';
8
7
  import { mockSCStore } from '../../../context/mockStore';
9
8
  import api from '../../../utils/Apis/axios';
10
- import Processing from '../../../commons/Processing';
11
- import { Alert } from 'react-native';
9
+ import { getPusher } from '../../../utils/Pusher';
10
+ import Routes from '../../../utils/Route';
11
+ import ConnectingZigbeeDevice from '../ConnectingZigbeeDevice';
12
12
 
13
13
  const wrapComponent = (route) => (
14
14
  <SCProvider initState={mockSCStore({})}>
@@ -61,7 +61,7 @@ describe('Test connecting modbus device', () => {
61
61
  await act(async () => {
62
62
  jest.runOnlyPendingTimers();
63
63
  });
64
- expect(Alert.alert).toBeCalled();
64
+ expect(Alert.alert).toHaveBeenCalled();
65
65
  });
66
66
 
67
67
  it('receive sensor-id from channel then rename sensor-id', async () => {
@@ -1,18 +1,18 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React from 'react';
2
3
  import { TouchableOpacity } from 'react-native';
3
4
  import { act, create } from 'react-test-renderer';
4
- import MockAdapter from 'axios-mock-adapter';
5
5
 
6
- import RenameNewDevices from '../RenameNewDevices';
6
+ import { useNavigation } from '@react-navigation/native';
7
+ import _TextInput from '../../../commons/Form/TextInput';
8
+ import Text from '../../../commons/Text';
9
+ import AccessibilityLabel from '../../../configs/AccessibilityLabel';
10
+ import API from '../../../configs/API';
7
11
  import { SCProvider } from '../../../context';
8
12
  import { mockSCStore } from '../../../context/mockStore';
9
13
  import api from '../../../utils/Apis/axios';
10
- import AccessibilityLabel from '../../../configs/AccessibilityLabel';
11
- import Text from '../../../commons/Text';
12
- import _TextInput from '../../../commons/Form/TextInput';
13
- import API from '../../../configs/API';
14
14
  import { CheckBoxCustom } from '../../Sharing/Components';
15
- import { useNavigation } from '@react-navigation/native';
15
+ import RenameNewDevices from '../RenameNewDevices';
16
16
 
17
17
  const wrapComponent = (route) => (
18
18
  <SCProvider initState={mockSCStore({})}>
@@ -61,7 +61,7 @@ describe('Test rename new devices', () => {
61
61
  }
62
62
  };
63
63
  const mockedDispatchNavigate = () => {
64
- expect(global.mockedDispatch).toBeCalledWith({
64
+ expect(global.mockedDispatch).toHaveBeenCalledWith({
65
65
  payload: {
66
66
  index: 0,
67
67
  routes: [
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import renderer, { act } from 'react-test-renderer';
3
3
 
4
- import ScanGatewayQR from '../ScanGatewayQR';
4
+ import { useNavigation } from '@react-navigation/native';
5
+ import { ViewButtonBottom } from '../../../commons';
5
6
  import { SCProvider } from '../../../context';
6
7
  import { mockSCStore } from '../../../context/mockStore';
7
- import QRScan from '../../ScanChipQR/components/QRScan';
8
8
  import { getTranslate } from '../../../utils/I18n';
9
9
  import Routes from '../../../utils/Route';
10
- import { ViewButtonBottom } from '../../../commons';
11
- import { useNavigation } from '@react-navigation/native';
10
+ import QRScan from '../../ScanChipQR/components/QRScan';
11
+ import ScanGatewayQR from '../ScanGatewayQR';
12
12
 
13
13
  const wrapComponent = (route) => (
14
14
  <SCProvider initState={mockSCStore({})}>
@@ -62,7 +62,7 @@ describe('test scan gateway device QR', () => {
62
62
  await act(async () => {
63
63
  await buttonBottom.props.onLeftClick();
64
64
  });
65
- expect(goBack).toBeCalled();
65
+ expect(goBack).toHaveBeenCalled();
66
66
  });
67
67
 
68
68
  it('on scan correct QR code', async () => {
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import renderer, { act } from 'react-test-renderer';
3
3
 
4
- import SelectDeviceUnit from '../SelectDeviceUnit';
4
+ import { useNavigation } from '@react-navigation/native';
5
+ import MockAdapter from 'axios-mock-adapter';
5
6
  import AccessibilityLabel from '../../../configs/AccessibilityLabel';
6
7
  import { SCProvider } from '../../../context';
7
8
  import { mockSCStore } from '../../../context/mockStore';
8
- import { useNavigation } from '@react-navigation/native';
9
- import MockAdapter from 'axios-mock-adapter';
10
9
  import api from '../../../utils/Apis/axios';
10
+ import SelectDeviceUnit from '../SelectDeviceUnit';
11
11
 
12
12
  new MockAdapter(api.axiosInstance);
13
13
 
@@ -41,6 +41,6 @@ describe('test single SelectUnit', () => {
41
41
  await act(async () => {
42
42
  goBack.props.onPress();
43
43
  });
44
- expect(global.mockedNavigate).toBeCalled();
44
+ expect(global.mockedNavigate).toHaveBeenCalled();
45
45
  });
46
46
  });