@eohjsc/react-native-smart-city 0.3.4 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -36
- package/package.json +5 -9
- package/react-native-smart-city.podspec +0 -1
- package/src/commons/Action/ItemQuickAction.js +4 -16
- package/src/commons/Action/__test__/ItemQuickAction.test.js +6 -11
- package/src/commons/ActionGroup/ColorPickerTemplate.js +24 -37
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +5 -10
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +31 -12
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +0 -4
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +1 -1
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +0 -14
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +0 -1
- package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +2 -8
- package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +10 -10
- package/src/commons/ActionGroup/OnOffTemplate/index.js +2 -3
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +9 -7
- package/src/commons/ActionGroup/SliderRangeTemplate.js +2 -6
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +3 -7
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +8 -22
- package/src/commons/ActionGroup/TimerActionTemplate.js +3 -11
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +5 -1
- package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +4 -53
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +83 -3
- package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +14 -14
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +78 -53
- package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +20 -36
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +57 -1
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +6 -58
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +1 -49
- package/src/commons/ActionGroup/__test__/index.test.js +4 -142
- package/src/commons/Auth/AccountList.js +1 -1
- package/src/commons/Automate/ItemAutomate.js +3 -1
- package/src/commons/Connecting/__test__/Connecting.test.js +2 -19
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +3 -7
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +11 -8
- package/src/commons/ConnectingProcess/__test__/Connecting.test.js +3 -136
- package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +2 -3
- package/src/commons/ConnectingProcess/index.js +25 -75
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +13 -16
- package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +1 -1
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +5 -0
- package/src/commons/Device/ConnectedViewHeader.js +1 -1
- package/src/commons/Device/HistoryChart.js +3 -7
- package/src/commons/Device/ItemDevice.js +12 -19
- package/src/commons/Device/LinearChart.js +0 -15
- package/src/commons/Device/PMSensor/PMSensorIndicatior.js +12 -16
- package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +0 -3
- package/src/commons/Device/SonosSpeaker/index.js +1 -1
- package/src/commons/Device/WaterQualitySensor/ListQualityIndicator.js +0 -1
- package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +2 -7
- package/src/commons/Explore/__test__/CityItem.test.js +54 -33
- package/src/commons/Form/CurrencyInput.js +1 -15
- package/src/commons/Form/TextInputPassword.js +1 -1
- package/src/commons/FullLoading/index.js +1 -2
- package/src/commons/Header/HeaderCustom.js +1 -2
- package/src/commons/HeaderAni/index.js +1 -6
- package/src/commons/HorizontalPicker/index.js +2 -2
- package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +6 -0
- package/src/commons/MediaPlayerDetail/index.js +47 -25
- package/src/commons/MenuActionAddnew/index.js +0 -1
- package/src/commons/MenuActionList/index.js +0 -1
- package/src/commons/MenuActionMore/index.js +1 -1
- package/src/commons/PreventAccess/index.js +1 -9
- package/src/commons/Sharing/MemberList.js +2 -10
- package/src/commons/Sharing/WrapHeaderScrollable.js +0 -2
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -0
- package/src/commons/SubUnit/Favorites/index.js +3 -2
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +35 -8
- package/src/commons/SubUnit/OneTap/index.js +2 -1
- package/src/commons/SubUnit/ShortDetail.js +9 -25
- package/src/commons/SubUnit/__test__/Item.test.js +1 -0
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +2 -9
- package/src/commons/Unit/SharedUnit.js +0 -1
- package/src/commons/Unit/__test__/SharedUnit.test.js +183 -38
- package/src/commons/UnitSummary/ConfigHistoryChart/index.js +13 -2
- package/src/commons/UnitSummary/ConfigHistoryChart.js +13 -22
- package/src/commons/WheelDateTimePicker/index.js +3 -4
- package/src/configs/API.js +143 -87
- package/src/configs/Constants.js +2 -57
- package/src/configs/SCConfig.js +0 -4
- package/src/context/actionType.ts +0 -8
- package/src/context/mockStore.ts +0 -10
- package/src/context/reducer.ts +2 -38
- package/src/hooks/Common/index.js +0 -2
- package/src/hooks/Common/useGetIdUser.js +5 -1
- package/src/hooks/Common/useSensorsStatus.js +4 -4
- package/src/hooks/useReceiveNotifications.js +5 -9
- package/src/iot/Monitor.js +2 -3
- package/src/iot/RemoteControl/Bluetooth.js +1 -1
- package/src/iot/RemoteControl/GoogleHome.js +49 -75
- package/src/iot/RemoteControl/Internet.js +1 -1
- package/src/iot/RemoteControl/__test__/GoogleHome.test.js +48 -95
- package/src/iot/RemoteControl/__test__/Internet.test.js +7 -18
- package/src/iot/RemoteControl/__test__/LgThinq.test.js +177 -36
- package/src/iot/RemoteControl/index.js +52 -52
- package/src/navigations/UnitStack.js +20 -11
- package/src/screens/AQIGuide/index.js +1 -1
- package/src/screens/ActivityLog/FilterPopup.js +0 -2
- package/src/screens/ActivityLog/__test__/index.test.js +23 -38
- package/src/screens/ActivityLog/hooks/__test__/index.test.js +90 -51
- package/src/screens/ActivityLog/hooks/index.js +1 -1
- package/src/screens/ActivityLog/index.js +2 -2
- package/src/screens/AddCommon/SelectSubUnit.js +0 -1
- package/src/screens/AddCommon/SelectUnit.js +0 -1
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +24 -13
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +33 -9
- package/src/screens/AddLocationMaps/index.js +5 -9
- package/src/screens/AddNewAction/SelectAction.js +8 -8
- package/src/screens/AddNewAction/SelectSensorDevices.js +2 -8
- package/src/screens/AddNewAction/SetupSensor.js +7 -7
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +91 -10
- package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +26 -40
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +1 -3
- package/src/screens/AddNewAutoSmart/index.js +2 -5
- package/src/screens/AddNewDevice/ConnectingDevices.js +3 -3
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +34 -42
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +4 -0
- package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +22 -22
- package/src/screens/AddNewDevice/hooks/ConnectDevices.js +1 -1
- package/src/screens/AddNewDevice/index.js +0 -1
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +17 -23
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +4 -7
- package/src/screens/AddNewGateway/SelectGateway.js +0 -1
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +0 -2
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +6 -4
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +4 -0
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +29 -5
- package/src/screens/AddNewGateway/__test__/SelectGateway.test.js +4 -0
- package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +4 -0
- package/src/screens/AddNewGateway/index.js +0 -1
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +24 -10
- package/src/screens/AddNewOneTap/index.js +2 -3
- package/src/screens/AllCamera/index.js +4 -4
- package/src/screens/Automate/MultiUnits.js +8 -8
- package/src/screens/Automate/__test__/MultiUnits.test.js +9 -6
- package/src/screens/Automate/__test__/index.test.js +12 -7
- package/src/screens/Automate/index.js +3 -5
- package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +8 -36
- package/src/screens/ConfirmUnitDeletion/index.js +1 -7
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +22 -71
- package/src/screens/Device/EditDevice/index.js +15 -17
- package/src/screens/Device/__test__/detail.test.js +86 -33
- package/src/screens/Device/components/DetailHistoryChart.js +1 -1
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +0 -1
- package/src/screens/Device/components/SensorDisplayItem.js +2 -5
- package/src/screens/Device/detail.js +24 -80
- package/src/screens/Device/hooks/useDisconnectedDevice.js +4 -4
- package/src/screens/Device/hooks/useFavoriteDevice.js +9 -5
- package/src/screens/DeviceInfo/__test__/index.test.js +2 -0
- package/src/screens/EditActionsList/index.js +1 -1
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -6
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +19 -7
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +2 -20
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +23 -40
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/EmergencySetting/index.js +1 -4
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +25 -41
- package/src/screens/Explore/index.js +0 -2
- package/src/screens/GuestInfo/__test__/index.test.js +41 -14
- package/src/screens/GuestInfo/components/RecurringDetail.js +0 -1
- package/src/screens/GuestInfo/components/TemporaryDetail.js +2 -2
- package/src/screens/HanetCamera/Detail.js +1 -1
- package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +12 -8
- package/src/screens/HanetCamera/__test__/Detail.test.js +42 -27
- package/src/screens/HanetCamera/__test__/ManageAccess.test.js +5 -8
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +32 -10
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -3
- package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +35 -43
- package/src/screens/HanetCamera/hooks/__test__/useHanetPlaceMembers.test.js +21 -10
- package/src/screens/HanetCamera/hooks/useHanetCheckinData.js +11 -11
- package/src/screens/HanetCamera/hooks/useHanetPlaceMembers.js +11 -11
- package/src/screens/ManageAccess/__test__/ManageAccess.test.js +22 -33
- package/src/screens/ManageAccess/hooks/__test__/useManageAccess.test.js +45 -44
- package/src/screens/ManageAccess/hooks/index.js +4 -7
- package/src/screens/ManageAccess/index.js +1 -2
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +12 -35
- package/src/screens/MoveToAnotherSubUnit/index.js +6 -6
- package/src/screens/Notification/__test__/Notification.test.js +25 -14
- package/src/screens/Notification/__test__/NotificationItem.test.js +7 -8
- package/src/screens/Notification/components/NotificationItem.js +20 -17
- package/src/screens/Notification/index.js +2 -9
- package/src/screens/PlayBackCamera/Timer.js +2 -2
- package/src/screens/PlayBackCamera/__test__/index.test.js +2 -87
- package/src/screens/PlayBackCamera/index.js +6 -22
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +20 -7
- package/src/screens/ScanChipQR/components/QRScan/index.js +0 -1
- package/src/screens/ScanChipQR/hooks/index.js +16 -15
- package/src/screens/ScanSensorQR/__test__/ScanSensorQR.test.js +24 -8
- package/src/screens/ScriptDetail/__test__/index.test.js +86 -17
- package/src/screens/ScriptDetail/index.js +14 -19
- package/src/screens/SelectUnit/__test__/index.test.js +55 -12
- package/src/screens/SelectUnit/index.js +4 -9
- package/src/screens/SetSchedule/index.js +11 -15
- package/src/screens/SharedUnit/__test__/TabHeader.test.js +2 -0
- package/src/screens/SharedUnit/index.js +0 -2
- package/src/screens/Sharing/Components/SensorItem.js +12 -10
- package/src/screens/Sharing/InfoMemberUnit.js +1 -1
- package/src/screens/Sharing/MemberList.js +11 -12
- package/src/screens/Sharing/SelectPermission.js +76 -121
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +29 -47
- package/src/screens/Sharing/__test__/MemberList.test.js +127 -13
- package/src/screens/Sharing/__test__/SelectPermission.test.js +38 -28
- package/src/screens/Sharing/__test__/SelectUser.test.js +38 -17
- package/src/screens/Sharing/hooks/index.js +0 -3
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +2 -3
- package/src/screens/SmartIr/components/SelectBrand.js +1 -1
- package/src/screens/SubUnit/AddSubUnit.js +17 -23
- package/src/screens/SubUnit/Detail.js +2 -1
- package/src/screens/SubUnit/EditSubUnit.js +13 -15
- package/src/screens/SubUnit/ManageSubUnit.js +7 -13
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +89 -29
- package/src/screens/SubUnit/__test__/Detail.test.js +8 -31
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +89 -21
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +1 -27
- package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +45 -48
- package/src/screens/SubUnit/hooks/useManageSubUnit.js +7 -7
- package/src/screens/SyncLGDevice/AddLGDevice.js +0 -1
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +91 -22
- package/src/screens/TDSGuide/index.js +1 -4
- package/src/screens/UVIndexGuide/index.js +1 -1
- package/src/screens/Unit/ChooseLocation.js +14 -7
- package/src/screens/Unit/Detail.js +75 -30
- package/src/screens/Unit/ManageUnit.js +0 -1
- package/src/screens/Unit/SelectAddress.js +23 -45
- package/src/screens/Unit/SmartAccount.js +4 -4
- package/src/screens/Unit/Station/index.js +0 -4
- package/src/screens/Unit/Summaries.js +2 -18
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +29 -24
- package/src/screens/Unit/__test__/ChooseLocation.test.js +14 -27
- package/src/screens/Unit/__test__/Detail.test.js +200 -99
- package/src/screens/Unit/__test__/ManageUnit.test.js +42 -18
- package/src/screens/Unit/__test__/SelectAddress.test.js +49 -159
- package/src/screens/Unit/__test__/SmartAccount.test.js +9 -17
- package/src/screens/Unit/__test__/SmartAccountItem.test.js +1 -0
- package/src/screens/Unit/components/MyUnitDevice/index.js +4 -4
- package/src/screens/Unit/components/SharedUnit/index.js +0 -1
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +34 -31
- package/src/screens/Unit/styles.js +0 -4
- package/src/screens/UnitSummary/__test__/index.test.js +30 -91
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +2 -31
- package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/__test__/index.test.js +4 -7
- package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/index.js +13 -2
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/ItemPower.test.js +1 -0
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +16 -14
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +2 -11
- package/src/screens/UnitSummary/components/RunningDevices/index.js +10 -7
- package/src/screens/UnitSummary/components/Temperature/index.js +4 -4
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +2 -10
- package/src/screens/UnitSummary/index.js +1 -15
- package/src/screens/WaterQualityGuide/index.js +1 -1
- package/src/utils/Apis/axios.js +31 -54
- package/src/utils/Converter/time.js +18 -0
- package/src/utils/I18n/translations/en.json +1 -7
- package/src/utils/I18n/translations/vi.json +1 -8
- package/src/utils/Route/index.js +0 -1
- package/src/utils/Utils.js +7 -11
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/ItemPasscode.test.js +0 -24
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplateWithNullConfigValue.test.js +0 -60
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +0 -77
- package/src/commons/Calendar/__test__/Calendar.test.js +0 -33
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +0 -58
- package/src/commons/FieldTemplate/ChooseUserField/ChooseFieldStyles.js +0 -25
- package/src/commons/FieldTemplate/ChooseUserField/ChoosePopup.js +0 -96
- package/src/commons/FieldTemplate/ChooseUserField/ChoosePopupStyles.js +0 -39
- package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +0 -118
- package/src/commons/FieldTemplate/ChooseUserField/index.js +0 -62
- package/src/commons/FieldTemplate/PasscodeField/PasscodeFieldStyles.js +0 -30
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +0 -90
- package/src/commons/FieldTemplate/PasscodeField/index.js +0 -43
- package/src/commons/FieldTemplate/ScheduleField/ScheduleFieldStyles.js +0 -13
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +0 -179
- package/src/commons/FieldTemplate/ScheduleField/index.js +0 -176
- package/src/commons/PreventAccess/__test__/PreventAccess.test.js +0 -62
- package/src/hooks/Common/useGGHomeDeviceConnected.js +0 -16
- package/src/hooks/IoT/__test__/useGGHomeConnection.test.js +0 -198
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +0 -198
- package/src/hooks/IoT/index.js +0 -4
- package/src/hooks/IoT/useGGHomeConnection.js +0 -91
- package/src/hooks/IoT/useRemoteControl.js +0 -79
- package/src/hooks/index.js +0 -4
- package/src/navigations/UnitStackStyles.js +0 -21
- package/src/screens/Sharing/__test__/MemberList2.test.js +0 -80
- package/src/screens/SideMenuDetail/SideMenuDetailStyles.js +0 -28
- package/src/screens/SideMenuDetail/__test__/index.test.js +0 -154
- package/src/screens/SideMenuDetail/index.js +0 -148
- package/src/screens/Unit/__test__/Summaries.test.js +0 -100
- package/src/screens/Unit/components/MyAllUnit/__test__/MyAllUnit.test.js +0 -36
- package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +0 -54
- package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +0 -50
- package/src/utils/Permission/common.js +0 -67
- package/src/utils/Setting/Location.js +0 -30
- package/src/utils/__test__/Utils.test.js +0 -12
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { create, act } from 'react-test-renderer';
|
|
3
3
|
import { TouchableOpacity } from 'react-native';
|
|
4
|
-
import
|
|
4
|
+
import axios from 'axios';
|
|
5
5
|
|
|
6
6
|
import { SCProvider } from '../../../context';
|
|
7
7
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
8
|
import EnterPassword from '../index';
|
|
9
9
|
import { TESTID } from '../../../configs/Constants';
|
|
10
10
|
import { API } from '../../../configs';
|
|
11
|
-
import api from '../../../utils/Apis/axios';
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
jest.mock('axios');
|
|
14
13
|
|
|
15
14
|
const wrapComponent = (route) => (
|
|
16
15
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -38,11 +37,20 @@ describe('Test EnterPassword', () => {
|
|
|
38
37
|
el.type === TouchableOpacity
|
|
39
38
|
);
|
|
40
39
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
const mockAxios = (response, method) => {
|
|
41
|
+
switch (method) {
|
|
42
|
+
case 'get':
|
|
43
|
+
return axios.get.mockImplementation(async () => {
|
|
44
|
+
return response;
|
|
45
|
+
});
|
|
46
|
+
case 'put':
|
|
47
|
+
return axios.put.mockImplementation(async () => {
|
|
48
|
+
return response;
|
|
49
|
+
});
|
|
50
|
+
default:
|
|
51
|
+
return '';
|
|
52
|
+
}
|
|
53
|
+
};
|
|
46
54
|
test('test render EnterPassword button done', () => {
|
|
47
55
|
const route = {
|
|
48
56
|
params: { dataParams: {}, type: '' },
|
|
@@ -55,16 +63,6 @@ describe('Test EnterPassword', () => {
|
|
|
55
63
|
expect(button).toHaveLength(1);
|
|
56
64
|
});
|
|
57
65
|
|
|
58
|
-
test('test render EnterPassword has not params', () => {
|
|
59
|
-
const route = {};
|
|
60
|
-
act(() => {
|
|
61
|
-
tree = create(wrapComponent(route));
|
|
62
|
-
});
|
|
63
|
-
const instance = tree.root;
|
|
64
|
-
const button = buttonDone(instance);
|
|
65
|
-
expect(button).toHaveLength(1);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
66
|
test('test render EnterPassword text input password', () => {
|
|
69
67
|
const route = {
|
|
70
68
|
params: { dataParams: {}, type: '' },
|
|
@@ -104,37 +102,23 @@ describe('Test EnterPassword', () => {
|
|
|
104
102
|
type: 'infoMemberUnit',
|
|
105
103
|
},
|
|
106
104
|
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
});
|
|
111
|
-
const instance = tree.root;
|
|
112
|
-
const button = buttonDone(instance);
|
|
113
|
-
await act(async () => {
|
|
114
|
-
await button[0].props.onPress();
|
|
115
|
-
});
|
|
116
|
-
expect(mockNavigate).toBeCalled();
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
test('test EnterPassword button failure', async () => {
|
|
120
|
-
const route = {
|
|
121
|
-
params: {
|
|
122
|
-
dataParams: {
|
|
123
|
-
unit_id: 1,
|
|
124
|
-
member: { id: 1 },
|
|
125
|
-
},
|
|
126
|
-
type: 'infoMemberUnit',
|
|
127
|
-
},
|
|
105
|
+
const responsePut = {
|
|
106
|
+
status: 200,
|
|
107
|
+
data: { id: 1, user_id: 1 },
|
|
128
108
|
};
|
|
109
|
+
await mockAxios(responsePut, 'put');
|
|
129
110
|
await act(async () => {
|
|
130
111
|
tree = await create(wrapComponent(route));
|
|
131
112
|
});
|
|
132
113
|
const instance = tree.root;
|
|
133
114
|
const button = buttonDone(instance);
|
|
134
|
-
mock.onPut(API.UNIT.CHANGE_OWNER(1)).reply(400);
|
|
135
115
|
await act(async () => {
|
|
136
116
|
await button[0].props.onPress();
|
|
137
117
|
});
|
|
138
|
-
expect(
|
|
118
|
+
expect(axios.put).toHaveBeenCalledTimes(1);
|
|
119
|
+
expect(axios.put).toHaveBeenCalledWith(API.UNIT.CHANGE_OWNER(1), {
|
|
120
|
+
confirm_password: '',
|
|
121
|
+
new_owner: 1,
|
|
122
|
+
});
|
|
139
123
|
});
|
|
140
124
|
});
|
|
@@ -92,7 +92,6 @@ const Explore = ({ navigation }) => {
|
|
|
92
92
|
horizontal={true}
|
|
93
93
|
contentContainerStyle={styles.locationContent}
|
|
94
94
|
showsHorizontalScrollIndicator={false}
|
|
95
|
-
scrollIndicatorInsets={{ right: 1 }}
|
|
96
95
|
>
|
|
97
96
|
{!!unitsNearMe &&
|
|
98
97
|
unitsNearMe.map((item) => (
|
|
@@ -135,7 +134,6 @@ const Explore = ({ navigation }) => {
|
|
|
135
134
|
onEndReachedThreshold={0.01}
|
|
136
135
|
onMomentumScrollBegin={() => setOnEndReached(false)}
|
|
137
136
|
onEndReached={handleEndReachUnitPublic}
|
|
138
|
-
scrollIndicatorInsets={{ right: 1 }}
|
|
139
137
|
/>
|
|
140
138
|
</Animated.View>
|
|
141
139
|
</SafeAreaView>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
3
|
import { create, act } from 'react-test-renderer';
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import axios from 'axios';
|
|
6
5
|
import { SCProvider } from '../../../context';
|
|
7
6
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
7
|
import GuestInfo from '..';
|
|
@@ -12,7 +11,6 @@ import WheelDateTimePicker from '../../../commons/WheelDateTimePicker';
|
|
|
12
11
|
import Text from '../../../commons/Text';
|
|
13
12
|
import { TESTID } from '../../../configs/Constants';
|
|
14
13
|
import { API } from '../../../configs';
|
|
15
|
-
import api from '../../../utils/Apis/axios';
|
|
16
14
|
|
|
17
15
|
const wrapComponent = (route) => (
|
|
18
16
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -37,7 +35,7 @@ jest.mock('@react-navigation/native', () => {
|
|
|
37
35
|
};
|
|
38
36
|
});
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
jest.mock('axios');
|
|
41
39
|
|
|
42
40
|
const getButton = (instance, testID, many = false) => {
|
|
43
41
|
if (many) {
|
|
@@ -56,6 +54,8 @@ describe('Test GuestInfo', () => {
|
|
|
56
54
|
let data;
|
|
57
55
|
|
|
58
56
|
beforeEach(() => {
|
|
57
|
+
axios.get.mockClear();
|
|
58
|
+
axios.put.mockClear();
|
|
59
59
|
mockGoBack.mockClear();
|
|
60
60
|
route = {
|
|
61
61
|
params: { id: 1 },
|
|
@@ -76,14 +76,23 @@ describe('Test GuestInfo', () => {
|
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
test('test render GuestInfo', async () => {
|
|
79
|
-
|
|
79
|
+
const response = {
|
|
80
|
+
status: 200,
|
|
81
|
+
data: data,
|
|
82
|
+
};
|
|
83
|
+
axios.get.mockImplementation(async () => {
|
|
84
|
+
return response;
|
|
85
|
+
});
|
|
80
86
|
await act(async () => {
|
|
81
87
|
tree = await create(wrapComponent(route));
|
|
82
88
|
});
|
|
83
89
|
const instance = tree.root;
|
|
90
|
+
|
|
91
|
+
expect(axios.get).toHaveBeenCalledWith(API.SHARED_SENSOR.ACCESS(1), {});
|
|
84
92
|
const texts = instance.findAllByType(Text);
|
|
85
93
|
expect(texts[4].props.children).toBe(data.user.id);
|
|
86
94
|
expect(texts[6].props.children).toBe('Always');
|
|
95
|
+
|
|
87
96
|
const accessScheduleItems = instance.findAllByType(AccessScheduleItem);
|
|
88
97
|
const radioButtons = getButton(
|
|
89
98
|
instance,
|
|
@@ -92,18 +101,21 @@ describe('Test GuestInfo', () => {
|
|
|
92
101
|
);
|
|
93
102
|
expect(accessScheduleItems).toHaveLength(3);
|
|
94
103
|
expect(radioButtons).toHaveLength(3);
|
|
104
|
+
|
|
95
105
|
const always = accessScheduleItems[0];
|
|
96
106
|
const recurring = accessScheduleItems[1];
|
|
97
107
|
const temporary = accessScheduleItems[2];
|
|
98
108
|
expect(always.props.isSelected).toBeTruthy();
|
|
99
109
|
expect(recurring.props.isSelected).toBeFalsy();
|
|
100
110
|
expect(temporary.props.isSelected).toBeFalsy();
|
|
111
|
+
|
|
101
112
|
await act(async () => {
|
|
102
113
|
await radioButtons[1].props.onPress();
|
|
103
114
|
});
|
|
104
115
|
expect(always.props.isSelected).toBeFalsy();
|
|
105
116
|
expect(recurring.props.isSelected).toBeTruthy();
|
|
106
117
|
expect(temporary.props.isSelected).toBeFalsy();
|
|
118
|
+
|
|
107
119
|
await act(async () => {
|
|
108
120
|
await radioButtons[2].props.onPress();
|
|
109
121
|
});
|
|
@@ -113,7 +125,13 @@ describe('Test GuestInfo', () => {
|
|
|
113
125
|
});
|
|
114
126
|
|
|
115
127
|
test('test open and close 2 modal', async () => {
|
|
116
|
-
|
|
128
|
+
const response = {
|
|
129
|
+
status: 200,
|
|
130
|
+
data: data,
|
|
131
|
+
};
|
|
132
|
+
axios.get.mockImplementation(async () => {
|
|
133
|
+
return response;
|
|
134
|
+
});
|
|
117
135
|
await act(async () => {
|
|
118
136
|
tree = await create(wrapComponent(route));
|
|
119
137
|
});
|
|
@@ -134,7 +152,7 @@ describe('Test GuestInfo', () => {
|
|
|
134
152
|
);
|
|
135
153
|
const dateTimePickerDone = getButton(
|
|
136
154
|
instance,
|
|
137
|
-
`${TESTID.
|
|
155
|
+
`${TESTID.WHEEL_DATE_TIME_PICKER}${TESTID.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
|
|
138
156
|
);
|
|
139
157
|
|
|
140
158
|
// show AccessScheduleSheet
|
|
@@ -179,7 +197,13 @@ describe('Test GuestInfo', () => {
|
|
|
179
197
|
|
|
180
198
|
test('test save', async () => {
|
|
181
199
|
data.access_schedule = 'recurring';
|
|
182
|
-
|
|
200
|
+
const response = {
|
|
201
|
+
status: 200,
|
|
202
|
+
data: data,
|
|
203
|
+
};
|
|
204
|
+
axios.get.mockImplementation(async () => {
|
|
205
|
+
return response;
|
|
206
|
+
});
|
|
183
207
|
await act(async () => {
|
|
184
208
|
tree = await create(wrapComponent(route));
|
|
185
209
|
});
|
|
@@ -189,14 +213,17 @@ describe('Test GuestInfo', () => {
|
|
|
189
213
|
el.props.testID === TESTID.SAVE_ACCESS_SCHEDULE &&
|
|
190
214
|
el.type === TouchableOpacity
|
|
191
215
|
);
|
|
192
|
-
|
|
216
|
+
axios.put.mockImplementation(async () => {
|
|
217
|
+
return { status: 200 };
|
|
218
|
+
});
|
|
193
219
|
await act(async () => {
|
|
194
220
|
await saveButton.props.onPress();
|
|
195
221
|
});
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
222
|
+
expect(axios.put).toHaveBeenCalledWith(API.SHARED_SENSOR.ACCESS(1), {
|
|
223
|
+
access_schedule: 'recurring',
|
|
224
|
+
recurring_time_start: '07:00:00',
|
|
225
|
+
recurring_time_end: '07:00:00',
|
|
226
|
+
recurring_time_repeat: [0, 1, 2],
|
|
227
|
+
});
|
|
201
228
|
});
|
|
202
229
|
});
|
|
@@ -30,7 +30,7 @@ const TemporaryDetail = ({
|
|
|
30
30
|
</Text>
|
|
31
31
|
<TouchableOpacity
|
|
32
32
|
onPress={onSetTimeStart}
|
|
33
|
-
testID={TESTID.
|
|
33
|
+
testID={TESTID.TEMPORARY_TEXT_BUTTON}
|
|
34
34
|
>
|
|
35
35
|
<Text type="Body" color={Colors.Orange} style={styles.value}>
|
|
36
36
|
{moment(temporaryTimeStart).format('hh:mm A DD/MM/YYYY')}
|
|
@@ -41,7 +41,7 @@ const TemporaryDetail = ({
|
|
|
41
41
|
</Text>
|
|
42
42
|
<TouchableOpacity
|
|
43
43
|
onPress={onSetTimeEnd}
|
|
44
|
-
testID={TESTID.
|
|
44
|
+
testID={TESTID.TEMPORARY_TEXT_BUTTON}
|
|
45
45
|
>
|
|
46
46
|
<Text type="Body" color={Colors.Orange} style={styles.value}>
|
|
47
47
|
{moment(temporaryTimeEnd).format('hh:mm A DD/MM/YYYY')}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
3
|
import { create, act } from 'react-test-renderer';
|
|
4
|
-
import
|
|
4
|
+
import axios from 'axios';
|
|
5
5
|
import { SCProvider } from '../../../context';
|
|
6
6
|
import { mockSCStore } from '../../../context/mockStore';
|
|
7
7
|
import HanetCaptureFaceID from '../CaptureFaceID';
|
|
8
8
|
import { RNCamera } from 'react-native-camera';
|
|
9
|
-
import api from '../../../utils/Apis/axios';
|
|
10
|
-
import { API } from '../../../configs';
|
|
11
|
-
|
|
12
|
-
const mock = new MockAdapter(api.axiosInstance);
|
|
13
9
|
|
|
14
10
|
const wrapComponent = (route) => (
|
|
15
11
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -36,6 +32,8 @@ jest.mock('@react-navigation/native', () => {
|
|
|
36
32
|
};
|
|
37
33
|
});
|
|
38
34
|
|
|
35
|
+
jest.mock('axios');
|
|
36
|
+
|
|
39
37
|
const mockSetAvatar = jest.fn();
|
|
40
38
|
describe('Test HanetCaptureFaceID', () => {
|
|
41
39
|
let tree, route;
|
|
@@ -44,6 +42,7 @@ describe('Test HanetCaptureFaceID', () => {
|
|
|
44
42
|
mockedNavigate.mockClear();
|
|
45
43
|
mockedGoBack.mockClear();
|
|
46
44
|
mockSetAvatar.mockClear();
|
|
45
|
+
axios.patch.mockClear();
|
|
47
46
|
route = {
|
|
48
47
|
params: {
|
|
49
48
|
title: 'title',
|
|
@@ -97,15 +96,20 @@ describe('Test HanetCaptureFaceID', () => {
|
|
|
97
96
|
|
|
98
97
|
// capture face id
|
|
99
98
|
await captureFaceID(instance);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
|
|
100
|
+
axios.patch.mockImplementationOnce(async () => ({
|
|
101
|
+
status: 200,
|
|
102
|
+
data: {
|
|
103
|
+
avatar_uri: 'avatar_uri',
|
|
104
|
+
},
|
|
105
|
+
}));
|
|
103
106
|
|
|
104
107
|
// continue
|
|
105
108
|
let touches = instance.findAllByType(TouchableOpacity);
|
|
106
109
|
await act(async () => {
|
|
107
110
|
await touches[1].props.onPress();
|
|
108
111
|
});
|
|
112
|
+
expect(axios.patch).toHaveBeenCalled();
|
|
109
113
|
expect(mockSetAvatar).toHaveBeenCalled();
|
|
110
114
|
expect(mockedGoBack).toHaveBeenCalled();
|
|
111
115
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FlatList } from 'react-native';
|
|
3
3
|
import { create, act } from 'react-test-renderer';
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import axios from 'axios';
|
|
6
5
|
import { SCProvider } from '../../../context';
|
|
7
6
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
7
|
import HanetCameraDetail from '../Detail';
|
|
@@ -10,9 +9,6 @@ import CheckinHeader from '../components/CheckinHeader';
|
|
|
10
9
|
import moment from 'moment';
|
|
11
10
|
import { TESTID } from '../../../configs/Constants';
|
|
12
11
|
import Calendar from '../../../commons/Calendar';
|
|
13
|
-
import api from '../../../utils/Apis/axios';
|
|
14
|
-
import { API } from '../../../configs';
|
|
15
|
-
import { MenuActionMore } from '../../../commons';
|
|
16
12
|
|
|
17
13
|
const wrapComponent = (route) => (
|
|
18
14
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -20,19 +16,6 @@ const wrapComponent = (route) => (
|
|
|
20
16
|
</SCProvider>
|
|
21
17
|
);
|
|
22
18
|
|
|
23
|
-
const mock = new MockAdapter(api.axiosInstance);
|
|
24
|
-
|
|
25
|
-
const mockNavigate = jest.fn();
|
|
26
|
-
jest.mock('@react-navigation/native', () => {
|
|
27
|
-
return {
|
|
28
|
-
...jest.requireActual('@react-navigation/native'),
|
|
29
|
-
useRoute: jest.fn(),
|
|
30
|
-
useNavigation: () => ({
|
|
31
|
-
navigate: mockNavigate,
|
|
32
|
-
}),
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
|
|
36
19
|
jest.mock('react', () => {
|
|
37
20
|
return {
|
|
38
21
|
...jest.requireActual('react'),
|
|
@@ -40,11 +23,14 @@ jest.mock('react', () => {
|
|
|
40
23
|
};
|
|
41
24
|
});
|
|
42
25
|
|
|
26
|
+
jest.mock('axios');
|
|
27
|
+
|
|
43
28
|
describe('Test HanetCameraDetail', () => {
|
|
44
29
|
Date.now = jest.fn(() => new Date('2021-09-09T10:00:00.000Z'));
|
|
45
30
|
let tree, route, responseDisplay, responseCheckin;
|
|
46
31
|
|
|
47
32
|
beforeEach(() => {
|
|
33
|
+
axios.get.mockClear();
|
|
48
34
|
route = {
|
|
49
35
|
params: {
|
|
50
36
|
unit: {
|
|
@@ -101,14 +87,20 @@ describe('Test HanetCameraDetail', () => {
|
|
|
101
87
|
});
|
|
102
88
|
|
|
103
89
|
test('Test render HanetCameraDetail', async () => {
|
|
104
|
-
|
|
105
|
-
|
|
90
|
+
axios.get.mockImplementationOnce(async () => {
|
|
91
|
+
return responseDisplay;
|
|
92
|
+
});
|
|
93
|
+
axios.get.mockImplementationOnce(async () => {
|
|
94
|
+
return responseCheckin;
|
|
95
|
+
});
|
|
106
96
|
await act(async () => {
|
|
107
97
|
tree = await create(wrapComponent(route));
|
|
108
98
|
});
|
|
109
99
|
const instance = tree.root;
|
|
100
|
+
expect(axios.get).toHaveBeenCalledTimes(2);
|
|
110
101
|
const flatLists = instance.findAllByType(FlatList);
|
|
111
102
|
expect(flatLists).toHaveLength(1);
|
|
103
|
+
|
|
112
104
|
const textCountMember = instance.find(
|
|
113
105
|
(el) => el.props.testID === TESTID.TEXT_COUNT_MEMBER
|
|
114
106
|
);
|
|
@@ -117,33 +109,50 @@ describe('Test HanetCameraDetail', () => {
|
|
|
117
109
|
);
|
|
118
110
|
expect(textCountMember.props.children).toBe(1);
|
|
119
111
|
expect(textCountStranger.props.children).toBe(1);
|
|
120
|
-
const MenuActionMores = instance.findByType(MenuActionMore);
|
|
121
|
-
await MenuActionMores.props.onItemClick({ data: 'test' });
|
|
122
|
-
expect(mockNavigate).toBeCalled();
|
|
123
112
|
});
|
|
124
113
|
|
|
125
114
|
test('Test change date', async () => {
|
|
126
|
-
|
|
127
|
-
|
|
115
|
+
axios.get.mockImplementationOnce(async () => {
|
|
116
|
+
return responseDisplay;
|
|
117
|
+
});
|
|
118
|
+
axios.get.mockImplementationOnce(async () => {
|
|
119
|
+
return responseCheckin;
|
|
120
|
+
});
|
|
128
121
|
await act(async () => {
|
|
129
122
|
tree = await create(wrapComponent(route));
|
|
130
123
|
});
|
|
131
124
|
const instance = tree.root;
|
|
125
|
+
expect(axios.get).toHaveBeenCalledTimes(2);
|
|
126
|
+
axios.get.mockClear();
|
|
127
|
+
|
|
132
128
|
const checkinHeader = instance.findByType(CheckinHeader);
|
|
129
|
+
|
|
133
130
|
// press arrow left
|
|
134
|
-
|
|
131
|
+
axios.get.mockImplementationOnce(async () => {
|
|
132
|
+
return responseCheckin;
|
|
133
|
+
});
|
|
135
134
|
await act(async () => {
|
|
136
135
|
await checkinHeader.props.onPickPreviousDate();
|
|
137
136
|
});
|
|
138
137
|
expect(checkinHeader.props.date.format('DD/MM/YYYY')).toBe(
|
|
139
138
|
moment().add(-1, 'days').format('DD/MM/YYYY')
|
|
140
139
|
);
|
|
140
|
+
expect(axios.get).toHaveBeenCalledTimes(1);
|
|
141
|
+
axios.get.mockClear();
|
|
142
|
+
|
|
143
|
+
// press arrow right
|
|
144
|
+
axios.get.mockImplementationOnce(async () => {
|
|
145
|
+
return responseCheckin;
|
|
146
|
+
});
|
|
141
147
|
await act(async () => {
|
|
142
148
|
await checkinHeader.props.onPickNextDate();
|
|
143
149
|
});
|
|
144
150
|
expect(checkinHeader.props.date.format('DD/MM/YYYY')).toBe(
|
|
145
151
|
moment().format('DD/MM/YYYY')
|
|
146
152
|
);
|
|
153
|
+
expect(axios.get).toHaveBeenCalledTimes(1);
|
|
154
|
+
axios.get.mockClear();
|
|
155
|
+
|
|
147
156
|
// press arrow right
|
|
148
157
|
await act(async () => {
|
|
149
158
|
await checkinHeader.props.onPickNextDate();
|
|
@@ -151,6 +160,9 @@ describe('Test HanetCameraDetail', () => {
|
|
|
151
160
|
expect(checkinHeader.props.date.format('DD/MM/YYYY')).toBe(
|
|
152
161
|
moment().format('DD/MM/YYYY')
|
|
153
162
|
); // no change
|
|
163
|
+
expect(axios.get).toHaveBeenCalledTimes(0);
|
|
164
|
+
axios.get.mockClear();
|
|
165
|
+
|
|
154
166
|
// open calendar
|
|
155
167
|
await act(async () => {
|
|
156
168
|
await checkinHeader.props.setShowCalendar();
|
|
@@ -159,12 +171,15 @@ describe('Test HanetCameraDetail', () => {
|
|
|
159
171
|
expect(calendar.props.isVisible).toBe(true);
|
|
160
172
|
|
|
161
173
|
// choose date on calendar
|
|
162
|
-
|
|
174
|
+
axios.get.mockImplementationOnce(async () => {
|
|
175
|
+
return responseCheckin;
|
|
176
|
+
});
|
|
163
177
|
await act(async () => {
|
|
164
178
|
await calendar.props.onConfirm(moment().add(-1, 'days'));
|
|
165
179
|
});
|
|
166
180
|
expect(checkinHeader.props.date.format('DD/MM/YYYY')).toBe(
|
|
167
181
|
moment().add(-1, 'days').format('DD/MM/YYYY')
|
|
168
182
|
);
|
|
183
|
+
expect(axios.get).toHaveBeenCalledTimes(1);
|
|
169
184
|
});
|
|
170
185
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FlatList } from 'react-native';
|
|
3
3
|
import { create, act } from 'react-test-renderer';
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import axios from 'axios';
|
|
6
5
|
import { SCProvider } from '../../../context';
|
|
7
6
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
7
|
import HanetManageAccess from '../ManageAccess';
|
|
@@ -10,10 +9,6 @@ import BottomSheet from '../../../commons/BottomSheet';
|
|
|
10
9
|
import { TESTID } from '../../../configs/Constants';
|
|
11
10
|
import Routes from '../../../utils/Route';
|
|
12
11
|
import ImagePicker from 'react-native-image-crop-picker';
|
|
13
|
-
import api from '../../../utils/Apis/axios';
|
|
14
|
-
import { API } from '../../../configs';
|
|
15
|
-
|
|
16
|
-
const mock = new MockAdapter(api.axiosInstance);
|
|
17
12
|
|
|
18
13
|
const wrapComponent = (route) => (
|
|
19
14
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -39,11 +34,14 @@ jest.mock('@react-navigation/native', () => {
|
|
|
39
34
|
};
|
|
40
35
|
});
|
|
41
36
|
|
|
37
|
+
jest.mock('axios');
|
|
38
|
+
|
|
42
39
|
describe('Test HanetManageAccess', () => {
|
|
43
40
|
let tree, route, response;
|
|
44
41
|
|
|
45
42
|
beforeEach(() => {
|
|
46
43
|
mockedNavigate.mockClear();
|
|
44
|
+
axios.get.mockClear();
|
|
47
45
|
route = {
|
|
48
46
|
params: {
|
|
49
47
|
hanetPlace: {
|
|
@@ -72,8 +70,7 @@ describe('Test HanetManageAccess', () => {
|
|
|
72
70
|
],
|
|
73
71
|
},
|
|
74
72
|
};
|
|
75
|
-
|
|
76
|
-
mock.onGet(API.CAMERA.HANET.PLACE_MEMBERS(1)).reply(200, response.data);
|
|
73
|
+
axios.get.mockImplementationOnce(async () => response);
|
|
77
74
|
await act(async () => {
|
|
78
75
|
tree = await create(wrapComponent(route));
|
|
79
76
|
});
|