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

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 (130) hide show
  1. package/package.json +17 -15
  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/ActionGroup/__test__/index.test.js +8 -8
  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/Device/Emergency/__test__/EmergencyButton.test.js +1 -1
  20. package/src/commons/Device/FlatListItems.js +17 -16
  21. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -3
  22. package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -3
  23. package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +6 -6
  24. package/src/commons/FlatListDnD/__test__/index.test.js +4 -4
  25. package/src/commons/FlatListDnD/index.js +12 -9
  26. package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +3 -3
  27. package/src/commons/Header/__test__/HeaderCT.test.js +3 -3
  28. package/src/commons/IconComponent/index.js +1 -1
  29. package/src/commons/ImagePicker/__test__/ImagePicker.test.js +5 -5
  30. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +6 -4
  31. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +5 -5
  32. package/src/commons/Popover/__test__/index.test.js +3 -3
  33. package/src/commons/Processing/__test__/Connecting.test.js +4 -4
  34. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +5 -5
  35. package/src/commons/SubUnit/OneTap/index.js +9 -8
  36. package/src/commons/SubUnit/__test__/ShortDetail.test.js +8 -8
  37. package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +9 -13
  38. package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +5 -5
  39. package/src/hooks/IoT/__test__/useHomeAssistantConnection.test.js +12 -12
  40. package/src/hooks/IoT/__test__/useWatchConfigs.test.js +3 -3
  41. package/src/hooks/IoT/useRemoteControl.js +6 -6
  42. package/src/hooks/useMqtt.js +2 -2
  43. package/src/iot/RemoteControl/Internet.js +2 -2
  44. package/src/iot/RemoteControl/__test__/Internet.test.js +7 -7
  45. package/src/screens/AddLocationMaps/__test__/index.test.js +12 -12
  46. package/src/screens/AddNewGateway/ShareWifiPassword.js +16 -15
  47. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -7
  48. package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +8 -8
  49. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +7 -7
  50. package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +8 -8
  51. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +5 -5
  52. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +4 -4
  53. package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -6
  54. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -6
  55. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +0 -4
  56. package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +2 -2
  57. package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +6 -6
  58. package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +19 -17
  59. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +19 -17
  60. package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +18 -16
  61. package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +43 -35
  62. package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +13 -13
  63. package/src/screens/AllGateway/__test__/index.test.js +6 -6
  64. package/src/screens/AllGateway/components/Detail/__test__/index.test.js +3 -5
  65. package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +3 -3
  66. package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +6 -6
  67. package/src/screens/AllGateway/hooks/__test__/index.test.js +2 -2
  68. package/src/screens/AllGateway/test-utils.js +3 -4
  69. package/src/screens/Automate/AddNewAction/NewActionWrapper.js +7 -7
  70. package/src/screens/Automate/AddNewAction/SelectControlDevices.js +3 -3
  71. package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +13 -13
  72. package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +14 -8
  73. package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +13 -7
  74. package/src/screens/Automate/AddNewAction/__test__/SetupScriptDelay.test.js +9 -9
  75. package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +10 -10
  76. package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +4 -3
  77. package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +13 -8
  78. package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +8 -8
  79. package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +6 -6
  80. package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +7 -7
  81. package/src/screens/Automate/EditActionsList/index.js +19 -17
  82. package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +16 -7
  83. package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +15 -7
  84. package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +4 -7
  85. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +1 -1
  86. package/src/screens/Automate/ScriptDetail/__test__/useStarredScript.test.js +6 -6
  87. package/src/screens/Automate/ScriptDetail/index.js +18 -18
  88. package/src/screens/Automate/SetSchedule/__test__/SelectWeekday.test.js +4 -4
  89. package/src/screens/Automate/SetSchedule/__test__/index.test.js +28 -18
  90. package/src/screens/Automate/SetSchedule/index.js +7 -7
  91. package/src/screens/ChangePosition/__test__/index.test.js +6 -6
  92. package/src/screens/ChangePosition/index.js +2 -1
  93. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +9 -9
  94. package/src/screens/Device/__test__/detail.test.js +12 -12
  95. package/src/screens/Device/__test__/mqttDetail.test.js +9 -9
  96. package/src/screens/Device/components/SensorDisplayItem.js +5 -5
  97. package/src/screens/Drawer/Drawer.test.js +2 -2
  98. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -7
  99. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +8 -8
  100. package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +3 -3
  101. package/src/screens/HanetCamera/__test__/Detail.test.js +9 -9
  102. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -10
  103. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +9 -9
  104. package/src/screens/Notification/__test__/Notification.test.js +9 -9
  105. package/src/screens/Notification/components/NotificationItem.js +1 -2
  106. package/src/screens/Notification/styles/NotificationItemStyles.js +0 -1
  107. package/src/screens/PlayBackCamera/__test__/index.test.js +1 -1
  108. package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
  109. package/src/screens/SelectUnit/__test__/index.test.js +7 -7
  110. package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +7 -7
  111. package/src/screens/SideMenuDetail/__test__/index.test.js +8 -8
  112. package/src/screens/SmartAccount/Connecting/index.js +5 -5
  113. package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +8 -8
  114. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +7 -7
  115. package/src/screens/SmartAccount/__test__/Connecting.test.js +6 -6
  116. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +10 -10
  117. package/src/screens/SubUnit/AddSubUnit.js +2 -4
  118. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -11
  119. package/src/screens/Template/EditTemplate.js +6 -4
  120. package/src/screens/Template/__test__/EditTemplate.test.js +7 -7
  121. package/src/screens/Template/__test__/detail.test.js +4 -4
  122. package/src/screens/Template/__test__/index.test.js +1 -1
  123. package/src/screens/Unit/Station/__test__/index.test.js +1 -1
  124. package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +9 -9
  125. package/src/screens/Unit/__test__/SelectAddress.test.js +11 -17
  126. package/src/screens/Unit/__test__/Summaries.test.js +7 -7
  127. package/src/screens/Unit/components/__test__/AutomateScript.test.js +3 -3
  128. package/src/screens/Unit/components/__test__/SharedUnit.test.js +8 -8
  129. package/src/screens/Unit/hook/__test__/useUnitConnectRemoteDevices.test.js +2 -2
  130. package/src/utils/__test__/Utils.test.js +16 -16
