@eohjsc/react-native-smart-city 0.7.3-rc1 → 0.7.3-rc11

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 (139) hide show
  1. package/package.json +17 -15
  2. package/src/commons/Action/__test__/ItemQuickAction.test.js +6 -6
  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/ActionGroup/__test__/index.test.js +6 -6
  14. package/src/commons/ActionTemplate/__test__/index.test.js +4 -4
  15. package/src/commons/Automate/__test__/ItemAutomate.test.js +2 -2
  16. package/src/commons/ChartAggregationOption/__test__/FourButtonFilterHistory.test.js +2 -2
  17. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +8 -9
  18. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +7 -7
  19. package/src/commons/DateTimeRangeChange/DateTimeButton.js +1 -1
  20. package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +1 -1
  21. package/src/commons/Device/FlatListItems.js +17 -16
  22. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -3
  23. package/src/commons/Device/HorizontalBarChart.js +54 -34
  24. package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -3
  25. package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +6 -6
  26. package/src/commons/FlatListDnD/__test__/index.test.js +4 -4
  27. package/src/commons/FlatListDnD/index.js +12 -9
  28. package/src/commons/Grid/GridItem.js +10 -2
  29. package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +3 -3
  30. package/src/commons/Header/__test__/HeaderCT.test.js +3 -3
  31. package/src/commons/IconComponent/index.js +3 -3
  32. package/src/commons/ImagePicker/__test__/ImagePicker.test.js +5 -5
  33. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +6 -4
  34. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +1 -1
  35. package/src/commons/Popover/__test__/index.test.js +3 -3
  36. package/src/commons/Processing/__test__/Connecting.test.js +4 -4
  37. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +5 -5
  38. package/src/commons/SubUnit/OneTap/index.js +9 -8
  39. package/src/commons/SubUnit/__test__/ShortDetail.test.js +8 -8
  40. package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +9 -13
  41. package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +5 -5
  42. package/src/hooks/IoT/__test__/useHomeAssistantConnection.test.js +12 -12
  43. package/src/hooks/IoT/__test__/useWatchConfigs.test.js +3 -3
  44. package/src/hooks/IoT/useRemoteControl.js +6 -6
  45. package/src/hooks/useMqtt.js +2 -2
  46. package/src/iot/RemoteControl/Internet.js +2 -2
  47. package/src/iot/RemoteControl/__test__/Internet.test.js +7 -7
  48. package/src/screens/AddLocationMaps/__test__/index.test.js +12 -12
  49. package/src/screens/AddNewGateway/ShareWifiPassword.js +16 -15
  50. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -7
  51. package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +8 -8
  52. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +7 -7
  53. package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +8 -8
  54. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +5 -5
  55. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +4 -4
  56. package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -6
  57. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -6
  58. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +0 -4
  59. package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +2 -2
  60. package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +6 -6
  61. package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +19 -17
  62. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +19 -17
  63. package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +18 -16
  64. package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +43 -35
  65. package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +13 -13
  66. package/src/screens/AllGateway/__test__/index.test.js +6 -6
  67. package/src/screens/AllGateway/components/Detail/__test__/index.test.js +3 -5
  68. package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +3 -3
  69. package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +6 -6
  70. package/src/screens/AllGateway/hooks/__test__/index.test.js +2 -2
  71. package/src/screens/AllGateway/test-utils.js +3 -4
  72. package/src/screens/Automate/AddNewAction/NewActionWrapper.js +7 -7
  73. package/src/screens/Automate/AddNewAction/SelectControlDevices.js +3 -3
  74. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +35 -32
  75. package/src/screens/Automate/AddNewAction/Styles/SetupSensorStyles.js +20 -4
  76. package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +12 -12
  77. package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +14 -8
  78. package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +13 -7
  79. package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +12 -11
  80. package/src/screens/Automate/AddNewAction/__test__/SetupScriptDelay.test.js +9 -9
  81. package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +10 -10
  82. package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +4 -3
  83. package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +13 -8
  84. package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +8 -8
  85. package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +6 -6
  86. package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +7 -7
  87. package/src/screens/Automate/EditActionsList/index.js +19 -17
  88. package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +16 -7
  89. package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +15 -7
  90. package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +4 -7
  91. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +1 -1
  92. package/src/screens/Automate/ScriptDetail/__test__/useStarredScript.test.js +6 -6
  93. package/src/screens/Automate/ScriptDetail/index.js +18 -18
  94. package/src/screens/Automate/SetSchedule/__test__/SelectWeekday.test.js +4 -4
  95. package/src/screens/Automate/SetSchedule/__test__/index.test.js +28 -18
  96. package/src/screens/Automate/SetSchedule/components/RowItem.js +5 -5
  97. package/src/screens/Automate/SetSchedule/index.js +7 -7
  98. package/src/screens/ChangePosition/__test__/index.test.js +6 -6
  99. package/src/screens/ChangePosition/index.js +2 -1
  100. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +9 -9
  101. package/src/screens/Device/__test__/detail.test.js +12 -12
  102. package/src/screens/Device/__test__/mqttDetail.test.js +9 -9
  103. package/src/screens/Device/components/SensorDisplayItem.js +5 -5
  104. package/src/screens/Drawer/Drawer.test.js +2 -2
  105. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -7
  106. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +8 -8
  107. package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +3 -3
  108. package/src/screens/HanetCamera/__test__/Detail.test.js +9 -9
  109. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -10
  110. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +9 -9
  111. package/src/screens/Notification/__test__/Notification.test.js +9 -9
  112. package/src/screens/Notification/components/NotificationItem.js +2 -3
  113. package/src/screens/Notification/styles/NotificationItemStyles.js +0 -1
  114. package/src/screens/PlayBackCamera/__test__/index.test.js +1 -1
  115. package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
  116. package/src/screens/SelectUnit/__test__/index.test.js +7 -7
  117. package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +7 -7
  118. package/src/screens/SideMenuDetail/__test__/index.test.js +8 -8
  119. package/src/screens/SmartAccount/Connecting/index.js +5 -5
  120. package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +8 -8
  121. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +7 -7
  122. package/src/screens/SmartAccount/__test__/Connecting.test.js +6 -6
  123. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +10 -10
  124. package/src/screens/SubUnit/AddSubUnit.js +2 -4
  125. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -11
  126. package/src/screens/Template/EditTemplate.js +6 -4
  127. package/src/screens/Template/__test__/EditTemplate.test.js +7 -7
  128. package/src/screens/Template/__test__/detail.test.js +4 -4
  129. package/src/screens/Template/__test__/index.test.js +1 -1
  130. package/src/screens/Unit/Station/__test__/index.test.js +1 -1
  131. package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +9 -9
  132. package/src/screens/Unit/__test__/SelectAddress.test.js +11 -17
  133. package/src/screens/Unit/__test__/Summaries.test.js +7 -7
  134. package/src/screens/Unit/components/__test__/AutomateScript.test.js +3 -3
  135. package/src/screens/Unit/components/__test__/SharedUnit.test.js +8 -8
  136. package/src/screens/Unit/hook/__test__/useUnitConnectRemoteDevices.test.js +2 -2
  137. package/src/utils/I18n/translations/en.js +1 -1
  138. package/src/utils/I18n/translations/vi.js +1 -1
  139. package/src/utils/__test__/Utils.test.js +16 -16
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.7.3-rc1",
4
+ "version": "0.7.3-rc11",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -52,9 +52,6 @@
52
52
  "publishConfig": {
53
53
  "registry": "https://registry.npmjs.org/"
54
54
  },
