@eohjsc/react-native-smart-city 0.2.23 → 0.2.26
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/assets/images/OneTap@1x.svg +14 -0
- package/index.js +0 -2
- package/package.json +11 -3
- package/src/Images/Common/arrow-back.png +0 -0
- package/src/Images/Common/checked@2x.png +0 -0
- package/src/Images/Common/checked@3x.png +0 -0
- package/src/Images/Common/file.png +0 -0
- package/src/Images/Common/fullscreen.png +0 -0
- package/src/Images/Common/refresh.png +0 -0
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +1 -1
- package/src/commons/ActionGroup/OnOffTemplate/index.js +4 -4
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +1 -1
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -2
- package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +8 -13
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +26 -46
- package/src/commons/ActionGroup/__test__/ThreeButtonTemplate.test.js +11 -5
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +14 -8
- package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +17 -23
- package/src/commons/ActionGroup/__test__/__snapshots__/ThreeButtonTemplate.test.js.snap +241 -223
- package/src/commons/ActionGroup/__test__/index.test.js +39 -107
- package/src/commons/ActionTemplate/ActionTemplateStyles.js +14 -0
- package/src/commons/ActionTemplate/OnOffButtonAction.js +40 -0
- package/src/commons/ActionTemplate/OnOffButtonActionStyles.js +11 -0
- package/src/commons/ActionTemplate/OneButtonAction.js +26 -0
- package/src/commons/ActionTemplate/OneButtonActionStyles.js +11 -0
- package/src/commons/ActionTemplate/ThreeButtonAction.js +55 -0
- package/src/commons/ActionTemplate/ThreeButtonActionStyles.js +11 -0
- package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +34 -0
- package/src/commons/ActionTemplate/__test__/OneButtonAction.test.js +33 -0
- package/src/commons/ActionTemplate/__test__/ThreeButtonAction.test.js +35 -0
- package/src/commons/ActionTemplate/__test__/index.test.js +71 -0
- package/src/commons/ActionTemplate/index.js +69 -0
- package/src/commons/Automate/ItemAutomate.js +1 -31
- package/src/commons/Automate/ItemAutomateStyles.js +10 -7
- package/src/commons/Automate/ItemScriptAction.js +9 -5
- package/src/commons/Automate/ItemScriptActionStyles.js +4 -0
- package/src/commons/ChartLoading/__test__/ChartLoading.test.js +9 -7
- package/src/commons/Device/DeviceAlertStatus.js +3 -1
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +14 -6
- package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +10 -2
- package/src/commons/Device/FlatListItems.js +1 -1
- package/src/commons/Device/ItemAddNew/index.js +6 -1
- package/src/commons/Device/WindDirection/Compass/Compass.test.js +19 -11
- package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +9 -3
- package/src/commons/Device/WindSpeed/LinearChart/__test__/__snapshots__/LinearChart.test.js.snap +0 -81
- package/src/commons/Device/__test__/ConnectedViewHeader.test.js +16 -8
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +13 -6
- package/src/commons/Device/__test__/DisconnectedView.test.js +13 -5
- package/src/commons/Device/__test__/FlatListItems.test.js +9 -1
- package/src/commons/Device/__test__/FooterInfo.test.js +13 -4
- package/src/commons/Device/__test__/SensorConnectedStatus.test.js +9 -1
- package/src/commons/Device/__test__/__snapshots__/DisconnectedView.test.js.snap +20 -20
- package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +28 -0
- package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +9 -2
- package/src/commons/Explore/__test__/CityItem.test.js +13 -15
- package/src/commons/Explore/__test__/HeaderLabel.test.js +15 -9
- package/src/commons/Header/HeaderCustom.js +7 -1
- package/src/commons/Header/__test__/HeaderCT.test.js +12 -4
- package/src/commons/ImagePicker/__test__/ImagePicker.test.js +19 -13
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +14 -8
- package/src/commons/MediaPlayerDetail/index.js +2 -0
- package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +11 -20
- package/src/commons/Modal/ModalBottom.js +51 -0
- package/src/commons/Modal/Styles/ModalBottomStyles.js +35 -0
- package/src/commons/Modal/index.js +2 -1
- package/src/commons/SelectActionCard/SelectActionStyles.js +16 -0
- package/src/commons/SelectActionCard/index.js +30 -0
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +15 -9
- package/src/commons/Sharing/__test__/MemberList.test.js +17 -25
- package/src/commons/Sharing/__test__/StationDevicePermission.test.js +17 -12
- package/src/commons/Sharing/__test__/WrapHeaderScrollable.test.js +0 -9
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +20 -9
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +149 -0
- package/src/commons/SubUnit/OneTap/index.js +16 -6
- package/src/commons/SubUnit/ShortDetail.js +9 -5
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +14 -6
- package/src/commons/Today/__test__/Today.test.js +9 -1
- package/src/commons/Today/__test__/__snapshots__/Today.test.js.snap +1 -1
- package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +16 -17
- package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +15 -9
- package/src/configs/API.js +6 -1
- package/src/configs/Constants.js +42 -0
- package/src/context/SCContext.tsx +2 -26
- package/src/context/actionType.ts +11 -0
- package/src/context/mockStore.ts +49 -0
- package/src/context/reducer.ts +21 -0
- package/src/hooks/Common/__test__/useTranslations.test.js +23 -0
- package/src/hooks/Common/index.js +2 -0
- package/src/hooks/Common/useGetIdUser.js +9 -0
- package/src/iot/RemoteControl/__test__/Bluetooth.test.js +3 -6
- package/src/iot/RemoteControl/__test__/GoogleHome.test.js +3 -4
- package/src/iot/RemoteControl/__test__/Internet.test.js +1 -9
- package/src/iot/RemoteControl/__test__/LgThinq.test.js +7 -10
- package/src/navigations/UnitStack.js +14 -0
- package/src/screens/AQIGuide/__test__/AQIGuide.test.js +9 -1
- package/src/screens/AQIGuide/index.js +1 -1
- package/src/screens/ActivityLog/__test__/index.test.js +14 -39
- package/src/screens/AddCommon/SelectSubUnit.js +2 -2
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +61 -0
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +18 -10
- package/src/screens/AddNewAction/Device/__test__/index.test.js +42 -0
- package/src/screens/AddNewAction/SelectAction.js +152 -0
- package/src/screens/AddNewAction/SelectDevice.js +25 -11
- package/src/screens/AddNewAction/Styles/SelectActionStyles.js +24 -0
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +172 -0
- package/src/screens/AddNewAction/__test__/SelectDevice.test.js +191 -0
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +55 -0
- package/src/screens/AddNewAutoSmart/index.js +85 -0
- package/src/screens/AddNewAutoSmart/styles/AddNewAutoSmartStyles.js +36 -0
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +29 -14
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +19 -8
- package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +16 -7
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +35 -73
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +14 -5
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +20 -11
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +129 -0
- package/src/screens/AddNewOneTap/index.js +20 -7
- package/src/screens/AddNewScriptAction/AddNewScriptActionStyles.js +1 -0
- package/src/screens/AddNewScriptAction/index.js +21 -13
- package/src/screens/Device/__test__/detail.test.js +26 -19
- package/src/screens/Device/detail.js +5 -4
- package/src/screens/Device/hooks/useCountUp.js +4 -0
- package/src/screens/Device/styles.js +5 -1
- package/src/screens/DeviceInfo/__test__/index.test.js +12 -3
- package/src/screens/EditActionsList/Styles/indexStyles.js +11 -0
- package/src/screens/EditActionsList/index.js +83 -19
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +15 -19
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +19 -24
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +10 -25
- package/src/screens/ManageAccess/__test__/ManageAccess.test.js +13 -1
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +2 -11
- package/src/screens/ScriptDetail/Styles/indexStyles.js +4 -1
- package/src/screens/ScriptDetail/index.js +30 -28
- package/src/screens/SharedUnit/__test__/TabHeader.test.js +40 -0
- package/src/screens/Sharing/__test__/MemberList.test.js +17 -14
- package/src/screens/Sharing/__test__/SelectPermission.test.js +16 -8
- package/src/screens/Sharing/__test__/SelectUser.test.js +33 -16
- package/src/screens/SubUnit/Detail.js +3 -3
- package/src/screens/SubUnit/ManageSubUnit.js +8 -8
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +17 -12
- package/src/screens/SubUnit/__test__/Detail.test.js +11 -31
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +42 -32
- package/src/screens/TDSGuide/__test__/TDSGuide.test.js +9 -1
- package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +9 -1
- package/src/screens/Unit/Detail.js +33 -11
- package/src/screens/Unit/ManageUnit.js +1 -1
- package/src/screens/Unit/__test__/AddMenu.test.js +15 -15
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +19 -10
- package/src/screens/Unit/__test__/Detail.test.js +92 -33
- package/src/screens/Unit/__test__/ManageUnit.test.js +16 -23
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +11 -2
- package/src/screens/UnitSummary/__test__/index.test.js +12 -4
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +13 -3
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +16 -12
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +2 -2
- package/src/screens/UnitSummary/components/UvIndex/__test__/__snapshots__/index.test.js.snap +37 -37
- package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +14 -6
- package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +11 -5
- package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +13 -7
- package/src/screens/WaterQualityGuide/__test__/index.test.js +12 -12
- package/src/utils/I18n/translations/en.json +9 -2
- package/src/utils/I18n/translations/vi.json +10 -3
- package/src/utils/Route/index.js +3 -2
- package/assets/images/Event.svg +0 -9
- package/src/commons/ChartLoading/__test__/__snapshots__/ChartLoading.test.js.snap +0 -66
- package/src/commons/Device/HistoryChart/__test__/HistoryChart.test.js +0 -57
- package/src/commons/Device/HistoryChart/__test__/__snapshots__/HistoryChart.test.js.snap +0 -593
- package/src/commons/Explore/SearchBox/__test__/__snapshots__/SearchBox.test.js.snap +0 -59
- package/src/commons/Explore/__test__/HeaderExplore.test.js +0 -21
- package/src/commons/Header/__test__/Header.test.js +0 -24
- package/src/commons/MenuActionAddnew/__test__/__snapshots__/MenuActionAddNew.test.js.snap +0 -788
- package/src/commons/Sharing/__test__/__snapshots__/WrapHeaderScrollable.test.js.snap +0 -174
- package/src/commons/UnitSummary/AirQuality/__test__/__snapshots__/index.test.js.snap +0 -26679
- package/src/iot/RemoteControl/__test__/index.test.js +0 -102
- package/src/iot/__test__/Monitor.test.js +0 -119
- package/src/navigations/AddNewActionStack.js +0 -23
- package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactAddNew.test.js.snap +0 -1706
- package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactList.test.js.snap +0 -4276
- package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactsSelectContacts.test.js.snap +0 -2240
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +0 -359
- package/src/screens/Unit/MyAllUnit/__test__/__snapshots__/index.test.js.snap +0 -1001
- package/src/screens/Unit/MyAllUnit/__test__/index.test.js +0 -48
- package/src/screens/Unit/components/MyAllUnit/__test__/__snapshots__/index.test.js.snap +0 -1001
- package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +0 -48
- package/src/screens/Unit/components/__test__/MyUnit.test.js +0 -85
- package/src/screens/UnitSummary/components/WaterQuality/__test__/__snapshots__/index.test.js.snap +0 -1574
- package/src/screens/WaterQualityGuide/__test__/__snapshots__/index.test.js.snap +0 -3375
- package/src/utils/Converter/__test__/time.test.js +0 -128
- package/src/utils/I18n/index.test.js +0 -7
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import React, { memo, useCallback,
|
|
1
|
+
import React, { memo, useCallback, useContext } from 'react';
|
|
2
2
|
import { View, ScrollView, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useRoute, useNavigation } from '@react-navigation/native';
|
|
4
4
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import { SCContext } from '../../context';
|
|
7
|
+
import { Action } from '../../context/actionType';
|
|
8
|
+
import Routes from '../../utils/Route';
|
|
7
9
|
import { HeaderCustom } from '../../commons/Header';
|
|
8
10
|
import Text from '../../commons/Text';
|
|
9
11
|
import BottomButtonView from '../../commons/BottomButtonView';
|
|
@@ -19,21 +21,22 @@ const AddNewScriptAction = memo(() => {
|
|
|
19
21
|
const { params = {} } = useRoute();
|
|
20
22
|
const { navigate } = useNavigation();
|
|
21
23
|
// eslint-disable-next-line no-unused-vars
|
|
22
|
-
const {
|
|
24
|
+
const { type, name, unit } = params;
|
|
23
25
|
|
|
24
26
|
// eslint-disable-next-line no-unused-vars
|
|
25
|
-
const
|
|
27
|
+
const { stateData, setAction } = useContext(SCContext);
|
|
26
28
|
|
|
27
29
|
const handleOnEdit = useCallback(() => {
|
|
28
30
|
alert(t('feature_under_development'));
|
|
29
31
|
}, [t]);
|
|
30
32
|
|
|
31
33
|
const handleOnAddNew = useCallback(() => {
|
|
32
|
-
navigate(
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
navigate(Routes.SelectDevice, {
|
|
35
|
+
automateId: null,
|
|
36
|
+
unit,
|
|
37
|
+
scriptName: name,
|
|
35
38
|
});
|
|
36
|
-
}, [navigate]);
|
|
39
|
+
}, [navigate, name, unit]);
|
|
37
40
|
|
|
38
41
|
const handleOnDone = useCallback(() => {
|
|
39
42
|
alert(t('feature_under_development'));
|
|
@@ -43,9 +46,13 @@ const AddNewScriptAction = memo(() => {
|
|
|
43
46
|
alert(t('feature_under_development'));
|
|
44
47
|
}, [t]);
|
|
45
48
|
|
|
49
|
+
const handleGoBack = useCallback(() => {
|
|
50
|
+
setAction(Action.LIST_ACTION, {});
|
|
51
|
+
}, [setAction]);
|
|
52
|
+
|
|
46
53
|
return (
|
|
47
54
|
<View style={styles.wrap}>
|
|
48
|
-
<HeaderCustom isShowClose />
|
|
55
|
+
<HeaderCustom isShowClose onGoBack={handleGoBack} />
|
|
49
56
|
<ScrollView scrollEnabled={true} contentContainerStyle={styles.container}>
|
|
50
57
|
<Text type="H2" bold style={styles.title}>
|
|
51
58
|
{name}
|
|
@@ -56,8 +63,9 @@ const AddNewScriptAction = memo(() => {
|
|
|
56
63
|
{t('how_to_start')}
|
|
57
64
|
</Text>
|
|
58
65
|
</View>
|
|
59
|
-
<
|
|
60
|
-
|
|
66
|
+
<View style={styles.automate}>
|
|
67
|
+
<ItemAutomate type={type} />
|
|
68
|
+
</View>
|
|
61
69
|
<View style={styles.row}>
|
|
62
70
|
<Text type="H3" bold>
|
|
63
71
|
{t('actions_list')}
|
|
@@ -68,11 +76,11 @@ const AddNewScriptAction = memo(() => {
|
|
|
68
76
|
</Text>
|
|
69
77
|
</TouchableOpacity>
|
|
70
78
|
</View>
|
|
71
|
-
{
|
|
79
|
+
{stateData?.listAction.map((item, index) => (
|
|
72
80
|
<ItemScriptAction order={index + 1} item={item} key={index} />
|
|
73
81
|
))}
|
|
74
82
|
<ItemAddNewScriptAction
|
|
75
|
-
order={
|
|
83
|
+
order={stateData?.listAction.length + 1}
|
|
76
84
|
title={t('add_new')}
|
|
77
85
|
onAddNew={handleOnAddNew}
|
|
78
86
|
/>
|
|
@@ -7,13 +7,15 @@ import { API } from '../../../configs';
|
|
|
7
7
|
import { AlertSendConfirm } from '../../../commons/EmergencyButton/AlertSendConfirm';
|
|
8
8
|
import { AlertSent } from '../../../commons/EmergencyButton/AlertSent';
|
|
9
9
|
import { AlertAction, ButtonPopup, MenuActionMore } from '../../../commons';
|
|
10
|
-
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
11
10
|
import { TESTID } from '../../../configs/Constants';
|
|
12
11
|
import Text from '../../../commons/Text';
|
|
13
12
|
import { IconFill } from '@ant-design/icons-react-native';
|
|
14
13
|
// import CurrentRainSensor from 'components/Device/RainningSensor/CurrentRainSensor';
|
|
15
14
|
import CurrentRainSensor from '../../../commons/Device/RainningSensor/CurrentRainSensor';
|
|
16
15
|
import { ConnectedViewHeader } from '../../../commons/Device';
|
|
16
|
+
import { getTranslate } from '../../../utils/I18n';
|
|
17
|
+
import { SCProvider } from '../../../context';
|
|
18
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
17
19
|
|
|
18
20
|
const mockedNavigate = jest.fn();
|
|
19
21
|
const mockedDispatch = jest.fn();
|
|
@@ -66,8 +68,13 @@ const mockAxios = (
|
|
|
66
68
|
});
|
|
67
69
|
};
|
|
68
70
|
|
|
71
|
+
const wrapComponent = (account, route) => (
|
|
72
|
+
<SCProvider initState={mockSCStore({})}>
|
|
73
|
+
<DeviceDetail account={account} route={route} />
|
|
74
|
+
</SCProvider>
|
|
75
|
+
);
|
|
76
|
+
|
|
69
77
|
describe('test DeviceDetail', () => {
|
|
70
|
-
const t = useTranslations();
|
|
71
78
|
let tree;
|
|
72
79
|
let route;
|
|
73
80
|
let account;
|
|
@@ -206,7 +213,7 @@ describe('test DeviceDetail', () => {
|
|
|
206
213
|
mockAxios(responseDisplay, responseDisplayValueV2, responseRemoteControl);
|
|
207
214
|
|
|
208
215
|
await act(async () => {
|
|
209
|
-
tree = await create(
|
|
216
|
+
tree = await create(wrapComponent(account, route));
|
|
210
217
|
});
|
|
211
218
|
const instance = tree.root;
|
|
212
219
|
expect(axios.get).toHaveBeenCalledTimes(4);
|
|
@@ -266,7 +273,7 @@ describe('test DeviceDetail', () => {
|
|
|
266
273
|
|
|
267
274
|
test('AlertSendConfirm onSendNowAlert', async () => {
|
|
268
275
|
await act(async () => {
|
|
269
|
-
tree = await create(
|
|
276
|
+
tree = await create(wrapComponent(account, route));
|
|
270
277
|
});
|
|
271
278
|
const instance = tree.root;
|
|
272
279
|
const alertSendConfirm = instance.findByType(AlertSendConfirm);
|
|
@@ -301,7 +308,7 @@ describe('test DeviceDetail', () => {
|
|
|
301
308
|
|
|
302
309
|
test('ButtonPopup onClick', async () => {
|
|
303
310
|
await act(async () => {
|
|
304
|
-
tree = await create(
|
|
311
|
+
tree = await create(wrapComponent(account, route));
|
|
305
312
|
});
|
|
306
313
|
const instance = tree.root;
|
|
307
314
|
const buttonPopup = instance.find(
|
|
@@ -328,7 +335,7 @@ describe('test DeviceDetail', () => {
|
|
|
328
335
|
await jest.runOnlyPendingTimers();
|
|
329
336
|
});
|
|
330
337
|
expect(buttonPopup.props.visible).toEqual(true);
|
|
331
|
-
expect(buttonPopup.props.mainTitle).toEqual(
|
|
338
|
+
expect(buttonPopup.props.mainTitle).toEqual(getTranslate('en', 'ok'));
|
|
332
339
|
await act(async () => {
|
|
333
340
|
await buttonPopup.props.onPressMain();
|
|
334
341
|
await buttonPopup.props.onClose();
|
|
@@ -338,7 +345,7 @@ describe('test DeviceDetail', () => {
|
|
|
338
345
|
|
|
339
346
|
test('ButtonPopup render', async () => {
|
|
340
347
|
await act(async () => {
|
|
341
|
-
tree = await create(
|
|
348
|
+
tree = await create(wrapComponent(account, route));
|
|
342
349
|
});
|
|
343
350
|
const instance = tree.root;
|
|
344
351
|
const buttonPopupTitle = instance.find(
|
|
@@ -361,7 +368,7 @@ describe('test DeviceDetail', () => {
|
|
|
361
368
|
|
|
362
369
|
test('ScrollView onRefresh', async () => {
|
|
363
370
|
await act(async () => {
|
|
364
|
-
tree = await create(
|
|
371
|
+
tree = await create(wrapComponent(account, route));
|
|
365
372
|
});
|
|
366
373
|
const instance = tree.root;
|
|
367
374
|
const scrollView = instance.findByType(ScrollView);
|
|
@@ -370,7 +377,7 @@ describe('test DeviceDetail', () => {
|
|
|
370
377
|
await act(async () => {
|
|
371
378
|
refreshControl.props.onRefresh();
|
|
372
379
|
});
|
|
373
|
-
expect(axios.get).toHaveBeenCalledTimes(
|
|
380
|
+
expect(axios.get).toHaveBeenCalledTimes(7);
|
|
374
381
|
});
|
|
375
382
|
|
|
376
383
|
test('Should render SensorDisplayItem', async () => {
|
|
@@ -501,14 +508,14 @@ describe('test DeviceDetail', () => {
|
|
|
501
508
|
mockAxios(responseDisplay, responseDisplayValueV2);
|
|
502
509
|
|
|
503
510
|
await act(async () => {
|
|
504
|
-
tree = await create(
|
|
511
|
+
tree = await create(wrapComponent(account, route));
|
|
505
512
|
});
|
|
506
513
|
|
|
507
514
|
const instance = tree.root;
|
|
508
515
|
const sensorDisplayItem = instance.findAll(
|
|
509
516
|
(el) => el.props.testID === TESTID.SENSOR_DISPLAY_ITEM
|
|
510
517
|
);
|
|
511
|
-
expect(sensorDisplayItem).toHaveLength(
|
|
518
|
+
expect(sensorDisplayItem).toHaveLength(4);
|
|
512
519
|
});
|
|
513
520
|
|
|
514
521
|
test('render CurrentRainSensor', async () => {
|
|
@@ -549,24 +556,24 @@ describe('test DeviceDetail', () => {
|
|
|
549
556
|
mockAxios(responseDisplay, responseDisplayValueV2);
|
|
550
557
|
|
|
551
558
|
await act(async () => {
|
|
552
|
-
tree = await create(
|
|
559
|
+
tree = await create(wrapComponent(account, route));
|
|
553
560
|
});
|
|
554
561
|
|
|
555
562
|
const instance = tree.root;
|
|
556
563
|
const sensorDisplayItem = instance.findAll(
|
|
557
564
|
(el) => el.props.testID === TESTID.SENSOR_DISPLAY_ITEM
|
|
558
565
|
);
|
|
559
|
-
expect(sensorDisplayItem).toHaveLength(
|
|
566
|
+
expect(sensorDisplayItem).toHaveLength(1);
|
|
560
567
|
|
|
561
568
|
const currentRainSensor = instance.findAllByType(CurrentRainSensor);
|
|
562
|
-
expect(currentRainSensor).toHaveLength(
|
|
569
|
+
expect(currentRainSensor).toHaveLength(1); // not crash app
|
|
563
570
|
});
|
|
564
571
|
|
|
565
572
|
test('not fetch value if not managed by backend', async () => {
|
|
566
573
|
route.params.sensor.is_managed_by_backend = false;
|
|
567
574
|
|
|
568
575
|
await act(async () => {
|
|
569
|
-
tree = await create(
|
|
576
|
+
tree = await create(wrapComponent(account, route));
|
|
570
577
|
});
|
|
571
578
|
|
|
572
579
|
expect(axios.get).not.toBeCalledWith(API.SENSOR.DISPLAY_VALUES_V2(1));
|
|
@@ -613,7 +620,7 @@ describe('test DeviceDetail', () => {
|
|
|
613
620
|
mockAxios(responseDisplay, responseDisplayValueV2);
|
|
614
621
|
|
|
615
622
|
await act(async () => {
|
|
616
|
-
tree = await create(
|
|
623
|
+
tree = await create(wrapComponent(account, route));
|
|
617
624
|
});
|
|
618
625
|
|
|
619
626
|
const instance = tree.root;
|
|
@@ -627,7 +634,7 @@ describe('test DeviceDetail', () => {
|
|
|
627
634
|
|
|
628
635
|
test('HeaderDevice button more onClick', async () => {
|
|
629
636
|
await act(async () => {
|
|
630
|
-
tree = await create(
|
|
637
|
+
tree = await create(wrapComponent(account, route));
|
|
631
638
|
});
|
|
632
639
|
const instance = tree.root;
|
|
633
640
|
const menu = instance.findByType(MenuActionMore);
|
|
@@ -649,7 +656,7 @@ describe('test DeviceDetail', () => {
|
|
|
649
656
|
sensor.is_favourite = false;
|
|
650
657
|
|
|
651
658
|
await act(async () => {
|
|
652
|
-
tree = await create(
|
|
659
|
+
tree = await create(wrapComponent(account, route));
|
|
653
660
|
});
|
|
654
661
|
const instance = tree.root;
|
|
655
662
|
|
|
@@ -678,7 +685,7 @@ describe('test DeviceDetail', () => {
|
|
|
678
685
|
sensor.is_favourite = true;
|
|
679
686
|
|
|
680
687
|
await act(async () => {
|
|
681
|
-
tree = await create(
|
|
688
|
+
tree = await create(wrapComponent(account, route));
|
|
682
689
|
});
|
|
683
690
|
const instance = tree.root;
|
|
684
691
|
|
|
@@ -107,7 +107,7 @@ const DeviceDetail = ({ account, route }) => {
|
|
|
107
107
|
);
|
|
108
108
|
|
|
109
109
|
const listMenuItem = useMemo(() => {
|
|
110
|
-
const menuItems = [];
|
|
110
|
+
const menuItems = [...listMenuItemDefault];
|
|
111
111
|
if (
|
|
112
112
|
display.items.some((i) => getActionComponent(i.configuration.template))
|
|
113
113
|
) {
|
|
@@ -132,17 +132,17 @@ const DeviceDetail = ({ account, route }) => {
|
|
|
132
132
|
},
|
|
133
133
|
});
|
|
134
134
|
if (!isFavourite) {
|
|
135
|
-
menuItems.
|
|
135
|
+
menuItems.unshift({
|
|
136
136
|
doAction: addToFavorites,
|
|
137
137
|
text: t('add_to_favorites'),
|
|
138
138
|
});
|
|
139
139
|
} else {
|
|
140
|
-
menuItems.
|
|
140
|
+
menuItems.unshift({
|
|
141
141
|
doAction: removeFromFavorites,
|
|
142
142
|
text: t('remove_from_favorites'),
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
-
return [...
|
|
145
|
+
return [...menuItems];
|
|
146
146
|
}, [
|
|
147
147
|
display.items,
|
|
148
148
|
t,
|
|
@@ -567,6 +567,7 @@ const DeviceDetail = ({ account, route }) => {
|
|
|
567
567
|
childRef={childRef}
|
|
568
568
|
onItemClick={onItemMenuClicked}
|
|
569
569
|
wrapStyle={styles.menuAction}
|
|
570
|
+
isTextCenter={false}
|
|
570
571
|
/>
|
|
571
572
|
</View>
|
|
572
573
|
);
|
|
@@ -16,6 +16,10 @@ export const useCountUp = (eventTime) => {
|
|
|
16
16
|
};
|
|
17
17
|
}, [eventTime]);
|
|
18
18
|
|
|
19
|
+
if (!eventTime) {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
const diffSeconds = currentTime.diff(eventTime, 'seconds');
|
|
20
24
|
const seconds = diffSeconds > 0 ? diffSeconds % 60 : 0;
|
|
21
25
|
const minutes = parseInt(diffSeconds / 60, 10) % 60;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
1
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
2
2
|
import { Colors, Device } from '../../configs';
|
|
3
3
|
import { standardizeCameraScreenSize } from '../../utils/Utils';
|
|
4
4
|
|
|
@@ -67,6 +67,10 @@ export default StyleSheet.create({
|
|
|
67
67
|
borderRadius: 10,
|
|
68
68
|
borderBottomRightRadius: 10,
|
|
69
69
|
borderBottomLeftRadius: 10,
|
|
70
|
+
marginTop: Platform.select({
|
|
71
|
+
ios: 0,
|
|
72
|
+
android: -25,
|
|
73
|
+
}),
|
|
70
74
|
},
|
|
71
75
|
wrapTemplate: {
|
|
72
76
|
marginBottom: 20,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { create } from 'react-test-renderer';
|
|
3
3
|
import { act } from '@testing-library/react-hooks';
|
|
4
|
-
import { TESTID } from 'configs/Constants';
|
|
4
|
+
import { TESTID } from '../../../configs/Constants';
|
|
5
5
|
import DeviceInfo from '../';
|
|
6
6
|
import { View } from 'react-native';
|
|
7
|
+
import { SCProvider } from '../../../context';
|
|
8
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
7
9
|
|
|
8
10
|
jest.mock('axios');
|
|
9
11
|
|
|
@@ -32,12 +34,19 @@ jest.mock('@react-navigation/core', () => {
|
|
|
32
34
|
}),
|
|
33
35
|
};
|
|
34
36
|
});
|
|
37
|
+
|
|
38
|
+
const wrapComponent = () => (
|
|
39
|
+
<SCProvider initState={mockSCStore({})}>
|
|
40
|
+
<DeviceInfo />
|
|
41
|
+
</SCProvider>
|
|
42
|
+
);
|
|
43
|
+
|
|
35
44
|
describe('Test DeviceInfo', () => {
|
|
36
45
|
let tree;
|
|
37
46
|
|
|
38
47
|
it('render DeviceInfo', async () => {
|
|
39
48
|
await act(async () => {
|
|
40
|
-
tree = await create(
|
|
49
|
+
tree = await create(wrapComponent());
|
|
41
50
|
});
|
|
42
51
|
const instance = tree.root;
|
|
43
52
|
const battety = instance.findAll(
|
|
@@ -55,6 +64,6 @@ describe('Test DeviceInfo', () => {
|
|
|
55
64
|
(el) =>
|
|
56
65
|
el.props.testID === TESTID.DEVICE_INFO_CHIP_INFO && el.type === View
|
|
57
66
|
);
|
|
58
|
-
expect(chip.length).toEqual(
|
|
67
|
+
expect(chip.length).toEqual(5);
|
|
59
68
|
});
|
|
60
69
|
});
|
|
@@ -70,4 +70,15 @@ export default StyleSheet.create({
|
|
|
70
70
|
alignItems: 'center',
|
|
71
71
|
marginRight: -10,
|
|
72
72
|
},
|
|
73
|
+
wrapChildModal: {
|
|
74
|
+
padding: 16,
|
|
75
|
+
},
|
|
76
|
+
messageDelete: {
|
|
77
|
+
fontSize: 16,
|
|
78
|
+
lineHeight: 24,
|
|
79
|
+
color: Colors.Gray9,
|
|
80
|
+
},
|
|
81
|
+
textHighlight: {
|
|
82
|
+
fontWeight: 'bold',
|
|
83
|
+
},
|
|
73
84
|
});
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react';
|
|
2
2
|
import { View, TouchableOpacity } from 'react-native';
|
|
3
3
|
import DraggableFlatList from 'react-native-draggable-flatlist';
|
|
4
|
-
import { useRoute } from '@react-navigation/core';
|
|
4
|
+
import { useNavigation, useRoute } from '@react-navigation/core';
|
|
5
|
+
import ParsedText from 'react-native-parsed-text';
|
|
5
6
|
|
|
6
7
|
import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
|
|
7
8
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
8
9
|
import Text from '../../commons/Text';
|
|
9
10
|
import styles from './Styles/indexStyles';
|
|
10
|
-
import { Colors } from '../../configs';
|
|
11
|
+
import { API, Colors } from '../../configs';
|
|
11
12
|
import FImage from '../../commons/FImage';
|
|
12
13
|
import Rearrange from '../../../assets/images/Rearrange.svg';
|
|
13
14
|
import Close from '../../../assets/images/Close.svg';
|
|
15
|
+
import { axiosDelete, axiosPut } from '../../utils/Apis/axios';
|
|
16
|
+
import { ModalBottom } from '../../commons/Modal';
|
|
17
|
+
import { ToastBottomHelper } from '../../utils/Utils';
|
|
14
18
|
|
|
15
19
|
const EditActionsList = () => {
|
|
16
20
|
const t = useTranslations();
|
|
21
|
+
const { goBack } = useNavigation();
|
|
17
22
|
const { params = {} } = useRoute();
|
|
18
|
-
const { data = [] } = params;
|
|
23
|
+
const { data = [], id, setData } = params;
|
|
24
|
+
const [itemRemove, setItemRemove] = useState({
|
|
25
|
+
id: '',
|
|
26
|
+
actionName: '',
|
|
27
|
+
stationName: '',
|
|
28
|
+
});
|
|
29
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
19
30
|
const [actionsList, setActionList] = useState(
|
|
20
31
|
[...data].map((item) => {
|
|
21
32
|
return {
|
|
@@ -26,28 +37,46 @@ const EditActionsList = () => {
|
|
|
26
37
|
);
|
|
27
38
|
|
|
28
39
|
const onPressCancel = useCallback(() => {
|
|
29
|
-
|
|
30
|
-
[...data].map((item) => {
|
|
31
|
-
return {
|
|
32
|
-
...item,
|
|
33
|
-
key: `item-${item?.id}`,
|
|
34
|
-
};
|
|
35
|
-
})
|
|
36
|
-
);
|
|
40
|
+
goBack();
|
|
37
41
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
42
|
}, []);
|
|
39
43
|
|
|
40
|
-
const onPressSave = useCallback(() => {
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
const onPressSave = useCallback(async () => {
|
|
45
|
+
const { success } = await axiosPut(API.AUTOMATE.ORDER_SCRIPT_ACTION(id), {
|
|
46
|
+
id_script_actions: actionsList.map((i) => i.id),
|
|
47
|
+
});
|
|
48
|
+
if (success) {
|
|
49
|
+
setData && setData(actionsList);
|
|
50
|
+
ToastBottomHelper.success(t('text_done'));
|
|
51
|
+
goBack();
|
|
52
|
+
}
|
|
43
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
|
+
}, [actionsList, id, setData]);
|
|
55
|
+
|
|
56
|
+
const onPressRemove = (item) => () => {
|
|
57
|
+
setIsVisible(true);
|
|
58
|
+
setItemRemove(item);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const onClose = useCallback(() => {
|
|
62
|
+
setIsVisible(false);
|
|
44
63
|
}, []);
|
|
45
64
|
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
65
|
+
const onRemove = useCallback(async () => {
|
|
66
|
+
const { success } = await axiosDelete(
|
|
67
|
+
API.AUTOMATE.DELETE_SCRIPT_ACTION(id, itemRemove.id)
|
|
68
|
+
);
|
|
69
|
+
if (success) {
|
|
70
|
+
ToastBottomHelper.success(t('removed_successfully'));
|
|
71
|
+
onClose();
|
|
72
|
+
const temp = [...actionsList];
|
|
73
|
+
const index = actionsList.findIndex((item) => item.id === itemRemove.id);
|
|
74
|
+
temp.splice(index, 1);
|
|
75
|
+
setActionList(temp);
|
|
76
|
+
setData && setData(temp);
|
|
77
|
+
}
|
|
49
78
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
|
-
}, []);
|
|
79
|
+
}, [id, itemRemove, actionsList]);
|
|
51
80
|
|
|
52
81
|
const renderItem = useCallback(({ item, index, drag }) => {
|
|
53
82
|
return (
|
|
@@ -74,7 +103,14 @@ const EditActionsList = () => {
|
|
|
74
103
|
{item?.action_name}
|
|
75
104
|
</Text>
|
|
76
105
|
</View>
|
|
77
|
-
<TouchableOpacity
|
|
106
|
+
<TouchableOpacity
|
|
107
|
+
onPress={onPressRemove({
|
|
108
|
+
id: item?.id,
|
|
109
|
+
actionName: item?.sensor_name,
|
|
110
|
+
stationName: item?.station_name,
|
|
111
|
+
})}
|
|
112
|
+
style={styles.closeButton}
|
|
113
|
+
>
|
|
78
114
|
<Close />
|
|
79
115
|
</TouchableOpacity>
|
|
80
116
|
</View>
|
|
@@ -115,6 +151,34 @@ const EditActionsList = () => {
|
|
|
115
151
|
</Text>
|
|
116
152
|
</TouchableOpacity>
|
|
117
153
|
</View>
|
|
154
|
+
<ModalBottom
|
|
155
|
+
isVisible={isVisible}
|
|
156
|
+
title={t('delette_action')}
|
|
157
|
+
onClose={onClose}
|
|
158
|
+
onRemove={onRemove}
|
|
159
|
+
>
|
|
160
|
+
<View style={styles.wrapChildModal}>
|
|
161
|
+
<ParsedText
|
|
162
|
+
style={styles.messageDelete}
|
|
163
|
+
parse={[
|
|
164
|
+
{
|
|
165
|
+
pattern: new RegExp(itemRemove?.actionName),
|
|
166
|
+
style: styles.textHighlight,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
pattern: new RegExp(itemRemove?.stationName),
|
|
170
|
+
style: styles.textHighlight,
|
|
171
|
+
},
|
|
172
|
+
]}
|
|
173
|
+
childrenProps={{ allowFontScaling: false }}
|
|
174
|
+
>
|
|
175
|
+
{t('message_delete_action', {
|
|
176
|
+
actionName: itemRemove?.actionName,
|
|
177
|
+
stationName: itemRemove?.stationName,
|
|
178
|
+
})}
|
|
179
|
+
</ParsedText>
|
|
180
|
+
</View>
|
|
181
|
+
</ModalBottom>
|
|
118
182
|
</View>
|
|
119
183
|
);
|
|
120
184
|
};
|
|
@@ -2,11 +2,19 @@ import React from 'react';
|
|
|
2
2
|
import { TextInput } from 'react-native';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
4
|
import { EmergencyContactsAddNew } from '../EmergencyContactsAddNew';
|
|
5
|
-
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
6
5
|
import axios from 'axios';
|
|
7
6
|
import Toast from 'react-native-toast-message';
|
|
8
7
|
import { ViewButtonBottom } from '../../../commons';
|
|
9
8
|
import { TESTID } from '../../../configs/Constants';
|
|
9
|
+
import { getTranslate } from '../../../utils/I18n';
|
|
10
|
+
import { SCProvider } from '../../../context';
|
|
11
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
12
|
+
|
|
13
|
+
const wrapComponent = (route) => (
|
|
14
|
+
<SCProvider initState={mockSCStore({})}>
|
|
15
|
+
<EmergencyContactsAddNew route={route} />
|
|
16
|
+
</SCProvider>
|
|
17
|
+
);
|
|
10
18
|
|
|
11
19
|
jest.mock('react-native-toast-message');
|
|
12
20
|
|
|
@@ -24,7 +32,6 @@ jest.mock('@react-navigation/native', () => {
|
|
|
24
32
|
});
|
|
25
33
|
|
|
26
34
|
describe('test EmergencyContactAddNew', () => {
|
|
27
|
-
const t = useTranslations();
|
|
28
35
|
let route;
|
|
29
36
|
beforeEach(() => {
|
|
30
37
|
route = {
|
|
@@ -43,16 +50,9 @@ describe('test EmergencyContactAddNew', () => {
|
|
|
43
50
|
|
|
44
51
|
let tree;
|
|
45
52
|
|
|
46
|
-
test('render', async () => {
|
|
47
|
-
act(() => {
|
|
48
|
-
tree = create(<EmergencyContactsAddNew route={route} />);
|
|
49
|
-
});
|
|
50
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
53
|
test('onChangeNameText', async () => {
|
|
54
54
|
act(() => {
|
|
55
|
-
tree = create(
|
|
55
|
+
tree = create(wrapComponent(route));
|
|
56
56
|
});
|
|
57
57
|
const instance = tree.root;
|
|
58
58
|
const textInput = instance.find(
|
|
@@ -68,12 +68,11 @@ describe('test EmergencyContactAddNew', () => {
|
|
|
68
68
|
|
|
69
69
|
expect(textInput.props.value).toBe('ABC');
|
|
70
70
|
expect(viewButtonBottom.props.rightDisabled).toBeTruthy();
|
|
71
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
72
71
|
});
|
|
73
72
|
|
|
74
73
|
test('onTextPhoneChange', async () => {
|
|
75
74
|
act(() => {
|
|
76
|
-
tree = create(
|
|
75
|
+
tree = create(wrapComponent(route));
|
|
77
76
|
});
|
|
78
77
|
const instance = tree.root;
|
|
79
78
|
const textInput = instance.find(
|
|
@@ -89,12 +88,11 @@ describe('test EmergencyContactAddNew', () => {
|
|
|
89
88
|
|
|
90
89
|
expect(textInput.props.value).toBe('123');
|
|
91
90
|
expect(viewButtonBottom.props.rightDisabled).toBeTruthy();
|
|
92
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
93
91
|
});
|
|
94
92
|
|
|
95
93
|
test('onCancel', async () => {
|
|
96
94
|
act(() => {
|
|
97
|
-
tree = create(
|
|
95
|
+
tree = create(wrapComponent(route));
|
|
98
96
|
});
|
|
99
97
|
const instance = tree.root;
|
|
100
98
|
const viewButtonBottom = instance.findByType(ViewButtonBottom);
|
|
@@ -104,7 +102,6 @@ describe('test EmergencyContactAddNew', () => {
|
|
|
104
102
|
});
|
|
105
103
|
|
|
106
104
|
expect(mockedGoBack).toHaveBeenCalledTimes(1);
|
|
107
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
108
105
|
});
|
|
109
106
|
|
|
110
107
|
test('onSave success', async () => {
|
|
@@ -117,7 +114,7 @@ describe('test EmergencyContactAddNew', () => {
|
|
|
117
114
|
});
|
|
118
115
|
|
|
119
116
|
await act(async () => {
|
|
120
|
-
tree = await create(
|
|
117
|
+
tree = await create(wrapComponent(route));
|
|
121
118
|
});
|
|
122
119
|
const instance = tree.root;
|
|
123
120
|
const viewButtonBottom = instance.findByType(ViewButtonBottom);
|
|
@@ -127,7 +124,6 @@ describe('test EmergencyContactAddNew', () => {
|
|
|
127
124
|
});
|
|
128
125
|
|
|
129
126
|
expect(mockedGoBack).toHaveBeenCalledTimes(1);
|
|
130
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
131
127
|
});
|
|
132
128
|
|
|
133
129
|
test('onSave fail', async () => {
|
|
@@ -139,7 +135,7 @@ describe('test EmergencyContactAddNew', () => {
|
|
|
139
135
|
});
|
|
140
136
|
|
|
141
137
|
await act(async () => {
|
|
142
|
-
tree = await create(
|
|
138
|
+
tree = await create(wrapComponent(route));
|
|
143
139
|
});
|
|
144
140
|
const instance = tree.root;
|
|
145
141
|
const viewButtonBottom = instance.findByType(ViewButtonBottom);
|
|
@@ -150,7 +146,7 @@ describe('test EmergencyContactAddNew', () => {
|
|
|
150
146
|
expect(Toast.show).toHaveBeenCalledWith({
|
|
151
147
|
type: 'error',
|
|
152
148
|
position: 'bottom',
|
|
153
|
-
text1:
|
|
149
|
+
text1: getTranslate('en', 'create_contact_failed'),
|
|
154
150
|
visibilityTime: 1000,
|
|
155
151
|
});
|
|
156
152
|
expect(mockedGoBack).not.toHaveBeenCalled();
|