@@ -1,34 +1,37 @@
1
+ import { useNavigation, useRoute } from '@react-navigation/native';
2
+ import moment from 'moment';
1
3
  import React from 'react';
2
4
  import { act, create } from 'react-test-renderer';
5
+ import BottomButtonView from '../../../../commons/BottomButtonView';
6
+ import Calendar from '../../../../commons/Calendar';
7
+ import WheelDateTimePicker from '../../../../commons/WheelDateTimePicker';
8
+ import AccessibilityLabel from '../../../../configs/AccessibilityLabel';
3
9
  import { SCProvider } from '../../../../context';
4
10
  import { mockSCStore } from '../../../../context/mockStore';
5
- import SetSchedule from '../index';
6
- import RowItem from '../components/RowItem';
7
- import WheelDateTimePicker from '../../../../commons/WheelDateTimePicker';
11
+ import Routes from '../../../../utils/Route';
8
12
  import RepeatOptionsPopup, {
9
13
  REPEAT_OPTIONS,
10
14
  } from '../components/RepeatOptionsPopup';
11
- import Calendar from '../../../../commons/Calendar';
12
- import BottomButtonView from '../../../../commons/BottomButtonView';
13
- import Routes from '../../../../utils/Route';
15
+ import RowItem from '../components/RowItem';
14
16
  import SelectWeekday from '../components/SelectWeekday';
15
- import moment from 'moment';
16
- import { useNavigation } from '@react-navigation/native';
17
- import AccessibilityLabel from '../../../../configs/AccessibilityLabel';
17
+ import SetSchedule from '../index';
18
18
 
19
- const wrapComponent = (route) => (
20
- <SCProvider initState={mockSCStore({})}>
21
- <SetSchedule route={route} />
22
- </SCProvider>
23
- );
19
+ const wrapComponent = (route) => {
20
+ useRoute.mockReturnValue(route);
21
+ return (
22
+ <SCProvider initState={mockSCStore({})}>
23
+ <SetSchedule route={route} />
24
+ </SCProvider>
25
+ );
26
+ };
24
27
 
25
28
  describe('Test SetSchedule', () => {
26
29
  let tree;
27
30
  let route = {
28
31
  params: {
29
- type: 'schedule',
30
- unit: { id: 1 },
31
- isAutomateTab: true,
32
+ automate: { type: 'schedule', unit: 1 },
33
+ unitId: 1,
34
+ closeScreen: 'UnitDetail',
32
35
  },
33
36
  };
34
37
 
@@ -70,7 +73,11 @@ describe('Test SetSchedule', () => {
70
73
  await act(async () => {
71
74
  await header.props.onPress();
72
75
  });
73
- expect(global.mockedNavigate).toBeCalledWith(undefined);
76
+ expect(global.mockedNavigate).toHaveBeenCalledWith('UnitDetail', {
77
+ automate: { type: 'schedule', unit: 1 },
78
+ closeScreen: 'UnitDetail',
79
+ unitId: 1,
80
+ });
74
81
  });
75
82
 
76
83
  it('test repeat options popup', async () => {
@@ -137,7 +144,10 @@ describe('Test SetSchedule', () => {
137
144
  repeat: 'once',
138
145
  time_repeat: '12:00:00',
139
146
  weekday_repeat: [],
147
+ type: 'schedule',
148
+ unit: 1,
140
149
  },
150
+ closeScreen: 'UnitDetail',
141
151
  });
142
152
  });
143
153
  });