55
- "resolutions": {
56
- "graceful-fs": "^4.2.4"
57
- },
58
55
  "keywords": [
59
56
  "react-native"
60
57
  ],
@@ -62,9 +59,13 @@
62
59
  "license": "MIT",
63
60
  "licenseFilename": "LICENSE",
64
61
  "dependencies": {
62
+ "@ant-design/icons-react-native": "^2.3.2",
65
63
  "@babel/core": "^7.12.9",
66
64
  "@babel/helper-environment-visitor": "^7.16.7",
67
- "@babel/runtime": "^7.12.5",
65
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
66
+ "@babel/plugin-proposal-private-methods": "^7.18.6",
67
+ "@babel/plugin-transform-private-methods": "^7.24.7",
68
+ "@babel/runtime": "^7.20.0",
68
69
  "@eohjsc/react-native-keyboard-aware-scroll-view": "^0.9.5",
69
70
  "@formatjs/intl-getcanonicallocales": "^1.4.5",
70
71
  "@formatjs/intl-numberformat": "^5.6.2",
@@ -88,14 +89,14 @@
88
89
  "@react-navigation/native-stack": "^6.11.0",
89
90
  "@sentry/react-native": "^5.24.1",
90
91
  "@testing-library/react-hooks": "^6.0.0",
91
- "@types/jest": "^26.0.19",
92
+ "@types/jest": "^29.2.1",
92
93
  "@types/react": "^17.0.0",
93
94
  "@types/react-native": "^0.63.43",
94
95
  "@types/react-test-renderer": "^17.0.0",
95
96
  "apisauce": "^2.1.5",
96
97
  "axios": "^0.19.2",
97
98
  "axios-mock-adapter": "^1.21.1",
98
- "babel-jest": "^26.6.3",
99
+ "babel-jest": "^29.7.0",
99
100
  "base-64": "^1.0.0",
100
101
  "deprecated-react-native-prop-types": "^2.3.0",
101
102
  "detox": "^18.3.1",
@@ -110,13 +111,14 @@
110
111
  "husky": "^8.0.1",
111
112
  "i18n-js": "^3.7.1",
112
113
  "i18next": "^20.1.0",
113
- "jest": "^26.6.3",
114
- "jest-circus": "^26.6.3",
114
+ "jest": "^29",
115
+ "jest-circus": "^29",
116
+ "jest-environment-jsdom": "^29",
115
117
  "jetifier": "^1.6.6",
116
118
  "lint-staged": "^12.4.1",
117
119
  "lodash": "^4.17.19",
118
120
  "lottie-react-native": "^6.7.2",
119
- "metro-react-native-babel-preset": "^0.66.2",
121
+ "metro-react-native-babel-preset": "0.73.9",
120
122
  "moment": "^2.27.0",
121
123
  "moment-timezone": "^0.5.32",
122
124
  "node-html-parser": "^2.0.2",
@@ -134,7 +136,7 @@
134
136
  "react-dom": "18.2.0",
135
137
  "react-hooks-global-state": "^2.1.0",
136
138
  "react-i18next": "^11.8.12",
137
- "react-native": "0.71.19",
139
+ "react-native": "0.73.9",
138
140
  "react-native-alert-async": "^1.0.5",
139
141
  "react-native-android-location-enabler": "^1.2.2",
140
142
  "react-native-base64": "^0.1.0",
@@ -147,7 +149,7 @@
147
149
  "react-native-dash": "^0.0.11",
148
150
  "react-native-deep-linking": "^2.2.0",
149
151
  "react-native-device-info": "^10.3.0",
150
- "react-native-draggable-flatlist": "^2.6.2",
152
+ "react-native-draggable-flatlist": "^4.0.1",
151
153
  "react-native-fast-image": "^8.6.3",
152
154
  "react-native-geocoder": "^0.5.0",
153
155
  "react-native-gesture-handler": "^2.17.1",
@@ -158,7 +160,7 @@
158
160
  "react-native-iphone-x-helper": "^1.2.1",
159
161
  "react-native-linear-gradient": "^2.5.6",
160
162
  "react-native-localize": "^1.4.1",
161
- "react-native-maps": "^1.15.6",
163
+ "react-native-maps": "1.17.3",
162
164
  "react-native-modal": "^13.0.1",
163
165
  "react-native-modal-datetime-picker": "^17.1.0",
164
166
  "react-native-new-snap-carousel": "^3.9.3",
@@ -169,7 +171,7 @@
169
171
  "react-native-permissions": "3.6.0",
170
172
  "react-native-popover-view": "^5.1.8",
171
173
  "react-native-progress": "^5.0.0",
172
- "react-native-reanimated": "3.3.0",
174
+ "react-native-reanimated": "3.8.1",
173
175
  "react-native-responsive-fontsize": "^0.5.1",
174
176
  "react-native-safe-area-context": "^3.1.1",
175
177
  "react-native-screens": "^3.32.0",
@@ -185,7 +187,7 @@
185
187
  "react-native-wheel-color-picker": "^1.2.0",
186
188
  "react-native-wheel-scrollview-picker": "^1.2.2",
187
189
  "react-native-wifi-reborn": "4.5.0",
188
- "react-test-renderer": "18.2.0",
190
+ "react-test-renderer": "18.3.1",
189
191
  "string-format": "^2.0.0",
190
192
  "sync-directory": "^5.1.7",
191
193
  "timezone-mock": "^1.1.3",
@@ -1,13 +1,13 @@
1
+ import { IconOutline } from '@ant-design/icons-react-native';
2
+ import { factory } from 'factory-girl';
1
3
  import React from 'react';
2
4
  import { TouchableOpacity } from 'react-native';
5
+ import Toast from 'react-native-toast-message';
3
6
  import { act, create } from 'react-test-renderer';
4
- import ItemQuickAction from '../ItemQuickAction';
5
7
  import { Colors } from '../../../configs';
6
8
  import { AccessibilityLabel } from '../../../configs/Constants';
7
- import { factory } from 'factory-girl';
8
9
  import IconComponent from '../../IconComponent';
9
- import Toast from 'react-native-toast-message';
10
- import AntDesign from 'react-native-vector-icons/AntDesign';
10
+ import ItemQuickAction from '../ItemQuickAction';
11
11
  class Sensor {}
12
12
 
13
13
  factory.define('Sensor', Sensor, {});
@@ -94,7 +94,7 @@ describe('Test ItemQuickAction', () => {
94
94
  await buttonOnActionPress.props.onPress();
95
95
  });
96
96
 
97
- const icon = instance.findByType(AntDesign);
97
+ const icon = instance.findByType(IconOutline);
98
98
  expect(icon.props.color).toEqual(Colors.TextGray);
99
99
  });
