@eohjsc/react-native-smart-city 0.2.99 → 0.3.2
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 +1 -1
- package/package.json +6 -4
- package/react-native-smart-city.podspec +1 -0
- package/src/commons/Action/ItemQuickAction.js +11 -2
- package/src/commons/Action/__test__/ItemQuickAction.test.js +11 -6
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +10 -5
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +31 -20
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +4 -0
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +1 -1
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/ItemPasscode.test.js +24 -0
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +14 -0
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +1 -1
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +3 -2
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +8 -4
- package/src/commons/ActionGroup/TimerActionTemplate.js +2 -2
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +0 -1
- package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +53 -4
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +45 -48
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +77 -0
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +58 -6
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +49 -1
- package/src/commons/ActionGroup/__test__/index.test.js +137 -2
- package/src/commons/Automate/ItemAutomate.js +1 -3
- package/src/commons/Calendar/__test__/Calendar.test.js +33 -0
- package/src/commons/Connecting/__test__/Connecting.test.js +19 -2
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +7 -3
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +8 -11
- package/src/commons/ConnectingProcess/__test__/Connecting.test.js +136 -3
- package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +3 -2
- package/src/commons/ConnectingProcess/index.js +72 -25
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +16 -13
- package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +1 -1
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +0 -5
- package/src/commons/Device/ConnectedViewHeader.js +1 -1
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +58 -0
- package/src/commons/Device/HistoryChart.js +3 -3
- package/src/commons/Device/ItemDevice.js +15 -11
- package/src/commons/Device/LinearChart.js +15 -0
- package/src/commons/Device/SonosSpeaker/index.js +1 -1
- package/src/commons/Explore/__test__/CityItem.test.js +33 -54
- package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +19 -14
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +0 -3
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +0 -3
- package/src/commons/FieldTemplate/ScheduleField/index.js +2 -2
- package/src/commons/Header/HeaderCustom.js +2 -1
- package/src/commons/HorizontalPicker/index.js +2 -2
- package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +0 -6
- package/src/commons/MediaPlayerDetail/index.js +24 -55
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +0 -1
- package/src/commons/SubUnit/Favorites/index.js +2 -3
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +8 -35
- package/src/commons/SubUnit/OneTap/index.js +1 -2
- package/src/commons/SubUnit/ShortDetail.js +25 -9
- package/src/commons/SubUnit/__test__/Item.test.js +0 -1
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +8 -1
- package/src/commons/Unit/SharedUnit.js +1 -0
- package/src/commons/Unit/__test__/SharedUnit.test.js +38 -183
- package/src/commons/UnitSummary/ConfigHistoryChart/index.js +2 -13
- package/src/commons/UnitSummary/ConfigHistoryChart.js +22 -13
- package/src/commons/WheelDateTimePicker/index.js +2 -2
- package/src/configs/API.js +85 -144
- package/src/configs/Constants.js +24 -0
- package/src/configs/SCConfig.js +2 -0
- package/src/context/actionType.ts +8 -0
- package/src/context/mockStore.ts +10 -0
- package/src/context/reducer.ts +38 -2
- package/src/hooks/Common/index.js +2 -0
- package/src/hooks/Common/useGGHomeDeviceConnected.js +16 -0
- package/src/hooks/Common/useGetIdUser.js +1 -5
- package/src/hooks/Common/useSensorsStatus.js +4 -4
- package/src/hooks/IoT/__test__/useGGHomeConnection.test.js +198 -0
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +198 -0
- package/src/hooks/IoT/index.js +4 -0
- package/src/hooks/IoT/useGGHomeConnection.js +91 -0
- package/src/hooks/IoT/useRemoteControl.js +79 -0
- package/src/hooks/index.js +4 -0
- package/src/hooks/useReceiveNotifications.js +9 -5
- package/src/iot/Monitor.js +3 -2
- package/src/iot/RemoteControl/Bluetooth.js +1 -1
- package/src/iot/RemoteControl/GoogleHome.js +75 -49
- package/src/iot/RemoteControl/Internet.js +1 -1
- package/src/iot/RemoteControl/__test__/GoogleHome.test.js +95 -48
- package/src/iot/RemoteControl/__test__/Internet.test.js +18 -7
- package/src/iot/RemoteControl/__test__/LgThinq.test.js +36 -177
- package/src/iot/RemoteControl/index.js +52 -52
- package/src/screens/ActivityLog/__test__/index.test.js +38 -23
- package/src/screens/ActivityLog/hooks/__test__/index.test.js +51 -90
- package/src/screens/ActivityLog/hooks/index.js +1 -1
- package/src/screens/ActivityLog/index.js +2 -2
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +13 -24
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +9 -33
- package/src/screens/AddLocationMaps/index.js +5 -4
- package/src/screens/AddNewAction/SelectAction.js +8 -8
- package/src/screens/AddNewAction/SetupSensor.js +7 -7
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +10 -91
- package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +40 -26
- package/src/screens/AddNewDevice/ConnectingDevices.js +3 -3
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +34 -33
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +0 -4
- package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +21 -21
- package/src/screens/AddNewDevice/hooks/ConnectDevices.js +1 -1
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +23 -17
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +3 -3
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +1 -0
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +4 -6
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +0 -4
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +5 -29
- package/src/screens/AddNewGateway/__test__/SelectGateway.test.js +0 -4
- package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +0 -4
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +9 -23
- package/src/screens/AllCamera/index.js +4 -4
- package/src/screens/Automate/MultiUnits.js +8 -8
- package/src/screens/Automate/__test__/MultiUnits.test.js +6 -9
- package/src/screens/Automate/__test__/index.test.js +7 -12
- package/src/screens/Automate/index.js +3 -3
- package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +36 -8
- package/src/screens/ConfirmUnitDeletion/index.js +7 -1
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +71 -22
- package/src/screens/Device/EditDevice/index.js +2 -2
- package/src/screens/Device/__test__/detail.test.js +32 -85
- package/src/screens/Device/components/DetailHistoryChart.js +1 -1
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +1 -0
- package/src/screens/Device/components/SensorDisplayItem.js +5 -2
- package/src/screens/Device/detail.js +53 -22
- package/src/screens/Device/hooks/useDisconnectedDevice.js +4 -4
- package/src/screens/Device/hooks/useFavoriteDevice.js +5 -9
- package/src/screens/DeviceInfo/__test__/index.test.js +0 -2
- package/src/screens/EditActionsList/index.js +1 -1
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +1 -1
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +7 -19
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +18 -14
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +30 -31
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +41 -25
- package/src/screens/GuestInfo/__test__/index.test.js +13 -40
- package/src/screens/HanetCamera/Detail.js +1 -1
- package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +8 -12
- package/src/screens/HanetCamera/__test__/Detail.test.js +27 -42
- package/src/screens/HanetCamera/__test__/ManageAccess.test.js +8 -5
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -32
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +3 -2
- package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +43 -35
- package/src/screens/HanetCamera/hooks/__test__/useHanetPlaceMembers.test.js +10 -21
- 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 +33 -22
- package/src/screens/ManageAccess/hooks/__test__/useManageAccess.test.js +44 -45
- package/src/screens/ManageAccess/hooks/index.js +7 -4
- package/src/screens/ManageAccess/index.js +1 -1
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +35 -12
- package/src/screens/MoveToAnotherSubUnit/index.js +5 -5
- package/src/screens/Notification/__test__/Notification.test.js +14 -25
- package/src/screens/Notification/__test__/NotificationItem.test.js +8 -7
- package/src/screens/Notification/components/NotificationItem.js +17 -20
- package/src/screens/Notification/index.js +9 -2
- package/src/screens/PlayBackCamera/Timer.js +2 -2
- package/src/screens/PlayBackCamera/__test__/index.test.js +87 -2
- package/src/screens/PlayBackCamera/index.js +22 -6
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +7 -20
- package/src/screens/ScanChipQR/hooks/index.js +15 -16
- package/src/screens/ScanSensorQR/__test__/ScanSensorQR.test.js +8 -24
- package/src/screens/ScriptDetail/__test__/index.test.js +17 -86
- package/src/screens/ScriptDetail/index.js +16 -11
- package/src/screens/SelectUnit/__test__/index.test.js +11 -54
- package/src/screens/SelectUnit/index.js +4 -2
- package/src/screens/SetSchedule/index.js +9 -9
- package/src/screens/SharedUnit/__test__/TabHeader.test.js +0 -2
- package/src/screens/Sharing/Components/SensorItem.js +10 -12
- package/src/screens/Sharing/InfoMemberUnit.js +1 -1
- package/src/screens/Sharing/SelectPermission.js +121 -76
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +47 -29
- package/src/screens/Sharing/__test__/MemberList.test.js +13 -127
- package/src/screens/Sharing/__test__/MemberList2.test.js +80 -0
- package/src/screens/Sharing/__test__/SelectPermission.test.js +28 -38
- package/src/screens/Sharing/__test__/SelectUser.test.js +17 -38
- package/src/screens/SideMenuDetail/__test__/index.test.js +12 -23
- package/src/screens/SideMenuDetail/index.js +2 -3
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +3 -2
- package/src/screens/SubUnit/Detail.js +1 -2
- package/src/screens/SubUnit/ManageSubUnit.js +12 -7
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +21 -67
- package/src/screens/SubUnit/__test__/Detail.test.js +31 -8
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +21 -89
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +27 -1
- package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +48 -45
- package/src/screens/SubUnit/hooks/useManageSubUnit.js +7 -7
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +14 -90
- package/src/screens/Unit/ChooseLocation.js +7 -14
- package/src/screens/Unit/Detail.js +30 -75
- package/src/screens/Unit/ManageUnit.js +1 -0
- package/src/screens/Unit/SelectAddress.js +34 -21
- package/src/screens/Unit/SmartAccount.js +4 -4
- package/src/screens/Unit/Summaries.js +17 -1
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +24 -29
- package/src/screens/Unit/__test__/ChooseLocation.test.js +27 -14
- package/src/screens/Unit/__test__/Detail.test.js +99 -200
- package/src/screens/Unit/__test__/ManageUnit.test.js +18 -42
- package/src/screens/Unit/__test__/SelectAddress.test.js +84 -51
- package/src/screens/Unit/__test__/SmartAccount.test.js +17 -9
- package/src/screens/Unit/__test__/SmartAccountItem.test.js +0 -1
- package/src/screens/Unit/__test__/Summaries.test.js +100 -0
- package/src/screens/Unit/components/MyAllUnit/__test__/MyAllUnit.test.js +36 -0
- package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +54 -0
- package/src/screens/Unit/components/SharedUnit/index.js +1 -0
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +31 -34
- package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +50 -0
- package/src/screens/Unit/styles.js +4 -0
- package/src/screens/UnitSummary/__test__/index.test.js +70 -41
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +31 -2
- package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/__test__/index.test.js +7 -4
- package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/index.js +2 -13
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/ItemPower.test.js +0 -1
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +14 -16
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +11 -2
- package/src/screens/UnitSummary/components/RunningDevices/index.js +7 -10
- package/src/screens/UnitSummary/components/Temperature/index.js +4 -4
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +10 -2
- package/src/screens/UnitSummary/index.js +15 -1
- package/src/utils/Apis/axios.js +46 -31
- package/src/utils/Converter/time.js +0 -18
- package/src/utils/I18n/translations/en.json +4 -1
- package/src/utils/I18n/translations/vi.json +5 -1
- package/src/utils/Permission/common.js +67 -0
- package/src/utils/Utils.js +11 -7
|
@@ -52,6 +52,21 @@ const chartOptions = {
|
|
|
52
52
|
format: '{value:%d.%m %H:%M}',
|
|
53
53
|
},
|
|
54
54
|
},
|
|
55
|
+
legend: {
|
|
56
|
+
useHTML: true,
|
|
57
|
+
labelFormatter: function () {
|
|
58
|
+
if (this.visible) {
|
|
59
|
+
return (
|
|
60
|
+
'<span style="color:#333333;font-weight:bold">' +
|
|
61
|
+
this.name +
|
|
62
|
+
'</span>'
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return (
|
|
66
|
+
'<span style="color:#cccccc;font-weight:bold">' + this.name + '</span>'
|
|
67
|
+
);
|
|
68
|
+
},
|
|
69
|
+
},
|
|
55
70
|
};
|
|
56
71
|
|
|
57
72
|
function LinearChart({ datas }) {
|
|
@@ -2,12 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
3
|
import CityItem from '../CityItem';
|
|
4
4
|
import { TouchableOpacity } from 'react-native';
|
|
5
|
-
import axios from 'axios';
|
|
6
5
|
import { API } from '../../../configs';
|
|
7
6
|
import Pin from '../../../../assets/images/Explore/Pin.svg';
|
|
8
7
|
import PinOutline from '../../../../assets/images/Explore/PinOutline.svg';
|
|
9
8
|
import { SCProvider } from '../../../context';
|
|
10
9
|
import { mockSCStore } from '../../../context/mockStore';
|
|
10
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
11
|
+
import api from '../../../utils/Apis/axios';
|
|
12
|
+
|
|
13
|
+
const mock = new MockAdapter(api.axiosInstance);
|
|
11
14
|
|
|
12
15
|
const mockedDispatch = jest.fn();
|
|
13
16
|
|
|
@@ -17,7 +20,6 @@ const wrapComponent = (item, mockeSelect) => (
|
|
|
17
20
|
</SCProvider>
|
|
18
21
|
);
|
|
19
22
|
|
|
20
|
-
jest.mock('axios');
|
|
21
23
|
jest.mock('react-redux', () => ({
|
|
22
24
|
...jest.requireActual('react-redux'),
|
|
23
25
|
useDispatch: () => mockedDispatch,
|
|
@@ -25,9 +27,6 @@ jest.mock('react-redux', () => ({
|
|
|
25
27
|
|
|
26
28
|
describe('Test CityItem', () => {
|
|
27
29
|
let tree;
|
|
28
|
-
afterEach(() => {
|
|
29
|
-
axios.post.mockClear();
|
|
30
|
-
});
|
|
31
30
|
|
|
32
31
|
test('render CityItem is_pin: true', async () => {
|
|
33
32
|
const item = {
|
|
@@ -38,37 +37,23 @@ describe('Test CityItem', () => {
|
|
|
38
37
|
count_pin: 1,
|
|
39
38
|
};
|
|
40
39
|
const mockeSelect = jest.fn();
|
|
41
|
-
|
|
42
|
-
status: 200,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
axios.post.mockImplementation(async () => {
|
|
46
|
-
return response;
|
|
47
|
-
});
|
|
40
|
+
mock.onPost(API.UNIT.PIN_UNIT()).reply(200);
|
|
48
41
|
await act(async () => {
|
|
49
42
|
tree = await renderer.create(wrapComponent(item, mockeSelect));
|
|
50
43
|
});
|
|
51
44
|
const instance = tree.root;
|
|
52
45
|
const buttons = instance.findAllByType(TouchableOpacity);
|
|
53
46
|
expect(buttons.length).toBe(2);
|
|
54
|
-
await
|
|
55
|
-
await buttons[0].props.onPress();
|
|
56
|
-
});
|
|
47
|
+
await buttons[0].props.onPress();
|
|
57
48
|
expect(mockeSelect).toHaveBeenCalledTimes(1);
|
|
58
|
-
|
|
59
49
|
const pin = instance.findAllByType(Pin);
|
|
60
50
|
expect(pin.length).toBe(2);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
64
|
-
expect(axios.post).toHaveBeenCalledWith(API.UNIT.UNPIN_UNIT(1));
|
|
65
|
-
|
|
51
|
+
mock.onPost(API.UNIT.PIN_UNIT()).reply(200);
|
|
52
|
+
await pin[1].props.onPress();
|
|
66
53
|
const unpin = instance.findAllByType(PinOutline);
|
|
54
|
+
mock.onPost(API.UNIT.UNPIN_UNIT(1)).reply(200);
|
|
55
|
+
await unpin[1].props.onPress();
|
|
67
56
|
expect(unpin.length).toBe(2);
|
|
68
|
-
await act(async () => {
|
|
69
|
-
await unpin[1].props.onPress();
|
|
70
|
-
});
|
|
71
|
-
expect(axios.post).toHaveBeenCalledWith(API.UNIT.UNPIN_UNIT(1));
|
|
72
57
|
});
|
|
73
58
|
|
|
74
59
|
test('render CityItem is_pin: false', async () => {
|
|
@@ -80,24 +65,33 @@ describe('Test CityItem', () => {
|
|
|
80
65
|
count_pin: 1,
|
|
81
66
|
};
|
|
82
67
|
const mockeSelect = jest.fn();
|
|
83
|
-
const response = {
|
|
84
|
-
status: 200,
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
axios.post.mockImplementation(async () => {
|
|
88
|
-
return response;
|
|
89
|
-
});
|
|
90
68
|
await act(async () => {
|
|
91
69
|
tree = await renderer.create(wrapComponent(item, mockeSelect));
|
|
92
70
|
});
|
|
93
71
|
const instance = tree.root;
|
|
94
|
-
|
|
95
72
|
const unpin = instance.findAllByType(PinOutline);
|
|
73
|
+
mock.onPost(API.UNIT.PIN_UNIT(1)).reply(200);
|
|
74
|
+
await unpin[1].props.onPress();
|
|
96
75
|
expect(unpin.length).toBe(2);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('render CityItem is_pin: false and call api false', async () => {
|
|
79
|
+
const item = {
|
|
80
|
+
id: 1,
|
|
81
|
+
name: 'name',
|
|
82
|
+
icon: 'icon',
|
|
83
|
+
is_pin: false,
|
|
84
|
+
count_pin: 1,
|
|
85
|
+
};
|
|
86
|
+
const mockeSelect = jest.fn();
|
|
97
87
|
await act(async () => {
|
|
98
|
-
await
|
|
88
|
+
tree = await renderer.create(wrapComponent(item, mockeSelect));
|
|
99
89
|
});
|
|
100
|
-
|
|
90
|
+
const instance = tree.root;
|
|
91
|
+
const unpin = instance.findAllByType(PinOutline);
|
|
92
|
+
mock.onPost(API.UNIT.PIN_UNIT(1)).reply(400);
|
|
93
|
+
await unpin[1].props.onPress();
|
|
94
|
+
expect(unpin.length).toBe(2);
|
|
101
95
|
});
|
|
102
96
|
|
|
103
97
|
test('render CityItem PinOutline axios.post response false', async () => {
|
|
@@ -109,22 +103,14 @@ describe('Test CityItem', () => {
|
|
|
109
103
|
count_pin: 1,
|
|
110
104
|
};
|
|
111
105
|
const mockeSelect = jest.fn();
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
axios.post.mockImplementation(async () => {
|
|
115
|
-
return response;
|
|
116
|
-
});
|
|
106
|
+
mock.onPost(API.UNIT.PIN_UNIT()).reply(200, {});
|
|
117
107
|
await act(async () => {
|
|
118
108
|
tree = await renderer.create(wrapComponent(item, mockeSelect));
|
|
119
109
|
});
|
|
120
110
|
const instance = tree.root;
|
|
121
|
-
|
|
122
111
|
const unpin = instance.findAllByType(PinOutline);
|
|
112
|
+
await unpin[1].props.onPress();
|
|
123
113
|
expect(unpin.length).toBe(2);
|
|
124
|
-
await act(async () => {
|
|
125
|
-
await unpin[1].props.onPress();
|
|
126
|
-
});
|
|
127
|
-
expect(axios.post).not.toHaveBeenCalledWith(API.UNIT.UNPIN_UNIT(1));
|
|
128
114
|
});
|
|
129
115
|
|
|
130
116
|
test('render CityItem Pin axios.post response false', async () => {
|
|
@@ -136,21 +122,14 @@ describe('Test CityItem', () => {
|
|
|
136
122
|
count_pin: 1,
|
|
137
123
|
};
|
|
138
124
|
const mockeSelect = jest.fn();
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
axios.post.mockImplementation(async () => {
|
|
142
|
-
return response;
|
|
143
|
-
});
|
|
125
|
+
mock.onPost(API.UNIT.UNPIN_UNIT(1)).reply(400, {});
|
|
144
126
|
await act(async () => {
|
|
145
127
|
tree = await renderer.create(wrapComponent(item, mockeSelect));
|
|
146
128
|
});
|
|
147
129
|
const instance = tree.root;
|
|
148
130
|
const pin = instance.findAllByType(Pin);
|
|
131
|
+
await pin[1].props.onPress();
|
|
149
132
|
expect(pin.length).toBe(2);
|
|
150
|
-
await act(async () => {
|
|
151
|
-
await pin[1].props.onPress();
|
|
152
|
-
});
|
|
153
|
-
expect(axios.post).toHaveBeenCalledWith(API.UNIT.UNPIN_UNIT(1));
|
|
154
133
|
});
|
|
155
134
|
|
|
156
135
|
test('render CityItem icon null', async () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
4
|
import { TESTID } from '../../../../configs/Constants';
|
|
5
5
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
@@ -7,8 +7,10 @@ import { SCProvider } from '../../../../context';
|
|
|
7
7
|
import ChooseUserField from '../index';
|
|
8
8
|
import { TouchableOpacity } from 'react-native';
|
|
9
9
|
import { ModalCustom } from '../../../Modal';
|
|
10
|
+
import api from '../../../../utils/Apis/axios';
|
|
11
|
+
import { API } from '../../../../configs';
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
const mock = new MockAdapter(api.axiosInstance);
|
|
12
14
|
|
|
13
15
|
const wrapComponent = (
|
|
14
16
|
unit = { id: 1 },
|
|
@@ -47,10 +49,6 @@ const wrapComponent = (
|
|
|
47
49
|
describe('Test ChooseUserField', () => {
|
|
48
50
|
let tree;
|
|
49
51
|
|
|
50
|
-
afterEach(() => {
|
|
51
|
-
axios.get.mockClear();
|
|
52
|
-
});
|
|
53
|
-
|
|
54
52
|
const onPressCancel = async (instance, popup) => {
|
|
55
53
|
const buttonCancel = instance.find(
|
|
56
54
|
(el) =>
|
|
@@ -79,14 +77,7 @@ describe('Test ChooseUserField', () => {
|
|
|
79
77
|
};
|
|
80
78
|
|
|
81
79
|
test('render ChooseUserField handleOnApply', async () => {
|
|
82
|
-
|
|
83
|
-
status: 200,
|
|
84
|
-
data: [{ id: 1, name: 'Ken' }],
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
axios.get.mockImplementation(() => {
|
|
88
|
-
return response_unit_members;
|
|
89
|
-
});
|
|
80
|
+
mock.onGet(API.SHARE.UNITS_MEMBERS(1)).reply(200, [{ id: 1, name: 'Ken' }]);
|
|
90
81
|
await act(async () => {
|
|
91
82
|
tree = create(wrapComponent());
|
|
92
83
|
});
|
|
@@ -110,4 +101,18 @@ describe('Test ChooseUserField', () => {
|
|
|
110
101
|
await onPressCancel(instance, popup);
|
|
111
102
|
await onPressApply(instance, popup);
|
|
112
103
|
});
|
|
104
|
+
|
|
105
|
+
test('fetch unit_members error', async () => {
|
|
106
|
+
mock.onGet(API.SHARE.UNITS_MEMBERS(1)).reply(new Error('Network Error'));
|
|
107
|
+
await act(async () => {
|
|
108
|
+
tree = create(wrapComponent());
|
|
109
|
+
});
|
|
110
|
+
const instance = tree.root;
|
|
111
|
+
const ChooseField = instance.findAll(
|
|
112
|
+
(item) =>
|
|
113
|
+
item.props.testID === TESTID.CHOOSE_ITEM &&
|
|
114
|
+
item.type === TouchableOpacity
|
|
115
|
+
);
|
|
116
|
+
expect(ChooseField).toHaveLength(0);
|
|
117
|
+
});
|
|
113
118
|
});
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import axios from 'axios';
|
|
3
2
|
import { act, create } from 'react-test-renderer';
|
|
4
3
|
import { TESTID } from '../../../../configs/Constants';
|
|
5
4
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
5
|
import { SCProvider } from '../../../../context';
|
|
7
6
|
import PasscodeField from '../index';
|
|
8
7
|
|
|
9
|
-
jest.mock('axios');
|
|
10
8
|
const mockSetState = jest.fn();
|
|
11
9
|
|
|
12
10
|
const wrapComponent = (
|
|
@@ -44,7 +42,6 @@ describe('Test PasscodeField', () => {
|
|
|
44
42
|
let tree;
|
|
45
43
|
|
|
46
44
|
afterEach(() => {
|
|
47
|
-
axios.get.mockClear();
|
|
48
45
|
mockSetState.mockClear();
|
|
49
46
|
});
|
|
50
47
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import axios from 'axios';
|
|
3
2
|
import { act, create } from 'react-test-renderer';
|
|
4
3
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
5
4
|
import { SCProvider } from '../../../../context';
|
|
@@ -7,7 +6,6 @@ import ScheduleField from '../index';
|
|
|
7
6
|
import { TESTID } from '../../../../configs/Constants';
|
|
8
7
|
import { TouchableOpacity } from 'react-native';
|
|
9
8
|
|
|
10
|
-
jest.mock('axios');
|
|
11
9
|
const mockSetState = jest.fn();
|
|
12
10
|
|
|
13
11
|
const wrapComponent = (
|
|
@@ -55,7 +53,6 @@ describe('Test ScheduleField', () => {
|
|
|
55
53
|
Date.now = jest.fn(() => new Date('2022-05-30T15:50:36+01:00'));
|
|
56
54
|
});
|
|
57
55
|
afterEach(() => {
|
|
58
|
-
axios.get.mockClear();
|
|
59
56
|
mockSetState.mockClear();
|
|
60
57
|
});
|
|
61
58
|
|
|
@@ -152,9 +152,9 @@ const ScheduleField = ({ dataItem, index, setDataForm, dataForm }) => {
|
|
|
152
152
|
<View style={styles.wrapper}>
|
|
153
153
|
<Text style={styles.textHeadLine}>{t('access_schedule')}</Text>
|
|
154
154
|
|
|
155
|
-
{listAccessSchedule.map((item,
|
|
155
|
+
{listAccessSchedule.map((item, i) => (
|
|
156
156
|
<AccessScheduleItem
|
|
157
|
-
key={
|
|
157
|
+
key={i}
|
|
158
158
|
item={item}
|
|
159
159
|
isSelected={item.value === accessSchedule}
|
|
160
160
|
onSelect={setAccessSchedule}
|
|
@@ -6,6 +6,7 @@ import { Icon } from '@ant-design/react-native';
|
|
|
6
6
|
import { useNavigation } from '@react-navigation/native';
|
|
7
7
|
import styles from './Styles/HeaderCustomStyles';
|
|
8
8
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
9
|
+
import { notImplemented } from '../../utils/Utils';
|
|
9
10
|
|
|
10
11
|
const HeaderCustom = ({
|
|
11
12
|
title = '',
|
|
@@ -33,7 +34,7 @@ const HeaderCustom = ({
|
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
const handleClose = useCallback(() => {
|
|
36
|
-
onClose ? onClose() :
|
|
37
|
+
onClose ? onClose() : notImplemented(t);
|
|
37
38
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
39
|
}, []);
|
|
39
40
|
|
|
@@ -76,8 +76,8 @@ const HorizontalPicker = ({
|
|
|
76
76
|
}, [maximum, minimum, time]);
|
|
77
77
|
|
|
78
78
|
useEffect(() => {
|
|
79
|
-
const scrollListener = scrollX.addListener(({ value }) => {
|
|
80
|
-
isCanChangeValue && onChangeValue && onChangeValue(
|
|
79
|
+
const scrollListener = scrollX.addListener(({ value: scrollValue }) => {
|
|
80
|
+
isCanChangeValue && onChangeValue && onChangeValue(scrollValue);
|
|
81
81
|
});
|
|
82
82
|
return () => scrollX.removeListener(scrollListener);
|
|
83
83
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -6,15 +6,7 @@ import React, {
|
|
|
6
6
|
useContext,
|
|
7
7
|
useMemo,
|
|
8
8
|
} from 'react';
|
|
9
|
-
import {
|
|
10
|
-
Image,
|
|
11
|
-
View,
|
|
12
|
-
StyleSheet,
|
|
13
|
-
Text,
|
|
14
|
-
TouchableOpacity,
|
|
15
|
-
Platform,
|
|
16
|
-
ActivityIndicator,
|
|
17
|
-
} from 'react-native';
|
|
9
|
+
import { Image, View, StyleSheet, Text, TouchableOpacity } from 'react-native';
|
|
18
10
|
import { VLCPlayer } from 'react-native-vlc-media-player';
|
|
19
11
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
20
12
|
|
|
@@ -43,18 +35,14 @@ const MediaPlayerDetail = ({
|
|
|
43
35
|
height,
|
|
44
36
|
}) => {
|
|
45
37
|
const { setAction } = useContext(SCContext);
|
|
46
|
-
const {
|
|
47
|
-
(state) => state.app
|
|
48
|
-
);
|
|
38
|
+
const { camera_opened } = useSCContextSelector((state) => state.app);
|
|
49
39
|
const t = useTranslations();
|
|
50
40
|
const [paused, setPaused] = useState(isPaused);
|
|
51
41
|
|
|
52
42
|
const onTapPause = useCallback(() => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
}, [id, isFirstOpenCamera, setAction]);
|
|
43
|
+
setPaused(false);
|
|
44
|
+
id && setAction(Action.CAMERA_STATUS_CHANGE, { id, status: true });
|
|
45
|
+
}, [id, setAction]);
|
|
58
46
|
|
|
59
47
|
const onTapGoDetail = useCallback(() => {
|
|
60
48
|
if (!paused) {
|
|
@@ -72,29 +60,29 @@ const MediaPlayerDetail = ({
|
|
|
72
60
|
}, []);
|
|
73
61
|
|
|
74
62
|
const getWidthHeight = useCallback(() => {
|
|
75
|
-
let
|
|
76
|
-
|
|
63
|
+
let newWidth = 0,
|
|
64
|
+
newHeight = 0;
|
|
77
65
|
switch (amount) {
|
|
78
66
|
case 1:
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
newWidth = Constants.width;
|
|
68
|
+
newHeight = 224;
|
|
81
69
|
break;
|
|
82
70
|
case 4:
|
|
83
|
-
|
|
84
|
-
|
|
71
|
+
newWidth = Constants.width / 1.5;
|
|
72
|
+
newHeight = 112;
|
|
85
73
|
break;
|
|
86
74
|
case 6:
|
|
87
|
-
|
|
88
|
-
|
|
75
|
+
newWidth = Constants.width / 3;
|
|
76
|
+
newHeight = 112;
|
|
89
77
|
break;
|
|
90
78
|
default:
|
|
91
|
-
|
|
92
|
-
|
|
79
|
+
newWidth = Constants.width - 28;
|
|
80
|
+
newHeight = 162;
|
|
93
81
|
break;
|
|
94
82
|
}
|
|
95
83
|
return {
|
|
96
|
-
width,
|
|
97
|
-
height,
|
|
84
|
+
width: newWidth,
|
|
85
|
+
height: newHeight,
|
|
98
86
|
};
|
|
99
87
|
}, [amount]);
|
|
100
88
|
|
|
@@ -103,9 +91,9 @@ const MediaPlayerDetail = ({
|
|
|
103
91
|
<VLCPlayer
|
|
104
92
|
autoAspectRatio={true}
|
|
105
93
|
videoAspectRatio={
|
|
106
|
-
|
|
107
|
-
? `${width}:${height}`
|
|
108
|
-
: `${
|
|
94
|
+
amount
|
|
95
|
+
? `${getWidthHeight().width}:${getWidthHeight().height}`
|
|
96
|
+
: `${width}:${height}`
|
|
109
97
|
}
|
|
110
98
|
source={{
|
|
111
99
|
initType: 2,
|
|
@@ -126,31 +114,20 @@ const MediaPlayerDetail = ({
|
|
|
126
114
|
styles.player,
|
|
127
115
|
style,
|
|
128
116
|
{
|
|
129
|
-
width:
|
|
130
|
-
height:
|
|
117
|
+
width: amount ? getWidthHeight().width : width,
|
|
118
|
+
height: amount ? getWidthHeight().height : height,
|
|
131
119
|
},
|
|
132
|
-
isFirstOpenCamera && styles.firstOpenCamera,
|
|
133
120
|
]}
|
|
134
121
|
isLive={true}
|
|
135
122
|
/>
|
|
136
123
|
);
|
|
137
124
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
|
-
}, [uri
|
|
125
|
+
}, [uri]);
|
|
139
126
|
|
|
140
127
|
useEffect(() => {
|
|
141
128
|
setPaused(isPaused);
|
|
142
129
|
}, [isPaused]);
|
|
143
130
|
|
|
144
|
-
useEffect(() => {
|
|
145
|
-
if (isFirstOpenCamera) {
|
|
146
|
-
const to = setTimeout(() => {
|
|
147
|
-
setAction(Action.IS_FIRST_OPEN_CAMERA, false);
|
|
148
|
-
clearTimeout(to);
|
|
149
|
-
}, 1000);
|
|
150
|
-
}
|
|
151
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
152
|
-
}, [isFirstOpenCamera]);
|
|
153
|
-
|
|
154
131
|
useEffect(() => {
|
|
155
132
|
if (id && !(camera_opened || []).some((item) => item === id)) {
|
|
156
133
|
setPaused(true);
|
|
@@ -161,14 +138,6 @@ const MediaPlayerDetail = ({
|
|
|
161
138
|
const source = !thumbnail || !thumbnail.uri ? Images.BgDevice : thumbnail;
|
|
162
139
|
return (
|
|
163
140
|
<View style={[styles.wrap, wrapStyles]}>
|
|
164
|
-
{isFirstOpenCamera && Platform.OS === 'ios' && (
|
|
165
|
-
<>
|
|
166
|
-
{renderCamera}
|
|
167
|
-
<View style={styles.loading}>
|
|
168
|
-
<ActivityIndicator size={'small'} color={Colors.Primary} />
|
|
169
|
-
</View>
|
|
170
|
-
</>
|
|
171
|
-
)}
|
|
172
141
|
<View style={[styles.loadingWrap]}>
|
|
173
142
|
<Text style={styles.loadingText}>{t('loading')}</Text>
|
|
174
143
|
</View>
|
|
@@ -194,7 +163,7 @@ const MediaPlayerDetail = ({
|
|
|
194
163
|
/>
|
|
195
164
|
</View>
|
|
196
165
|
) : (
|
|
197
|
-
|
|
166
|
+
renderCamera
|
|
198
167
|
)}
|
|
199
168
|
|
|
200
169
|
<View style={styles.buttonView}>
|
|
@@ -8,13 +8,13 @@ import ItemDevice from '../../Device/ItemDevice';
|
|
|
8
8
|
import ItemOneTap from '../OneTap/ItemOneTap';
|
|
9
9
|
import ItemAddNew from '../../Device/ItemAddNew';
|
|
10
10
|
import styles from './styles';
|
|
11
|
+
import { notImplemented } from '../../../utils/Utils';
|
|
11
12
|
|
|
12
13
|
const SubUnitFavorites = ({
|
|
13
14
|
isOwner,
|
|
14
15
|
unit,
|
|
15
16
|
favoriteDevices,
|
|
16
17
|
favoriteAutomates,
|
|
17
|
-
isGGHomeConnected,
|
|
18
18
|
wrapItemStyle,
|
|
19
19
|
}) => {
|
|
20
20
|
const t = useTranslations();
|
|
@@ -22,7 +22,7 @@ const SubUnitFavorites = ({
|
|
|
22
22
|
const { getStatus, serverDown } = useSensorsStatus(unit, favoriteDevices);
|
|
23
23
|
|
|
24
24
|
const handleOnAddNew = () => {
|
|
25
|
-
|
|
25
|
+
notImplemented(t);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
return (
|
|
@@ -42,7 +42,6 @@ const SubUnitFavorites = ({
|
|
|
42
42
|
sensor={sensor}
|
|
43
43
|
unit={unit}
|
|
44
44
|
station={sensor.station}
|
|
45
|
-
isGGHomeConnected={isGGHomeConnected}
|
|
46
45
|
serverDown={serverDown}
|
|
47
46
|
status={getStatus(sensor)}
|
|
48
47
|
wrapStyle={wrapItemStyle}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { TouchableOpacity } from 'react-native';
|
|
4
3
|
import Toast from 'react-native-toast-message';
|
|
5
4
|
import { act, create } from 'react-test-renderer';
|
|
5
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
6
|
+
|
|
6
7
|
import SubUnitAutomate from '..';
|
|
7
8
|
import { AUTOMATE_TYPE, TESTID } from '../../../../configs/Constants';
|
|
8
9
|
import { SCProvider } from '../../../../context';
|
|
9
10
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
10
11
|
import Routes from '../../../../utils/Route';
|
|
12
|
+
import api from '../../../../utils/Apis/axios';
|
|
13
|
+
import { API } from '../../../../configs';
|
|
14
|
+
|
|
15
|
+
const mock = new MockAdapter(api.axiosInstance);
|
|
11
16
|
|
|
12
17
|
const wrapComponent = (data) => (
|
|
13
18
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -32,8 +37,6 @@ jest.mock('@react-navigation/native', () => {
|
|
|
32
37
|
};
|
|
33
38
|
});
|
|
34
39
|
|
|
35
|
-
jest.mock('axios');
|
|
36
|
-
|
|
37
40
|
let tree;
|
|
38
41
|
let data = {
|
|
39
42
|
isOwner: true,
|
|
@@ -60,18 +63,9 @@ let data = {
|
|
|
60
63
|
|
|
61
64
|
describe('test Item', () => {
|
|
62
65
|
beforeEach(() => {
|
|
63
|
-
axios.post.mockClear();
|
|
64
66
|
mockedNavigate.mockClear();
|
|
65
67
|
});
|
|
66
68
|
test('render SubUnitAutomate isOwner and handleOnAddNew', async () => {
|
|
67
|
-
const response = {
|
|
68
|
-
status: 200,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
axios.post.mockImplementation(async () => {
|
|
72
|
-
return response;
|
|
73
|
-
});
|
|
74
|
-
|
|
75
69
|
await act(async () => {
|
|
76
70
|
tree = await create(wrapComponent(data));
|
|
77
71
|
});
|
|
@@ -114,6 +108,7 @@ describe('test Item', () => {
|
|
|
114
108
|
el.type === TouchableOpacity
|
|
115
109
|
);
|
|
116
110
|
expect(handleScriptAction).toHaveLength(1);
|
|
111
|
+
mock.onPost(API.AUTOMATE.ACTION_ONE_TAP(1)).reply(200);
|
|
117
112
|
await act(async () => {
|
|
118
113
|
await handleScriptAction[0].props.onPress();
|
|
119
114
|
});
|
|
@@ -127,14 +122,6 @@ describe('test Item', () => {
|
|
|
127
122
|
|
|
128
123
|
test('render SubUnitAutomate not is owner handleScriptAction fail', async () => {
|
|
129
124
|
data.isOwner = false;
|
|
130
|
-
const response = {
|
|
131
|
-
status: 400,
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
axios.post.mockImplementation(async () => {
|
|
135
|
-
return response;
|
|
136
|
-
});
|
|
137
|
-
|
|
138
125
|
await act(async () => {
|
|
139
126
|
tree = await create(wrapComponent(data));
|
|
140
127
|
});
|
|
@@ -145,6 +132,7 @@ describe('test Item', () => {
|
|
|
145
132
|
el.type === TouchableOpacity
|
|
146
133
|
);
|
|
147
134
|
expect(handleScriptAction).toHaveLength(1);
|
|
135
|
+
mock.onPost(API.AUTOMATE.ACTION_ONE_TAP(1)).reply(400);
|
|
148
136
|
await act(async () => {
|
|
149
137
|
await handleScriptAction[0].props.onPress();
|
|
150
138
|
});
|
|
@@ -181,14 +169,6 @@ describe('test Item', () => {
|
|
|
181
169
|
],
|
|
182
170
|
},
|
|
183
171
|
];
|
|
184
|
-
const response = {
|
|
185
|
-
status: 200,
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
axios.post.mockImplementation(async () => {
|
|
189
|
-
return response;
|
|
190
|
-
});
|
|
191
|
-
|
|
192
172
|
await act(async () => {
|
|
193
173
|
tree = await create(wrapComponent(data));
|
|
194
174
|
});
|
|
@@ -233,13 +213,6 @@ describe('test Item', () => {
|
|
|
233
213
|
],
|
|
234
214
|
},
|
|
235
215
|
];
|
|
236
|
-
const response = {
|
|
237
|
-
status: 200,
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
await axios.post.mockImplementation(async () => {
|
|
241
|
-
return response;
|
|
242
|
-
});
|
|
243
216
|
|
|
244
217
|
await act(async () => {
|
|
245
218
|
tree = await create(wrapComponent(data));
|
|
@@ -41,10 +41,9 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
|
|
|
41
41
|
setAutomates(listAutomate[indexAutomate]);
|
|
42
42
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
43
|
}, [listAutomate]);
|
|
44
|
-
|
|
45
44
|
return (
|
|
46
45
|
<Section style={styles.noShadow}>
|
|
47
|
-
<View style={styles.boxScenario}>
|
|
46
|
+
<View style={styles.boxScenario} testID={TESTID.VIEW_SUB_UNIT_AUTOMATE}>
|
|
48
47
|
{listAutomate.map((item, index) => (
|
|
49
48
|
<TouchableOpacity
|
|
50
49
|
style={
|