@@ -1,19 +1,19 @@
1
- import React, { memo, useCallback, useState } from 'react';
2
- import { ScrollView } from 'react-native';
3
1
  import { useNavigation } from '@react-navigation/native';
4
2
  import moment from 'moment';
5
- import WheelDateTimePicker from '../../../commons/WheelDateTimePicker';
3
+ import React, { memo, useCallback, useState } from 'react';
4
+ import { ScrollView } from 'react-native';
6
5
  import Calendar from '../../../commons/Calendar';
6
+ import WheelDateTimePicker from '../../../commons/WheelDateTimePicker';
7
+ import { useBoolean } from '../../../hooks/Common';
8
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
9
+ import Routes from '../../../utils/Route';
10
+ import NewActionWrapper from '../AddNewAction/NewActionWrapper';
7
11
  import RepeatOptionsPopup, {
8
12
  REPEAT_OPTIONS,
9
13
  } from './components/RepeatOptionsPopup';
10
14
  import RowItem from './components/RowItem';
11
15
  import SelectWeekday from './components/SelectWeekday';
12
- import { useBoolean } from '../../../hooks/Common';
13
- import { useTranslations } from '../../../hooks/Common/useTranslations';
14
16
  import styles from './styles/indexStyles';
15
- import Routes from '../../../utils/Route';
16
- import NewActionWrapper from '../AddNewAction/NewActionWrapper';
17
17
 
18
18
  const SetSchedule = ({ route }) => {
19
19
  const t = useTranslations();
@@ -1,16 +1,16 @@
1
- import React from 'react';
2
- import { act, create } from 'react-test-renderer';
3
- import MockAdapter from 'axios-mock-adapter';
4
1
  import { useRoute } from '@react-navigation/native';
2
+ import MockAdapter from 'axios-mock-adapter';
3
+ import React from 'react';
5
4
  import DraggableFlatList from 'react-native-draggable-flatlist';
5
+ import { act, create } from 'react-test-renderer';
6
6
 
7
7
  import ChangePosition from '../';
8
+ import BottomButtonView from '../../../commons/BottomButtonView';
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 { API } from '../../../configs';
12
13
  import { ToastBottomHelper } from '../../../utils/Utils';
13
- import BottomButtonView from '../../../commons/BottomButtonView';
14
14
 
15
15
  const mock = new MockAdapter(api.axiosInstance);
16
16
  const mockSetDisplay = jest.fn();
@@ -60,6 +60,6 @@ describe('Test ChangePosition', () => {
60
60
  expect(global.mockedGoBack).toHaveBeenCalled();
61
61
  expect(mockFetchData).toHaveBeenCalled();
62
62
  expect(mockSetDisplay).toHaveBeenCalled();
63
- expect(spyToastSuccess).toBeCalledWith('Updated widget successfully');
63
+ expect(spyToastSuccess).toHaveBeenCalledWith('Updated widget successfully');
64
64
  });
65
65
  });
@@ -49,7 +49,8 @@ const ChangePosition = () => {
49
49
  }
50
50
  };
51
51
 