100
100
 
@@ -256,7 +256,7 @@ describe('Test ItemQuickAction', () => {
256
256
  await act(async () => {
257
257
  await buttonOnActionPress.props.onPress();
258
258
  });
259
- expect(Toast.show).not.toBeCalled();
259
+ expect(Toast.show).not.toHaveBeenCalled();
260
260
  });
261
261
  it('test config value 0 on_state_values 0', async () => {
262
262
  sensor.quick_action.on_state_values = [0];
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import { act, create } from 'react-test-renderer';
3
3
 
4
- import { mockSCStore } from '../../../../../context/mockStore';
4
+ import { useNavigation } from '@react-navigation/native';
5
+ import { TouchableOpacity } from 'react-native';
5
6
  import { AccessibilityLabel } from '../../../../../configs/Constants';
6
7
  import { SCProvider } from '../../../../../context';
7
- import PasscodeList from '../index';
8
- import { TouchableOpacity } from 'react-native';
8
+ import { mockSCStore } from '../../../../../context/mockStore';
9
9
  import Routes from '../../../../../utils/Route';
10
- import { useNavigation } from '@react-navigation/native';
10
+ import PasscodeList from '../index';
11
11
 
12
12
  const wrapComponent = () => (
13
13
  <SCProvider initState={mockSCStore({})}>
@@ -41,7 +41,7 @@ describe('Test SetupGeneratePasscode', () => {
41
41
  await act(async () => {
42
42
  await passcode_list[0].props.onPress();
43
43
  });
44
- expect(global.mockedNavigate).toBeCalledWith(Routes.SmartLockStack, {
44
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.SmartLockStack, {
45
45
  screen: Routes.ItemPasscode,
46
46
  params: {
47
47
  item: { code: 123361, name: 'Do Loi' },
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import renderer, { act } from 'react-test-renderer';
3
2
  import { TouchableOpacity } from 'react-native';
3
+ import renderer, { act } from 'react-test-renderer';
4
4
 
5
5
  import { SCProvider } from '../../../../context';
6
6
  import { mockSCStore } from '../../../../context/mockStore';
@@ -47,6 +47,6 @@ describe('Test ThreeButtonCircle', () => {
47
47
  await act(async () => {
48
48
  touchableOpacities[0].props.onPress();
49
49
  });
50
- expect(mockOnButton1Press).toBeCalled();
50
+ expect(mockOnButton1Press).toHaveBeenCalled();
51
51
  });
52
52
  });
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import renderer, { act } from 'react-test-renderer';
3
2
  import { TouchableOpacity } from 'react-native';
3
+ import renderer, { act } from 'react-test-renderer';
4
4
 
5
5
  import { SCProvider } from '../../../../context';
6
6
  import { mockSCStore } from '../../../../context/mockStore';
@@ -47,6 +47,6 @@ describe('Test ThreeButtonDefault', () => {
47
47
  await act(async () => {
48
48
  touchableOpacities[0].props.onPress();
49
49
  });
50
- expect(mockOnButton1Press).toBeCalled();
50
+ expect(mockOnButton1Press).toHaveBeenCalled();
51
51
  });
52
52
  });
@@ -1,13 +1,12 @@
1
- import { watchMultiConfigs } from '../../../iot/Monitor';
2
1
  import React, { useContext } from 'react';
2
+ import ColorPicker from 'react-native-wheel-color-picker';
3
3
  import { act, create } from 'react-test-renderer';
4
- import ColorPickerTemplate from '../ColorPickerTemplate';
5
- import { WheelColorPicker } from '../ColorPickerTemplate';
4
+ import { DEVICE_TYPE } from '../../../configs/Constants';
6
5
  import { SCProvider } from '../../../context';
7
6
  import { mockSCStore } from '../../../context/mockStore';
7
+ import { watchMultiConfigs } from '../../../iot/Monitor';
8
8
  import { useConfigGlobalState } from '../../../iot/states';
9
- import ColorPicker from 'react-native-wheel-color-picker';
10
- import { DEVICE_TYPE } from '../../../configs/Constants';
9
+ import ColorPickerTemplate, { WheelColorPicker } from '../ColorPickerTemplate';
11
10
 
12
11
  const mockSetAction = jest.fn();
13
12
 
@@ -106,7 +105,7 @@ describe('Test ColorPickerTemplate', () => {
106
105
  await act(async () => {
107
106
  await wheelpicker.props.onStart();
108
107
  });
109
- expect(mockSetAction).toBeCalled();
108
+ expect(mockSetAction).toHaveBeenCalled();
110
109
  });
111
110
 
112
111
  it('test WheelColorPicker onChangeColorComplete', async () => {
@@ -123,13 +122,13 @@ describe('Test ColorPickerTemplate', () => {
123
122
  await act(async () => {
124
123
  await wheelpicker.props.onStart();
125
124
  });
126
- expect(mockSetAction).toBeCalledTimes(1);
127
- expect(mockDoAction).toBeCalledTimes(0);
125
+ expect(mockSetAction).toHaveBeenCalledTimes(1);
126
+ expect(mockDoAction).toHaveBeenCalledTimes(0);
128
127
 
129
128
  await act(async () => {
130
129
  await wheelpicker.props.onChangeColorComplete('#ffffff');
131
130
  });
132
- expect(mockSetAction).toBeCalledTimes(2);
133
- expect(mockDoAction).toBeCalledTimes(1);
131
+ expect(mockSetAction).toHaveBeenCalledTimes(2);
132
+ expect(mockDoAction).toHaveBeenCalledTimes(1);
134
133
  });
135
134
  });
@@ -1,11 +1,11 @@
1
- import { AccessibilityLabel } from '../../../configs/Constants';
2
- import { watchMultiConfigs } from '../../../iot/Monitor';
3
1
  import React from 'react';
4
2
  import { act, create } from 'react-test-renderer';
5
- import OnOffSmartLock from '../OnOffSmartLock/OnOffSmartLock';
3
+ import { AccessibilityLabel } from '../../../configs/Constants';
6
4
  import { SCProvider } from '../../../context';
7
5
  import { mockSCStore } from '../../../context/mockStore';
6
+ import { watchMultiConfigs } from '../../../iot/Monitor';
8
7
  import { useConfigGlobalState } from '../../../iot/states';
8
+ import OnOffSmartLock from '../OnOffSmartLock/OnOffSmartLock';
9
9
 
10
10
  jest.mock('../../../iot/Monitor');
11
11
  const mockDoAction = jest.fn();
@@ -76,7 +76,7 @@ describe('Test OnOffTemplate', () => {
76
76
  await act(async () => {
77
77
  await button.props.onPress();
78
78
  });
79
- expect(mockDoAction).toBeCalledWith(actionOnData, '{"door_lock":0}');
79
+ expect(mockDoAction).toHaveBeenCalledWith(actionOnData, '{"door_lock":0}');
80
80
  });
81
81
 
82
82
  it('render with template OnOffSmartLockActionTemplate doAction unlock', async () => {
@@ -96,6 +96,6 @@ describe('Test OnOffTemplate', () => {
96
96
  await act(async () => {
97
97
  await button.props.onPress();
98
98
  });
99
- expect(mockDoAction).toBeCalledWith(actionOffData, '{"door_lock":1}');
99
+ expect(mockDoAction).toHaveBeenCalledWith(actionOffData, '{"door_lock":1}');
100
100
  });
101
101
  });
@@ -2,12 +2,12 @@ import React from 'react';
2
2
  import { act, create } from 'react-test-renderer';
3
3
 
4
4
  import { DEVICE_TYPE } from '../../../configs/Constants';
5
+ import { SCProvider } from '../../../context';
6
+ import { mockSCStore } from '../../../context/mockStore';
5
7
  import { watchMultiConfigs } from '../../../iot/Monitor';
6
8
  import OnOffTemplate from '../OnOffTemplate';
7
9
  import OnOffButtonTemplate from '../OnOffTemplate/OnOffButtonTemplate';
8
10
  import OnOffSimpleTemplate from '../OnOffTemplate/OnOffSimpleTemplate';
9
- import { mockSCStore } from '../../../context/mockStore';
10
- import { SCProvider } from '../../../context';
11
11
 
12
12
  const wrapComponent = (item, mockDoAction, sensor) => (
13
13
  <SCProvider initState={mockSCStore({})}>
@@ -118,7 +118,7 @@ describe('Test OnOffTemplate', () => {
118
118
  const instance = tree.root;
119
119
  const template = instance.findAllByType(OnOffSimpleTemplate);
120
120
  expect(template).toHaveLength(1);
121
- expect(watchMultiConfigs).toBeCalledTimes(0);
121
+ expect(watchMultiConfigs).toHaveBeenCalledTimes(0);
122
122
  });
123
123
 
124
124
  it('template OnOffSimpleActionTemplate doAction with is_on_value, match configValue', async () => {
@@ -135,7 +135,7 @@ describe('Test OnOffTemplate', () => {
135
135
  await template.props.triggerAction();
136
136
  });
137
137
  expect(mockDoAction).toHaveBeenCalledWith(actionOffData, undefined, false);
138
- expect(watchMultiConfigs).toBeCalledTimes(0);
138
+ expect(watchMultiConfigs).toHaveBeenCalledTimes(0);
139
139
  });
140
140
 
141
141
  it('template OnOffSimpleActionTemplate doAction with is_on_value, not match configValue', async () => {
@@ -167,7 +167,7 @@ describe('Test OnOffTemplate', () => {
167
167
  await template.props.triggerAction();
168
168
  });
169
169
  expect(mockDoAction).toHaveBeenCalledWith(actionOffData, undefined, false);
170
- expect(watchMultiConfigs).toBeCalledTimes(0);
170
+ expect(watchMultiConfigs).toHaveBeenCalledTimes(0);
171
171
  });
172
172
 
173
173
  it('render with template OnOffSimpleActionTemplate with just action_data', async () => {
@@ -1,17 +1,17 @@
1
- import OptionsDropdownActionTemplate from '../../../commons/ActionGroup/OptionsDropdownActionTemplate';
2
1
  import React from 'react';
3
2
  import { TouchableOpacity } from 'react-native';
4
3
  import { act, create } from 'react-test-renderer';
5
- import Text from '../../../commons/Text';
6
- import { watchMultiConfigs } from '../../../iot/Monitor';
7
4
  import { AlertAction, RadioCircle } from '../../../commons';
8
- import { DEVICE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
9
- import { getTranslate } from '../../../utils/I18n';
5
+ import OptionsDropdownActionTemplate from '../../../commons/ActionGroup/OptionsDropdownActionTemplate';
6
+ import Text from '../../../commons/Text';
7
+ import { AccessibilityLabel, DEVICE_TYPE } from '../../../configs/Constants';
10
8
  import { SCProvider } from '../../../context';
11
9
  import { mockSCStore } from '../../../context/mockStore';
10
+ import { watchMultiConfigs } from '../../../iot/Monitor';
11
+ import { getTranslate } from '../../../utils/I18n';
12
12
 
13
- import SvgDoorState from '../../../../assets/images/Device/door-state.svg';
14
13
  import SvgCurrentState from '../../../../assets/images/Device/current-state.svg';
14
+ import SvgDoorState from '../../../../assets/images/Device/door-state.svg';
15
15
  import SvgWindStrength from '../../../../assets/images/Device/wind-strength.svg';
16
16
 
17
17
  const wrapComponent = (item, mockDoAction, sensor) => (
@@ -190,8 +190,8 @@ describe('Test OptionsDropdownActionTemplate', () => {
190
190
  value: 1,
191
191
  });
192
192
  is_managed_by_backend
193
- ? expect(watchMultiConfigs).not.toBeCalled()
194
- : expect(watchMultiConfigs).not.toBeCalled();
193
+ ? expect(watchMultiConfigs).not.toHaveBeenCalled()
194
+ : expect(watchMultiConfigs).not.toHaveBeenCalled();
195
195
 
196
196
  expect(texts[1].props.children).toEqual('Level2'); // TODO: should be Level1, configValues make change again
197
197
  };
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { TouchableOpacity } from 'react-native';
3
3
  import { act, create } from 'react-test-renderer';
4
+ import { DEVICE_TYPE } from '../../../configs/Constants';
4
5
  import Text from '../../Text';
5
6
  import StatesGridActionTemplate from '../StatesGridActionTemplate';
6
- import { DEVICE_TYPE } from '../../../configs/Constants';
7
7
 
8
8
  const mockDoAction = jest.fn();
9
9
  const mockActionData = jest.fn();
@@ -74,7 +74,7 @@ describe('Test StatesGridActionTemplate', () => {
74
74
  await act(async () => {
75
75
  await touchableOpacities[0].props.onPress();
76
76
  });
77
- expect(mockDoAction).toBeCalledWith(mockActionData, null);
77
+ expect(mockDoAction).toHaveBeenCalledWith(mockActionData, null);
78
78
  });
79
79
 
80
80
  it('test trigger special action', async () => {
@@ -96,7 +96,7 @@ describe('Test StatesGridActionTemplate', () => {
96
96
  await act(async () => {
97
97
  await touchableOpacities[0].props.onPress();
98
98
  });
99
- expect(mockDoAction).toBeCalledWith(
99
+ expect(mockDoAction).toHaveBeenCalledWith(
100
100
  mockActionData,
101
101
  JSON.stringify({ config_id: 1, config_value: undefined })
102
102
  );
@@ -1,15 +1,15 @@
1
1
  import React from 'react';
2
2
  import { Switch, TouchableOpacity } from 'react-native';
3
- import { act, create } from 'react-test-renderer';
4
- import TimerActionTemplate from '../TimerActionTemplate';
5
3
  import DateTimePickerModal from 'react-native-modal-datetime-picker';
6
4
  import ScrollPicker from 'react-native-wheel-scrollview-picker';
5
+ import { act, create } from 'react-test-renderer';
6
+ import TimerActionTemplate from '../TimerActionTemplate';
7
7
 
8
8
  import moment from 'moment';
9
- import Text from '../../Text';
10
- import { watchMultiConfigs } from '../../../iot/Monitor';
11
9
  import { SCProvider } from '../../../context';
12
10
  import { mockSCStore } from '../../../context/mockStore';
11
+ import { watchMultiConfigs } from '../../../iot/Monitor';
12
+ import Text from '../../Text';
13
13
 
14
14
  jest.mock('../../../iot/Monitor');
15
15
 
@@ -81,7 +81,7 @@ describe('Test TimerActionTemplate success with config value', () => {
81
81
  await act(async () => {
82
82
  await switchButton.props.onValueChange();
83
83
  });
84
- expect(mockDoAction).toBeCalled();
84
+ expect(mockDoAction).toHaveBeenCalled();
85
85
 
86
86
  const touchableOpacities = instance.findAllByType(TouchableOpacity);
87
87
  await act(async () => {
@@ -128,6 +128,6 @@ describe('Test TimerActionTemplate success with config value', () => {
128
128
  await act(async () => {
129
129
  await touchableOpacities[2].props.onPress(3);
130
130
  });
131
- expect(mockDoAction).toBeCalled();
131
+ expect(mockDoAction).toHaveBeenCalled();
132
132
  });
133
133
  });
@@ -123,7 +123,7 @@ describe('Test TwoButtonTemplate', () => {
123
123
  expect(touchableOpacities.length).toEqual(2);
124
124
  await touchableOpacities[0].props.onPress();
125
125
  await touchableOpacities[1].props.onPress();
126
- expect(mockDoAction).toBeCalled();
126
+ expect(mockDoAction).toHaveBeenCalled();
127
127
  });
128
128
 
129
129
  it('render TouchableOpacity TwoButtonTemplate without is_on_value', async () => {
@@ -1,21 +1,21 @@
1
1
  import React from 'react';
2
2
  import {
3
- TouchableOpacity,
4
- Switch,
5
3
  ActivityIndicator,
6
4
  ScrollView,
5
+ Switch,
6
+ TouchableOpacity,
7
7
  } from 'react-native';
8
- import renderer, { act } from 'react-test-renderer';
9
8
  import DateTimePickerModal from 'react-native-modal-datetime-picker';
9
+ import renderer, { act } from 'react-test-renderer';
10
10
 
11
+ import { Slider } from '@miblanchard/react-native-slider';
11
12
  import ActionGroup from '..';
12
- import Text from '../../Text';
13
13
  import { AccessibilityLabel, BUTTON_TYPE } from '../../../configs/Constants';
14
14
  import { SCProvider } from '../../../context';
15
15
  import { mockSCStore } from '../../../context/mockStore';
16
- import { Slider } from '@miblanchard/react-native-slider';
17
- import { WheelColorPicker } from '../ColorPickerTemplate';
18
16
  import RadioCircle from '../../RadioCircle';
17
+ import Text from '../../Text';
18
+ import { WheelColorPicker } from '../ColorPickerTemplate';
19
19
  import SwitchButtonTemplate from '../OnOffTemplate/SwitchButtonTemplate';
20
20
 
21
21
  const wrapComponent = (item, mockDoAction, sensor) => (
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import renderer, { act } from 'react-test-renderer';
3
3
 
4
+ import Modal from 'react-native-modal';
4
5
  import ActionTemplate from '..';
6
+ import AccessibilityLabel from '../../../configs/AccessibilityLabel';
5
7
  import { SCProvider } from '../../../context';
6
8
  import { mockSCStore } from '../../../context/mockStore';
7
9
  import SelectActionCard from '../../SelectActionCard';
8
- import Modal from 'react-native-modal';
9
- import ThreeButtonAction from '../ThreeButtonAction';
10
- import AccessibilityLabel from '../../../configs/AccessibilityLabel';
11
10
  import Text from '../../Text';
11
+ import ThreeButtonAction from '../ThreeButtonAction';
12
12
  import { showAllCards } from './utils';
13
13
 
14
14
  const mockOnSelectAction = jest.fn();
@@ -81,7 +81,7 @@ describe('Test ActionTemplate', () => {
81
81
  template: 'three_button_action_template',
82
82
  });
83
83
  });
84
- expect(mockOnSelectAction).toBeCalledWith({
84
+ expect(mockOnSelectAction).toHaveBeenCalledWith({
85
85
  action: '94ae262d-46e3-42ff-9d10-516831ecc830',
86
86
  action_name: 'OPEN',
87
87
  data: null,
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { act, create } from 'react-test-renderer';
3
2
  import { TouchableOpacity } from 'react-native';
3
+ import { act, create } from 'react-test-renderer';
4
4
 
5
5
  import { SCProvider } from '../../../context';
6
6
  import { mockSCStore } from '../../../context/mockStore';
@@ -41,6 +41,6 @@ describe('Test ItemAutomate', () => {
41
41
  await act(async () => {
42
42
  touchableOpacities[0].props.onPress();
43
43
  });
44
- expect(mockOnPress).toBeCalledTimes(1);
44
+ expect(mockOnPress).toHaveBeenCalledTimes(1);
45
45
  });
46
46
  });
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
+ import { TouchableOpacity } from 'react-native';
2
3
  import { act, create } from 'react-test-renderer';
3
4
  import { SCProvider } from '../../../context';
4
5
  import { mockSCStore } from '../../../context/mockStore';
5
6
  import ChartAggregationOption from '../index';
6
- import { TouchableOpacity } from 'react-native';
7
7
 
8
8
  const wrapComponent = (props) => (
9
9
  <SCProvider initState={mockSCStore({})}>
@@ -31,7 +31,7 @@ it('test', async () => {
31
31
  await act(async () => {
32
32
  await buttons[index].props.onPress();
33
33
  });
34
- expect(mockSetGroupBy).toBeCalledWith(data);
34
+ expect(mockSetGroupBy).toHaveBeenCalledWith(data);
35
35
  };
36
36
 
37
37
  await clickButton(0, 'date');
@@ -1,18 +1,17 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React, { useContext } from 'react';
2
3
  import { act, create } from 'react-test-renderer';
3
- import MockAdapter from 'axios-mock-adapter';
4
4
 
5
- import MyPinnedSharedUnit from '../index';
6
- import { Text } from 'react-native';
7
- import { getTranslate } from '../../../../utils/I18n';
5
+ import { Text, TouchableOpacity } from 'react-native';
6
+ import { API } from '../../../../configs';
7
+ import { AccessibilityLabel } from '../../../../configs/Constants';
8
8
  import { SCProvider } from '../../../../context';
9
+ import { Action } from '../../../../context/actionType';
9
10
  import { mockSCStore } from '../../../../context/mockStore';
10
- import { AccessibilityLabel } from '../../../../configs/Constants';
11
- import { API } from '../../../../configs';
12
- import { TouchableOpacity } from 'react-native';
13
11
  import api from '../../../../utils/Apis/axios';
12
+ import { getTranslate } from '../../../../utils/I18n';
14
13
  import SharedUnit from '../../../Unit/SharedUnit';
15
- import { Action } from '../../../../context/actionType';
14
+ import MyPinnedSharedUnit from '../index';
16
15
 
17
16
  const mock = new MockAdapter(api.axiosInstance);
18
17
 
@@ -61,7 +60,7 @@ describe('Test MyPinnedSharedUnit', () => {
61
60
  goToAllSharedUnits.props.onPress();
62
61
  });
63
62
  expect(global.mockedNavigate).toHaveBeenCalled();
64
- expect(mockSetAction).toBeCalledWith(
63
+ expect(mockSetAction).toHaveBeenCalledWith(
65
64
  Action.IS_CHECK_CLEAR_CACHE_UNITS,
66
65
  false
67
66
  );
@@ -1,17 +1,17 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React from 'react';
2
3
  import renderer, { act } from 'react-test-renderer';
3
- import MockAdapter from 'axios-mock-adapter';
4
4
 
5
+ import FastImage from 'react-native-fast-image';
5
6
  import MyUnit from '..';
6
- import MyUnitDevice from '../../../../screens/Unit/components/MyUnitDevice';
7
+ import { API } from '../../../../configs';
7
8
  import { AccessibilityLabel } from '../../../../configs/Constants';
8
9
  import { SCProvider } from '../../../../context';
9
10
  import { mockSCStore } from '../../../../context/mockStore';
11
+ import { flushPromises } from '../../../../screens/AllGateway/test-utils';
12
+ import MyUnitDevice from '../../../../screens/Unit/components/MyUnitDevice';
10
13
  import api from '../../../../utils/Apis/axios';
11
- import { API } from '../../../../configs';
12
14
  import Routes from '../../../../utils/Route';
13
- import { flushPromises } from '../../../../screens/AllGateway/test-utils';
14
- import FastImage from 'react-native-fast-image';
15
15
  import { removeMultiple, STORAGE_KEY } from '../../../../utils/Storage';
16
16
 
17
17
  const mock = new MockAdapter(api.axiosInstance);
@@ -103,7 +103,7 @@ describe('Test MyUnit', () => {
103
103
  await act(async () => {
104
104
  await button.props.onPress(data[0]);
105
105
  });
106
- expect(global.mockedNavigate).toBeCalledWith(Routes.UnitStack, {
106
+ expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.UnitStack, {
107
107
  params: { unitId: 1 },
108
108
  screen: Routes.UnitDetail,
109
109
  });
@@ -123,7 +123,7 @@ describe('Test MyUnit', () => {
123
123
  await act(async () => {
124
124
  await button.props.onPress(data[1]);
125
125
  });
126
- expect(global.mockedNavigate).toBeCalledWith('UnitStack', {
126
+ expect(global.mockedNavigate).toHaveBeenCalledWith('UnitStack', {
127
127
  params: { unitId: 2 },
128
128
  screen: 'UnitDetail',
129
129
  });
@@ -25,7 +25,7 @@ const styles = StyleSheet.create({
25
25
  marginHorizontal: 8,
26
26
  flexDirection: 'row',
27
27
  justifyContent: 'space-between',
28
- width: 150,
28
+ width: 130,
29
29
  alignItems: 'center',
30
30
  },
31
31
  txtTime: {
@@ -43,6 +43,6 @@ describe('Test EmergencyButton', () => {
43
43
  emergencyButton.props.onLongPress();
44
44
  });
45
45
 
46
- expect(mockFunction).toBeCalled();
46
+ expect(mockFunction).toHaveBeenCalled();
47
47
  });
48
48
  });