52
- const renderItem = ({ item, index, drag, isActive }) => {
52
+ const renderItem = ({ item, getIndex, drag, isActive }) => {
53
+ const index = getIndex();
53
54
  return (
54
55
  <View style={styles.widgetItem}>
55
56
  <View style={[styles.itemOrder, isActive ? styles.isDragging : {}]}>
@@ -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
- import { create, act } from 'react-test-renderer';
4
- import MockAdapter from 'axios-mock-adapter';
4
+ import { act, create } from 'react-test-renderer';
5
5
 
6
- import { SCProvider } from '../../../../context';
7
- import { mockSCStore } from '../../../../context/mockStore';
6
+ import { useRoute } from '@react-navigation/native';
7
+ import Toast from 'react-native-toast-message';
8
8
  import EditDevice from '..';
9
9
  import AlertAction from '../../../../commons/AlertAction';
10
10
  import _TextInput from '../../../../commons/Form/TextInput';
11
- import { AccessibilityLabel } from '../../../../configs/Constants';
12
11
  import { API } from '../../../../configs';
13
- import { useRoute } from '@react-navigation/native';
12
+ import { AccessibilityLabel } from '../../../../configs/Constants';
13
+ import { SCProvider } from '../../../../context';
14
+ import { mockSCStore } from '../../../../context/mockStore';
14
15
  import api from '../../../../utils/Apis/axios';
15
- import Toast from 'react-native-toast-message';
16
16
  import { getTranslate } from '../../../../utils/I18n';
17
17
 
18
18
  const wrapComponent = (route) => (
@@ -96,7 +96,7 @@ describe('Test EditDevice', () => {
96
96
  await act(async () => {
97
97
  await alertAction.props.rightButtonClick();
98
98
  });
99
- expect(Toast.show).toBeCalledWith({
99
+ expect(Toast.show).toHaveBeenCalledWith({
100
100
  type: 'error',
101
101
  position: 'bottom',
102
102
  text1: getTranslate('en', 'rename_failed'),
@@ -148,7 +148,7 @@ describe('Test EditDevice', () => {
148
148
  await act(async () => {
149
149
  await alertAction.props.rightButtonClick();
150
150
  });
151
- expect(Toast.show).toBeCalledWith({
151
+ expect(Toast.show).toHaveBeenCalledWith({
152
152
  type: 'error',
153
153
  position: 'bottom',
154
154
  text1: getTranslate('en', 'remove_failed'),
@@ -1,24 +1,24 @@
1
+ import { NavigationContext, useNavigation } from '@react-navigation/native';
2
+ import MockAdapter from 'axios-mock-adapter';
1
3
  import React from 'react';
2
4
  import { Alert, ScrollView } from 'react-native';
3
5
  import { act, create } from 'react-test-renderer';
4
- import MockAdapter from 'axios-mock-adapter';
5
- import { NavigationContext, useNavigation } from '@react-navigation/native';
6
6
 
7
- import DeviceDetail from '../detail';
8
- import { API } from '../../../configs';
7
+ import AntDesign from 'react-native-vector-icons/AntDesign';
8
+ import { AlertAction, ButtonPopup, MenuActionMore } from '../../../commons';
9
+ import CurrentRainSensor from '../../../commons/Device/RainningSensor/CurrentRainSensor';
9
10
  import { AlertSendConfirm } from '../../../commons/EmergencyButton/AlertSendConfirm';
10
11
  import { AlertSent } from '../../../commons/EmergencyButton/AlertSent';
11
- import { AlertAction, ButtonPopup, MenuActionMore } from '../../../commons';
12
- import { AccessibilityLabel } from '../../../configs/Constants';
13
12
  import Text from '../../../commons/Text';
14
- import AntDesign from 'react-native-vector-icons/AntDesign';
15
- import CurrentRainSensor from '../../../commons/Device/RainningSensor/CurrentRainSensor';
16
- import { getTranslate } from '../../../utils/I18n';
13
+ import { API } from '../../../configs';
14
+ import { AccessibilityLabel } from '../../../configs/Constants';
17
15
  import { SCProvider } from '../../../context';
18
16
  import { mockSCStore } from '../../../context/mockStore';
19
- import Routes from '../../../utils/Route';
20
- import api from '../../../utils/Apis/axios';
21
17
  import { useWatchConfigs } from '../../../hooks/IoT';
18
+ import api from '../../../utils/Apis/axios';
19
+ import { getTranslate } from '../../../utils/I18n';
20
+ import Routes from '../../../utils/Route';
21
+ import DeviceDetail from '../detail';
22
22
 
23
23
  const mock = new MockAdapter(api.axiosInstance);
24
24
 
@@ -755,7 +755,7 @@ describe('test DeviceDetail', () => {
755
755
  await act(async () => {
756
756
  await create(wrapComponent(store, account, route));
757
757
  });
758
- expect(mockAlertShow).not.toBeCalled();
758
+ expect(mockAlertShow).not.toHaveBeenCalled();
759
759
  });
760
760
 
761
761
  it('Test fetchUnitDetail', async () => {
@@ -1,22 +1,22 @@
1
+ import { NavigationContext } from '@react-navigation/native';
2
+ import MockAdapter from 'axios-mock-adapter';
3
+ import mqtt from 'precompiled-mqtt/dist/mqtt.browser';
1
4
  import React from 'react';
2
5
  import { Alert } from 'react-native';
3
6
  import { act, create } from 'react-test-renderer';
4
- import MockAdapter from 'axios-mock-adapter';
5
- import mqtt from 'precompiled-mqtt/dist/mqtt.browser';
6
- import { NavigationContext } from '@react-navigation/native';
7
7
 
8
- import DeviceDetail from '../detail';
8
+ import QualityIndicatorItem from '../../../commons/Device/WaterQualitySensor/QualityIndicatorsItem';
9
9
  import { API } from '../../../configs';
10
10
  import { SCProvider } from '../../../context';
11
11
  import { mockSCStore } from '../../../context/mockStore';
12
+ import { watchMultiConfigs } from '../../../iot/Monitor';
13
+ import { setConfigGlobalState } from '../../../iot/states';
12
14
  import api from '../../../utils/Apis/axios';
13
15
  import {
14
- gatewayDataFactory,
15
16
  configDataFactory,
17
+ gatewayDataFactory,
16
18
  } from '../../../utils/FactoryGateway';
17
- import QualityIndicatorItem from '../../../commons/Device/WaterQualitySensor/QualityIndicatorsItem';
18
- import { watchMultiConfigs } from '../../../iot/Monitor';
19
- import { setConfigGlobalState } from '../../../iot/states';
19
+ import DeviceDetail from '../detail';
20
20
 
21
21
  const mock = new MockAdapter(api.axiosInstance);
22
22
 
@@ -194,7 +194,7 @@ describe('test DeviceDetail', () => {
194
194
  await act(async () => {
195
195
  tree.unmount();
196
196
  });
197
- expect(client.end).toBeCalled();
197
+ expect(client.end).toHaveBeenCalled();
198
198
  });
199
199
 
200
200
  const _receiveDataOnDeviceDetail = async (widgetConfigs, topic, message) => {
@@ -13,19 +13,19 @@ import ListQualityIndicator from '../../../commons/Device/WaterQualitySensor/Lis
13
13
  import Compass from '../../../commons/Device/WindDirection/Compass';
14
14
  import Anemometer from '../../../commons/Device/WindSpeed/Anemometer';
15
15
  import MediaPlayerDetail from '../../../commons/MediaPlayerDetail';
16
+ import IFrame from '../../../commons/Widgets/IFrame/IFrame';
17
+ import IFrameWithConfig from '../../../commons/Widgets/IFrameWithConfig/IFrameWithConfig';
18
+ import { Device } from '../../../configs';
16
19
  import { AccessibilityLabel, WIDGET_TYPE } from '../../../configs/Constants';
17
20
  import { useSCContextSelector } from '../../../context';
18
21
  import { useRemoteControl } from '../../../hooks/IoT';
19
22
  import { useConfigGlobalState } from '../../../iot/states';
20
23
  import SmartIr from '../../../screens/SmartIr';
24
+ import { standardizeCameraScreenSize } from '../../../utils/Utils';
21
25
  import { useEvaluateValue } from '../hooks/useEvaluateValue';
22
26
  import styles from '../styles';
23
- import VisualChart from './VisualChart';
24
- import { standardizeCameraScreenSize } from '../../../utils/Utils';
25
- import { Device } from '../../../configs';
26
27
  import DonutCharts from './DonutChart';
27
- import IFrame from '../../../commons/Widgets/IFrame/IFrame';
28
- import IFrameWithConfig from '../../../commons/Widgets/IFrameWithConfig/IFrameWithConfig';
28
+ import VisualChart from './VisualChart';
29
29
 
30
30
  const { standardizeWidth, standardizeHeight } = standardizeCameraScreenSize(
31
31
  Device.screenWidth - 32
@@ -1,10 +1,10 @@
1
+ import { useNavigation } from '@react-navigation/native';
1
2
  import React from 'react';
2
3
  import renderer, { act } from 'react-test-renderer';
3
4
  import AccessibilityLabel from '../../configs/AccessibilityLabel';
4
5
  import { SCProvider } from '../../context';
5
6
  import { mockSCStore } from '../../context/mockStore';
6
7
  import Drawer, { Row } from './index';
7
- import { useNavigation } from '@react-navigation/native';
8
8
 
9
9
  const wrapComponent = (initState = mockSCStore({})) => (
10
10
  <SCProvider initState={initState}>
@@ -35,7 +35,7 @@ describe('Drawer', () => {
35
35
  await act(async () => {
36
36
  await rows[2].props.onPress();
37
37
  });
38
- expect(dispatch).toBeCalledWith({
38
+ expect(dispatch).toHaveBeenCalledWith({
39
39
  payload: { index: 0, routes: [{ name: 'Main' }] },
40
40
  type: 'RESET',
41
41
  });
@@ -1,16 +1,16 @@
1
- import React from 'react';
2
- import { act, create } from 'react-test-renderer';
3
1
  import MockAdapter from 'axios-mock-adapter';
2
+ import React from 'react';
4
3
  import Toast from 'react-native-toast-message';
4
+ import { act, create } from 'react-test-renderer';
5
5
 
6
- import { EmergencyContactsSelectContacts } from '../EmergencyContactsSelectContacts';
6
+ import { ViewButtonBottom } from '../../../commons';
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';
10
- import { API } from '../../../configs';
11
- import { ViewButtonBottom } from '../../../commons';
12
11
  import api from '../../../utils/Apis/axios';
13
12
  import { getTranslate } from '../../../utils/I18n';
13
+ import { EmergencyContactsSelectContacts } from '../EmergencyContactsSelectContacts';
14
14
 
15
15
  const mock = new MockAdapter(api.axiosInstance);
16
16
 
@@ -79,7 +79,7 @@ describe('test EmergencyContactsSelectContacts', () => {
79
79
  await act(async () => {
80
80
  viewButtonBottom.props.onRightClick();
81
81
  });
82
- expect(Toast.show).toBeCalledWith({
82
+ expect(Toast.show).toHaveBeenCalledWith({
83
83
  type: 'success',
84
84
  position: 'bottom',
85
85
  text1: getTranslate('en', 'saving_contact_successful'),
@@ -98,7 +98,7 @@ describe('test EmergencyContactsSelectContacts', () => {
98
98
  await act(async () => {
99
99
  viewButtonBottom.props.onRightClick();
100
100
  });
101
- expect(Toast.show).toBeCalledWith({
101
+ expect(Toast.show).toHaveBeenCalledWith({
102
102
  type: 'error',
103
103
  position: 'bottom',
104
104
  text1: getTranslate('en', 'create_contact_failed'),
@@ -1,15 +1,15 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React from 'react';
2
- import { create, act } from 'react-test-renderer';
3
3
  import { TouchableOpacity } from 'react-native';
4
- import MockAdapter from 'axios-mock-adapter';
4
+ import { act, create } from 'react-test-renderer';
5
5
 
6
+ import { useNavigation } from '@react-navigation/native';
7
+ import { API } from '../../../configs';
8
+ import { AccessibilityLabel } from '../../../configs/Constants';
6
9
  import { SCProvider } from '../../../context';
7
10
  import { mockSCStore } from '../../../context/mockStore';
8
- import EnterPassword from '../index';
9
- import { AccessibilityLabel } from '../../../configs/Constants';
10
- import { API } from '../../../configs';
11
11
  import api from '../../../utils/Apis/axios';
12
- import { useNavigation } from '@react-navigation/native';
12
+ import EnterPassword from '../index';
13
13
 
14
14
  const mock = new MockAdapter(api.axiosInstance);
15
15
 
@@ -103,7 +103,7 @@ describe('Test EnterPassword', () => {
103
103
  await act(async () => {
104
104
  await button[0].props.onPress();
105
105
  });
106
- expect(navigate).toBeCalled();
106
+ expect(navigate).toHaveBeenCalled();
107
107
  });
108
108
 
109
109
  it('test EnterPassword button failure', async () => {
@@ -125,6 +125,6 @@ describe('Test EnterPassword', () => {
125
125
  await act(async () => {
126
126
  await button[0].props.onPress();
127
127
  });
128
- expect(navigate).not.toBeCalled();
128
+ expect(navigate).not.toHaveBeenCalled();
129
129
  });
130
130
  });
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import { create, act } from 'react-test-renderer';
2
+ import { act, create } from 'react-test-renderer';
3
3
 
4
+ import BottomSheet from '../../../../commons/BottomSheet';
4
5
  import { SCProvider } from '../../../../context';
5
6
  import { mockSCStore } from '../../../../context/mockStore';
6
7
  import AccessScheduleSheet from '../AccessScheduleSheet';
7
- import BottomSheet from '../../../../commons/BottomSheet';
8
8
 
9
9
  const wrapComponent = (props) => (
10
10
  <SCProvider initState={mockSCStore({})}>
@@ -47,6 +47,6 @@ describe('AccessScheduleSheet', () => {
47
47
  await act(async () => {
48
48
  bottomSheet[0].props.onBackdropPress();
49
49
  });
50
- expect(mockOnHide).toBeCalled();
50
+ expect(mockOnHide).toHaveBeenCalled();
51
51
  });
52
52
  });
@@ -1,18 +1,18 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React from 'react';
2
3
  import { FlatList } from 'react-native';
3
- import { create, act } from 'react-test-renderer';
4
- import MockAdapter from 'axios-mock-adapter';
4
+ import { act, create } from 'react-test-renderer';
5
5
 
6
+ import moment from 'moment';
7
+ import { MenuActionMore } from '../../../commons';
8
+ import Calendar from '../../../commons/Calendar';
9
+ import { API } from '../../../configs';
10
+ import { AccessibilityLabel } from '../../../configs/Constants';
6
11
  import { SCProvider } from '../../../context';
7
12
  import { mockSCStore } from '../../../context/mockStore';
13
+ import api from '../../../utils/Apis/axios';
8
14
  import HanetCameraDetail from '../Detail';
9
15
  import CheckinHeader from '../components/CheckinHeader';
10
- import moment from 'moment';
11
- import { AccessibilityLabel } from '../../../configs/Constants';
12
- import Calendar from '../../../commons/Calendar';
13
- import api from '../../../utils/Apis/axios';
14
- import { API } from '../../../configs';
15
- import { MenuActionMore } from '../../../commons';
16
16
 
17
17
  const wrapComponent = (route) => (
18
18
  <SCProvider initState={mockSCStore({})}>
@@ -103,7 +103,7 @@ describe('Test HanetCameraDetail', () => {
103
103
  expect(textCountStranger.props.children).toBe(1);
104
104
  const MenuActionMores = instance.findByType(MenuActionMore);
105
105
  await MenuActionMores.props.onItemClick({ data: 'test' });
106
- expect(global.mockedNavigate).toBeCalled();
106
+ expect(global.mockedNavigate).toHaveBeenCalled();
107
107
  });
108
108
 
109
109
  it('Test change date', async () => {
@@ -1,19 +1,19 @@
1
+ import MockAdapter from 'axios-mock-adapter';
1
2
  import React from 'react';
2
3
  import { TouchableOpacity } from 'react-native';
3
- import { create, act } from 'react-test-renderer';
4
- import MockAdapter from 'axios-mock-adapter';
4
+ import { act, create } from 'react-test-renderer';
5
5
 
6
- import { SCProvider } from '../../../context';
7
- import { mockSCStore } from '../../../context/mockStore';
8
- import HanetMemberInfo from '../MemberInfo';
6
+ import { useNavigation } from '@react-navigation/native';
9
7
  import { AlertAction } from '../../../commons';
10
- import TextInput from '../../../commons/Form/TextInput';
11
8
  import BottomButtonView from '../../../commons/BottomButtonView';
12
9
  import BottomSheet from '../../../commons/BottomSheet';
10
+ import TextInput from '../../../commons/Form/TextInput';
11
+ import { API } from '../../../configs';
13
12
  import { AccessibilityLabel } from '../../../configs/Constants';
13
+ import { SCProvider } from '../../../context';
14
+ import { mockSCStore } from '../../../context/mockStore';
14
15
  import api from '../../../utils/Apis/axios';
15
- import { API } from '../../../configs';
16
- import { useNavigation } from '@react-navigation/native';
16
+ import HanetMemberInfo from '../MemberInfo';
17
17
 
18
18
  const wrapComponent = (route) => (
19
19
  <SCProvider initState={mockSCStore({})}>
@@ -113,7 +113,7 @@ describe('Test HanetMemberInfo', () => {
113
113
  await chooseSetFaceIDOption(instance, 0);
114
114
 
115
115
  expect(bottomSheet.props.isVisible).toBe(false);
116
- expect(navigate).toBeCalled(); // navigate to HanetCaptureFaceID
116
+ expect(navigate).toHaveBeenCalled(); // navigate to HanetCaptureFaceID
117
117
  });
118
118
 
119
119
  it('Test set photo id choose file', async () => {
@@ -176,6 +176,6 @@ describe('Test HanetMemberInfo', () => {
176
176
  await act(async () => {
177
177
  await bottomButton.props.onPressMain();
178
178
  });
179
- expect(navigate).toBeCalled();
179
+ expect(navigate).toHaveBeenCalled();
180
180
  });
181
181
  });
@@ -1,17 +1,17 @@
1
- import React from 'react';
2
- import MockAdapter from 'axios-mock-adapter';
3
- import { create } from 'react-test-renderer';
4
1
  import { act } from '@testing-library/react-hooks';
2
+ import MockAdapter from 'axios-mock-adapter';
3
+ import React from 'react';
5
4
  import { TouchableOpacity } from 'react-native';
5
+ import { create } from 'react-test-renderer';
6
6
 
7
- import { AccessibilityLabel } from '../../../configs/Constants';
8
- import { API } from '../../../configs';
7
+ import { useNavigation } from '@react-navigation/native';
9
8
  import MoveToAnotherSubUnit from '../';
9
+ import BottomButtonView from '../../../commons/BottomButtonView';
10
+ import { API } from '../../../configs';
11
+ import { AccessibilityLabel } from '../../../configs/Constants';
10
12
  import { SCProvider } from '../../../context';
11
13
  import { mockSCStore } from '../../../context/mockStore';
12
- import BottomButtonView from '../../../commons/BottomButtonView';
13
14
  import api from '../../../utils/Apis/axios';
14
- import { useNavigation } from '@react-navigation/native';
15
15
 
16
16
  const mock = new MockAdapter(api.axiosInstance);
17
17
 
@@ -128,7 +128,7 @@ describe('Test Render ListSubUnit', () => {
128
128
  await bottomButtonView.props.onPressMain();
129
129
  });
130
130
 
131
- expect(global.mockedNavigate).toBeCalled();
131
+ expect(global.mockedNavigate).toHaveBeenCalled();
132
132
  const touchableOpacities = instance.findAllByType(TouchableOpacity);
133
133
  await act(async () => {
134
134
  await touchableOpacities[2].props.onPress();
@@ -140,6 +140,6 @@ describe('Test Render ListSubUnit', () => {
140
140
  await act(async () => {
141
141
  await bottomButtonView.props.onPressMain();
142
142
  });
143
- expect(global.mockedNavigate).not.toBeCalled();
143
+ expect(global.mockedNavigate).not.toHaveBeenCalled();
144
144
  });
145
145
  });
@@ -1,19 +1,19 @@
1
- import React from 'react';
2
- import { act, create } from 'react-test-renderer';
1
+ import { NavigationContext } from '@react-navigation/native';
3
2
  import MockAdapter from 'axios-mock-adapter';
3
+ import React from 'react';
4
4
  import { Animated, RefreshControl } from 'react-native';
5
- import { NavigationContext } from '@react-navigation/native';
5
+ import { act, create } from 'react-test-renderer';
6
6
 
7
+ import { WrapHeaderScrollable } from '../../../commons';
8
+ import { API } from '../../../configs';
7
9
  import { SCProvider } from '../../../context';
8
10
  import { mockSCStore } from '../../../context/mockStore';
9
- import Notification from '../index';
10
- import NotificationItem from '../components/NotificationItem';
11
- import { API } from '../../../configs';
12
11
  import api from '../../../utils/Apis/axios';
13
- import { WrapHeaderScrollable } from '../../../commons';
12
+ import NotificationItem from '../components/NotificationItem';
13
+ import Notification from '../index';
14
14
 
15
- import { getPusher } from '../../../utils/Pusher';
16
15
  import { NOTIFICATION_TYPES } from '../../../configs/Constants';
16
+ import { getPusher } from '../../../utils/Pusher';
17
17
 
18
18
  const wrapComponent = () => (
19
19
  <SCProvider initState={mockSCStore({})}>
@@ -155,7 +155,7 @@ describe('test Notification', () => {
155
155
  tree = await create(wrapComponent());
156
156
  await tree.unmount();
157
157
  });
158
- expect(getPusher().unsubscribe).toBeCalledWith('private-user-1');
158
+ expect(getPusher().unsubscribe).toHaveBeenCalledWith('private-user-1');
159
159
  });
160
160
  it('test render trigger script notification', async () => {
161
161
  const response = {
@@ -72,8 +72,7 @@ const NotificationItem = memo(({ item }) => {
72
72
  },
73
73
  iconContent: (
74
74
  <IconComponent
75
- icon={'usergroup-add'}
76
- outlined
75
+ icon={'addusergroup'}
77
76
  style={styles.backgroundSummer}
78
77
  />
79
78
  ),
@@ -31,7 +31,6 @@ export default StyleSheet.create({
31
31
  lineHeight: 23,
32
32
  },
33
33
  backgroundSummer: {
34
- width: '46%',
35
34
  color: Colors.Summer,
36
35
  },
37
36
  logo: {
@@ -5,11 +5,11 @@ import { Calendar } from 'react-native-calendars';
5
5
 
6
6
  import { act, create } from 'react-test-renderer';
7
7
  import PlayBackCamera from '..';
8
+ import MediaPlayerFull from '../../../commons/MediaPlayerDetail/MediaPlayerFull';
8
9
  import Text from '../../../commons/Text';
9
10
  import { AccessibilityLabel } from '../../../configs/Constants';
10
11
  import { SCProvider } from '../../../context';
11
12
  import { mockSCStore } from '../../../context/mockStore';
12
- import MediaPlayerFull from '../../../commons/MediaPlayerDetail/MediaPlayerFull';
13
13
  import Timer from '../Timer';
14
14
 
15
15
  const wrapComponent = () => (
@@ -48,6 +48,6 @@ describe('Test QRScan', () => {
48
48
  await act(async () => {
49
49
  RNCam.props.onBarCodeRead(e);
50
50
  });
51
- expect(mockedOnScan).toBeCalled();
51
+ expect(mockedOnScan).toHaveBeenCalled();
52
52
  });
53
53
  });