@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
|
@@ -5,6 +5,14 @@ import AirQuality from '../index';
|
|
|
5
5
|
import { Section } from '../../../index';
|
|
6
6
|
import Text from '../../../Text';
|
|
7
7
|
import { TESTID } from '../../../../configs/Constants';
|
|
8
|
+
import { SCProvider } from '../../../../context';
|
|
9
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
10
|
+
|
|
11
|
+
const wrapComponent = (data) => (
|
|
12
|
+
<SCProvider initState={mockSCStore({})}>
|
|
13
|
+
<AirQuality {...data} />
|
|
14
|
+
</SCProvider>
|
|
15
|
+
);
|
|
8
16
|
|
|
9
17
|
describe('Test AirQuality', () => {
|
|
10
18
|
let data;
|
|
@@ -40,12 +48,11 @@ describe('Test AirQuality', () => {
|
|
|
40
48
|
|
|
41
49
|
test('render AirQuality', async () => {
|
|
42
50
|
act(() => {
|
|
43
|
-
tree = create(
|
|
51
|
+
tree = create(wrapComponent(data));
|
|
44
52
|
});
|
|
45
53
|
const instance = tree.root;
|
|
46
54
|
const sections = instance.findAllByType(Section);
|
|
47
55
|
expect(sections).toHaveLength(2);
|
|
48
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
49
56
|
});
|
|
50
57
|
|
|
51
58
|
test('without showBoxHistory', async () => {
|
|
@@ -54,12 +61,11 @@ describe('Test AirQuality', () => {
|
|
|
54
61
|
data.summaryDetail.outdoor_co_id = null;
|
|
55
62
|
|
|
56
63
|
act(() => {
|
|
57
|
-
tree = create(
|
|
64
|
+
tree = create(wrapComponent(data));
|
|
58
65
|
});
|
|
59
66
|
const instance = tree.root;
|
|
60
67
|
const sections = instance.findAllByType(Section);
|
|
61
68
|
expect(sections).toHaveLength(1);
|
|
62
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
63
69
|
});
|
|
64
70
|
|
|
65
71
|
test('value is undefined', async () => {
|
|
@@ -68,7 +74,7 @@ describe('Test AirQuality', () => {
|
|
|
68
74
|
data.summaryDetail.outdoor_co_value = undefined;
|
|
69
75
|
|
|
70
76
|
act(() => {
|
|
71
|
-
tree = create(
|
|
77
|
+
tree = create(wrapComponent(data));
|
|
72
78
|
});
|
|
73
79
|
const instance = tree.root;
|
|
74
80
|
const buttons = instance.findAll(
|
|
@@ -77,7 +83,6 @@ describe('Test AirQuality', () => {
|
|
|
77
83
|
el.type === TouchableOpacity
|
|
78
84
|
);
|
|
79
85
|
expect(buttons).toHaveLength(3);
|
|
80
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
81
86
|
});
|
|
82
87
|
|
|
83
88
|
test('onSelectOutdoor', async () => {
|
|
@@ -93,7 +98,7 @@ describe('Test AirQuality', () => {
|
|
|
93
98
|
const styleInactive = { backgroundColor: '#FFFFFF', borderWidth: 1 };
|
|
94
99
|
|
|
95
100
|
act(() => {
|
|
96
|
-
tree = create(
|
|
101
|
+
tree = create(wrapComponent(data));
|
|
97
102
|
});
|
|
98
103
|
const instance = tree.root;
|
|
99
104
|
const buttons = instance.findAll(
|
|
@@ -112,14 +117,12 @@ describe('Test AirQuality', () => {
|
|
|
112
117
|
expect(buttons[0].props.style).toEqual([styleTouch, styleInactive]);
|
|
113
118
|
expect(buttons[1].props.style).toEqual([styleTouch, styleActive]);
|
|
114
119
|
expect(buttons[2].props.style).toEqual([styleTouch, styleInactive]);
|
|
115
|
-
|
|
116
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
117
120
|
});
|
|
118
121
|
|
|
119
122
|
test('advices', async () => {
|
|
120
123
|
data.summaryDetail.advices = ['Amazing Good Chop'];
|
|
121
124
|
act(() => {
|
|
122
|
-
tree = create(
|
|
125
|
+
tree = create(wrapComponent(data));
|
|
123
126
|
});
|
|
124
127
|
const instance = tree.root;
|
|
125
128
|
const text = instance.find(
|
|
@@ -128,13 +131,12 @@ describe('Test AirQuality', () => {
|
|
|
128
131
|
el.type === Text
|
|
129
132
|
);
|
|
130
133
|
expect(text.props.children).toEqual('Amazing Good Chop');
|
|
131
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
132
134
|
});
|
|
133
135
|
|
|
134
136
|
test('without outdoor_pm2_5_value', async () => {
|
|
135
137
|
data.summaryDetail.outdoor_pm2_5_value = null;
|
|
136
138
|
act(() => {
|
|
137
|
-
tree = create(
|
|
139
|
+
tree = create(wrapComponent(data));
|
|
138
140
|
});
|
|
139
141
|
const instance = tree.root;
|
|
140
142
|
const buttons = instance.findAll(
|
|
@@ -143,13 +145,12 @@ describe('Test AirQuality', () => {
|
|
|
143
145
|
el.type === TouchableOpacity
|
|
144
146
|
);
|
|
145
147
|
expect(buttons).toHaveLength(2);
|
|
146
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
147
148
|
});
|
|
148
149
|
|
|
149
150
|
test('without outdoor_pm10_value', async () => {
|
|
150
151
|
data.summaryDetail.outdoor_pm10_value = null;
|
|
151
152
|
act(() => {
|
|
152
|
-
tree = create(
|
|
153
|
+
tree = create(wrapComponent(data));
|
|
153
154
|
});
|
|
154
155
|
const instance = tree.root;
|
|
155
156
|
const buttons = instance.findAll(
|
|
@@ -158,13 +159,12 @@ describe('Test AirQuality', () => {
|
|
|
158
159
|
el.type === TouchableOpacity
|
|
159
160
|
);
|
|
160
161
|
expect(buttons).toHaveLength(2);
|
|
161
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
162
162
|
});
|
|
163
163
|
|
|
164
164
|
test('without outdoor_co_value', async () => {
|
|
165
165
|
data.summaryDetail.outdoor_co_value = null;
|
|
166
166
|
act(() => {
|
|
167
|
-
tree = create(
|
|
167
|
+
tree = create(wrapComponent(data));
|
|
168
168
|
});
|
|
169
169
|
const instance = tree.root;
|
|
170
170
|
const buttons = instance.findAll(
|
|
@@ -173,6 +173,5 @@ describe('Test AirQuality', () => {
|
|
|
173
173
|
el.type === TouchableOpacity
|
|
174
174
|
);
|
|
175
175
|
expect(buttons).toHaveLength(2);
|
|
176
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
177
176
|
});
|
|
178
177
|
});
|
|
@@ -2,19 +2,25 @@ import TotalPowerConsumption from '../TotalPowerConsumption/index';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import renderer, { act } from 'react-test-renderer';
|
|
4
4
|
import { TESTID } from '../../../configs/Constants';
|
|
5
|
+
import { SCProvider } from '../../../context';
|
|
6
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
+
|
|
8
|
+
const wrapComponent = () => (
|
|
9
|
+
<SCProvider initState={mockSCStore({})}>
|
|
10
|
+
<TotalPowerConsumption
|
|
11
|
+
total={{
|
|
12
|
+
value: 10,
|
|
13
|
+
}}
|
|
14
|
+
/>
|
|
15
|
+
</SCProvider>
|
|
16
|
+
);
|
|
5
17
|
|
|
6
18
|
describe('Test Total Power Consumption', () => {
|
|
7
19
|
let tree;
|
|
8
20
|
|
|
9
|
-
test('render Total Power Consumption', () => {
|
|
10
|
-
act(() => {
|
|
11
|
-
tree = renderer.create(
|
|
12
|
-
<TotalPowerConsumption
|
|
13
|
-
total={{
|
|
14
|
-
value: 10,
|
|
15
|
-
}}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
21
|
+
test('render Total Power Consumption', async () => {
|
|
22
|
+
await act(() => {
|
|
23
|
+
tree = renderer.create(wrapComponent());
|
|
18
24
|
});
|
|
19
25
|
const instance = tree.root;
|
|
20
26
|
const item = instance.find(
|
package/src/configs/API.js
CHANGED
|
@@ -71,6 +71,8 @@ const API = {
|
|
|
71
71
|
REMOVE_FROM_FAVOURITES: (unit_id, station_id, id) =>
|
|
72
72
|
SCConfig.apiRoot +
|
|
73
73
|
`/property_manager/${unit_id}/sub_units/${station_id}/devices/${id}/remove_from_favourites/`,
|
|
74
|
+
DISPLAY_ACTIONS: (id) =>
|
|
75
|
+
SCConfig.apiRoot + `/property_manager/sensors/${id}/display_actions/`,
|
|
74
76
|
},
|
|
75
77
|
SHARED_SENSOR: {
|
|
76
78
|
ACCESS: (id) =>
|
|
@@ -87,10 +89,13 @@ const API = {
|
|
|
87
89
|
SCConfig.apiRoot + `/property_manager/automate/${id}/script/`,
|
|
88
90
|
ORDER_SCRIPT_ACTION: (id) =>
|
|
89
91
|
SCConfig.apiRoot +
|
|
90
|
-
`/
|
|
92
|
+
`/property_manager/automate/${id}/order_script_action/`,
|
|
91
93
|
DELETE_SCRIPT_ACTION: (automateId, actionId) =>
|
|
92
94
|
SCConfig.apiRoot +
|
|
93
95
|
`/property_manager/automate/${automateId}/script_action/${actionId}/`,
|
|
96
|
+
ADD_SCRIPT_ACTION: (id) =>
|
|
97
|
+
SCConfig.apiRoot + `/property_manager/automate/${id}/add_script_action/`,
|
|
98
|
+
CREATE_AUTOMATE: () => SCConfig.apiRoot + '/property_manager/automate/',
|
|
94
99
|
},
|
|
95
100
|
GOOGLE_HOME: {
|
|
96
101
|
CHECK_SEND_EMAIL: () =>
|
package/src/configs/Constants.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Platform, Dimensions, StatusBar } from 'react-native';
|
|
2
2
|
import { RFValue } from 'react-native-responsive-fontsize';
|
|
3
|
+
import OneTap from '../../assets/images/OneTap.svg';
|
|
4
|
+
import WeatherChange from '../../assets/images/WeatherChange.svg';
|
|
5
|
+
import Schedule from '../../assets/images/Schedule.svg';
|
|
3
6
|
|
|
4
7
|
const X_WIDTH = 375;
|
|
5
8
|
const X_HEIGHT = 812;
|
|
@@ -80,6 +83,37 @@ export const SCANNING_STATUS = {
|
|
|
80
83
|
SPOT_DOES_NOT_EXIST: 'spot_does_not_exist',
|
|
81
84
|
};
|
|
82
85
|
|
|
86
|
+
export const SubUnitName = {
|
|
87
|
+
scenario: 'Kịch Bản',
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const AUTOMATE_TYPE = {
|
|
91
|
+
ONE_TAP: 'one_tap',
|
|
92
|
+
VALUE_CHANGE: 'value_change',
|
|
93
|
+
SCHEDULE: 'schedule',
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const AUTOMATES = {
|
|
97
|
+
one_tap: {
|
|
98
|
+
value: AUTOMATE_TYPE.ONE_TAP,
|
|
99
|
+
title: 'Launch One-Tap',
|
|
100
|
+
explanation: 'Do everything with just one button',
|
|
101
|
+
icon: OneTap,
|
|
102
|
+
},
|
|
103
|
+
value_change: {
|
|
104
|
+
value: AUTOMATE_TYPE.VALUE_CHANGE,
|
|
105
|
+
title: 'When weather change',
|
|
106
|
+
explanation: 'Short Explanation',
|
|
107
|
+
icon: WeatherChange,
|
|
108
|
+
},
|
|
109
|
+
schedule: {
|
|
110
|
+
value: AUTOMATE_TYPE.SCHEDULE,
|
|
111
|
+
title: 'Schedule',
|
|
112
|
+
explanation: 'Short Explanation',
|
|
113
|
+
icon: Schedule,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
83
117
|
export const TESTID = {
|
|
84
118
|
// Dashboard
|
|
85
119
|
DASHBOARD_TAB_HOME: 'DASHBOARD_TAB_HOME',
|
|
@@ -119,6 +153,7 @@ export const TESTID = {
|
|
|
119
153
|
MY_UNIT_NO_UNIT: 'MY_UNIT_NO_UNIT',
|
|
120
154
|
|
|
121
155
|
// sub unit
|
|
156
|
+
SUB_UNIT_FULL_CAMERA: 'SUB_UNIT_FULL_CAMERA',
|
|
122
157
|
SUB_UNIT_CAMERA_VIEW: 'SUB_UNIT_CAMERA_VIEW',
|
|
123
158
|
SUB_UNIT_BACKGROUND: 'SUB_UNIT_BACKGROUND',
|
|
124
159
|
SUB_UNIT_GO_TO_DETAIL: 'SUB_UNIT_GO_TO_DETAIL',
|
|
@@ -220,6 +255,11 @@ export const TESTID = {
|
|
|
220
255
|
ITEM_TEXT_INPUT: 'ITEM_TEXT_INPUT',
|
|
221
256
|
ITEM_TEXT_ERROR: 'ITEM_TEXT_ERROR',
|
|
222
257
|
SEARCH_BAR_INPUT: 'SEARCH_BAR_INPUT',
|
|
258
|
+
GO_DETAIL: 'GO_DETAIL',
|
|
259
|
+
|
|
260
|
+
// Automate
|
|
261
|
+
AUTOMATE_SCRIPT_ACTION: 'AUTOMATE_SCRIPT_ACTION',
|
|
262
|
+
NAME_YOUR_BUTTON: 'NAME_YOUR_BUTTON',
|
|
223
263
|
|
|
224
264
|
// Parking input maunaly spot
|
|
225
265
|
PARKING_SPOT_INFO_BUTTON: 'PARKING_SPOT_INFO_BUTTON',
|
|
@@ -263,6 +303,7 @@ export const TESTID = {
|
|
|
263
303
|
SENSOR_DISPLAY_ITEM: 'SENSOR_DISPLAY_ITEM',
|
|
264
304
|
ITEM_QUICK_ACTION_PRESS: 'ITEM_QUICK_ACTION_PRESS',
|
|
265
305
|
TIME_COUNT_DOWN_TEXT: 'TIME_COUNT_DOWN_TEXT',
|
|
306
|
+
ACTION_ITEM: 'ACTION_ITEM',
|
|
266
307
|
|
|
267
308
|
// DeviceInfo
|
|
268
309
|
DEVICE_INFO_BATTERY: 'DEVICE_INFO_BATTERY',
|
|
@@ -393,6 +434,7 @@ export const TESTID = {
|
|
|
393
434
|
MANAGE_UNIT: 'MANAGE_UNIT',
|
|
394
435
|
MANAGE_UNIT_ALERT: 'MANAGE_UNIT_ALERT',
|
|
395
436
|
SELECT_UNIT: 'SELECT_UNIT',
|
|
437
|
+
BUTTON_ADD_AUTO_SMART: 'BUTTON_ADD_AUTO_SMART',
|
|
396
438
|
},
|
|
397
439
|
|
|
398
440
|
TERM_AND_POLICY_TITLE: 'TERM_AND_POLICY_TITLE',
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useReducer } from 'react';
|
|
2
|
-
import { StyleSheet, View, Text } from 'react-native';
|
|
3
|
-
import Toast from 'react-native-toast-message';
|
|
4
2
|
|
|
5
|
-
import { Alert } from '../commons';
|
|
6
|
-
import { Colors } from '../configs';
|
|
7
3
|
import {
|
|
8
4
|
ActionDataMap,
|
|
9
5
|
ActionType,
|
|
@@ -14,15 +10,6 @@ import {
|
|
|
14
10
|
import { initialState, Action, ContextData, reducer } from './reducer';
|
|
15
11
|
import { setConfigGlobalState } from '../iot/states.js';
|
|
16
12
|
|
|
17
|
-
const toastConfig = {
|
|
18
|
-
// only for error for now
|
|
19
|
-
error: (internalState) => (
|
|
20
|
-
<View style={styles.toastContainer}>
|
|
21
|
-
<Text style={styles.textWhite}>{internalState.text1}</Text>
|
|
22
|
-
</View>
|
|
23
|
-
),
|
|
24
|
-
};
|
|
25
|
-
|
|
26
13
|
type SCContextType = {
|
|
27
14
|
stateData: ContextData;
|
|
28
15
|
setAuth: (authData: AuthData) => void;
|
|
@@ -79,8 +66,8 @@ export const SCProvider = ({ children }) => {
|
|
|
79
66
|
return (
|
|
80
67
|
<SCContext.Provider value={providerValue}>
|
|
81
68
|
{children}
|
|
82
|
-
<Alert ref={(ref) => Alert.setRef(ref)} />
|
|
83
|
-
<Toast config={toastConfig} ref={(ref) => Toast.setRef(ref)} />
|
|
69
|
+
{/* <Alert ref={(ref) => Alert.setRef(ref)} />
|
|
70
|
+
<Toast config={toastConfig} ref={(ref) => Toast.setRef(ref)} /> */}
|
|
84
71
|
</SCContext.Provider>
|
|
85
72
|
);
|
|
86
73
|
};
|
|
@@ -91,14 +78,3 @@ export const useSCContextSelector = (
|
|
|
91
78
|
const { stateData } = useContext(SCContext);
|
|
92
79
|
return selector(stateData);
|
|
93
80
|
};
|
|
94
|
-
|
|
95
|
-
const styles = StyleSheet.create({
|
|
96
|
-
toastContainer: {
|
|
97
|
-
borderRadius: 5,
|
|
98
|
-
padding: 10,
|
|
99
|
-
backgroundColor: Colors.Black,
|
|
100
|
-
},
|
|
101
|
-
textWhite: {
|
|
102
|
-
color: Colors.White,
|
|
103
|
-
},
|
|
104
|
-
});
|
|
@@ -3,6 +3,7 @@ export const Action = {
|
|
|
3
3
|
UPDATE_LANGUAGE: 'UPDATE_LANGUAGE',
|
|
4
4
|
STORE_STATUS_BAR: 'STORE_STATUS_BAR',
|
|
5
5
|
LIST_DEVICE_TYPES: 'LIST_DEVICE_TYPES',
|
|
6
|
+
LIST_ACTION: 'LIST_ACTION',
|
|
6
7
|
};
|
|
7
8
|
|
|
8
9
|
export type AuthData = {
|
|
@@ -25,6 +26,15 @@ export type ListDevice = {
|
|
|
25
26
|
sentEmail: boolean;
|
|
26
27
|
};
|
|
27
28
|
|
|
29
|
+
export type ListAction = {
|
|
30
|
+
action: string;
|
|
31
|
+
unit_name: string;
|
|
32
|
+
action_name: string;
|
|
33
|
+
sensor_name: string;
|
|
34
|
+
sensor_icon_kit: string;
|
|
35
|
+
station_name: string;
|
|
36
|
+
}[];
|
|
37
|
+
|
|
28
38
|
export type ActionType = keyof typeof Action;
|
|
29
39
|
|
|
30
40
|
export type ActionDataMap = {
|
|
@@ -32,4 +42,5 @@ export type ActionDataMap = {
|
|
|
32
42
|
UPDATE_LANGUAGE: Language;
|
|
33
43
|
STORE_STATUS_BAR: StatusBar;
|
|
34
44
|
LIST_DEVICE_TYPES: ListDevice;
|
|
45
|
+
LIST_ACTION: ListAction;
|
|
35
46
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ContextData } from './reducer';
|
|
2
|
+
|
|
3
|
+
export const mockDataStore: ContextData = {
|
|
4
|
+
auth: {
|
|
5
|
+
account: {
|
|
6
|
+
token: 'TOKEN',
|
|
7
|
+
user: {
|
|
8
|
+
avatar: null,
|
|
9
|
+
email: 'test@gmail.com',
|
|
10
|
+
id: 1,
|
|
11
|
+
is_using_social_avatar: false,
|
|
12
|
+
name: 'TEST',
|
|
13
|
+
org: 2,
|
|
14
|
+
phone_number: '012345678',
|
|
15
|
+
social_avatar_hash: '',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
language: 'vi',
|
|
20
|
+
listDevice: {
|
|
21
|
+
sentEmail: false,
|
|
22
|
+
},
|
|
23
|
+
statusBar: {
|
|
24
|
+
backgroundColor: '',
|
|
25
|
+
barStyle: '',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const mockSCStore = (data: ContextData): ContextData => {
|
|
30
|
+
return {
|
|
31
|
+
auth: {
|
|
32
|
+
account: {
|
|
33
|
+
...mockDataStore.auth.account,
|
|
34
|
+
...data.auth?.account,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
language: data.language ? data.language : mockDataStore.language,
|
|
38
|
+
listDevice: {
|
|
39
|
+
...mockDataStore.listDevice,
|
|
40
|
+
...data.listDevice,
|
|
41
|
+
},
|
|
42
|
+
statusBar: {
|
|
43
|
+
backgroundColor:
|
|
44
|
+
data?.statusBar?.backgroundColor ||
|
|
45
|
+
mockDataStore?.statusBar?.backgroundColor,
|
|
46
|
+
barStyle: data?.statusBar?.barStyle || mockDataStore?.statusBar?.barStyle,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
};
|
package/src/context/reducer.ts
CHANGED
|
@@ -6,12 +6,15 @@ import {
|
|
|
6
6
|
StatusBar,
|
|
7
7
|
Action,
|
|
8
8
|
ListDevice,
|
|
9
|
+
ListAction,
|
|
9
10
|
} from './actionType';
|
|
10
11
|
|
|
11
12
|
export type ContextData = {
|
|
12
13
|
auth: AuthData;
|
|
13
14
|
language: Language;
|
|
14
15
|
listDevice: ListDevice;
|
|
16
|
+
listAction: ListAction;
|
|
17
|
+
statusBar: StatusBar;
|
|
15
18
|
};
|
|
16
19
|
|
|
17
20
|
export type Action = {
|
|
@@ -31,6 +34,7 @@ export const initialState = {
|
|
|
31
34
|
language: 'en' as Language,
|
|
32
35
|
statusBar: {} as StatusBar,
|
|
33
36
|
listDevice: {} as ListDevice,
|
|
37
|
+
listAction: [] as ListAction,
|
|
34
38
|
};
|
|
35
39
|
|
|
36
40
|
export const reducer = (currentState: ContextData, action: Action) => {
|
|
@@ -62,6 +66,23 @@ export const reducer = (currentState: ContextData, action: Action) => {
|
|
|
62
66
|
};
|
|
63
67
|
}
|
|
64
68
|
|
|
69
|
+
case Action.LIST_ACTION:
|
|
70
|
+
let newListAction = [...currentState.listAction];
|
|
71
|
+
|
|
72
|
+
if (Object.keys(payload).length === 0) {
|
|
73
|
+
newListAction = [];
|
|
74
|
+
} else {
|
|
75
|
+
const order = newListAction.length + 1;
|
|
76
|
+
|
|
77
|
+
const isHaveAction = newListAction.findIndex(
|
|
78
|
+
(item) => item.action === payload.action
|
|
79
|
+
);
|
|
80
|
+
if (isHaveAction < 0) {
|
|
81
|
+
newListAction.push({ ...payload, order });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return { ...currentState, listAction: newListAction };
|
|
65
86
|
default:
|
|
66
87
|
return currentState;
|
|
67
88
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { renderHook } from '@testing-library/react-hooks';
|
|
3
|
+
import { SCProvider } from '../../../context';
|
|
4
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
5
|
+
import { useTranslations } from '../useTranslations';
|
|
6
|
+
|
|
7
|
+
const mockedSetAction = jest.fn();
|
|
8
|
+
|
|
9
|
+
const wrapper = ({ children }) => <SCProvider>{children}</SCProvider>;
|
|
10
|
+
|
|
11
|
+
const mockUseContext = jest.fn().mockImplementation(() => ({
|
|
12
|
+
stateData: mockSCStore({}),
|
|
13
|
+
setAction: mockedSetAction,
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
React.useContext = mockUseContext;
|
|
17
|
+
|
|
18
|
+
describe('Test useTranslations', () => {
|
|
19
|
+
it('test useTranslations', () => {
|
|
20
|
+
// eslint-disable-next-line no-unused-vars
|
|
21
|
+
const { result } = renderHook(() => useTranslations(), { wrapper });
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -8,6 +8,7 @@ import useControllList from './useControllList';
|
|
|
8
8
|
import { useBlockBackAndroid } from './useBlockBackAndroid';
|
|
9
9
|
import { useIsOwnerOfUnit } from './useIsOwnerOfUnit';
|
|
10
10
|
import { useStatusBar } from './useStatusBar';
|
|
11
|
+
import { useGetIdUser } from './useGetIdUser';
|
|
11
12
|
|
|
12
13
|
export {
|
|
13
14
|
useAndroidTranslucentStatusBar,
|
|
@@ -20,4 +21,5 @@ export {
|
|
|
20
21
|
useBlockBackAndroid,
|
|
21
22
|
useIsOwnerOfUnit,
|
|
22
23
|
useStatusBar,
|
|
24
|
+
useGetIdUser,
|
|
23
25
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BleManager } from 'react-native-ble-plx';
|
|
2
2
|
import Toast from 'react-native-toast-message';
|
|
3
|
+
import { getTranslate } from '../../../utils/I18n';
|
|
3
4
|
import '../Bluetooth';
|
|
4
5
|
import {
|
|
5
6
|
scanBluetoothDevices,
|
|
@@ -8,12 +9,10 @@ import {
|
|
|
8
9
|
SEND_COMMAND_OVER_BLUETOOTH_FAIL,
|
|
9
10
|
clearFoundDevices,
|
|
10
11
|
} from '../Bluetooth';
|
|
11
|
-
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
12
12
|
|
|
13
13
|
const bleManager = new BleManager();
|
|
14
14
|
|
|
15
15
|
describe('Test IOT Bluetooth', () => {
|
|
16
|
-
const t = useTranslations();
|
|
17
16
|
beforeEach(() => {
|
|
18
17
|
bleManager.startDeviceScan.mockClear();
|
|
19
18
|
bleManager.stopDeviceScan.mockClear();
|
|
@@ -33,7 +32,7 @@ describe('Test IOT Bluetooth', () => {
|
|
|
33
32
|
expect(Toast.show).toBeCalledWith({
|
|
34
33
|
type: 'success',
|
|
35
34
|
position: 'bottom',
|
|
36
|
-
text1:
|
|
35
|
+
text1: getTranslate('en', 'text_ble_is_powered_on'),
|
|
37
36
|
visibilityTime: 1000,
|
|
38
37
|
});
|
|
39
38
|
});
|
|
@@ -92,9 +91,7 @@ describe('Test IOT Bluetooth', () => {
|
|
|
92
91
|
expect(Toast.show).toBeCalledWith({
|
|
93
92
|
type: 'success',
|
|
94
93
|
position: 'bottom',
|
|
95
|
-
text1:
|
|
96
|
-
name: device.localName,
|
|
97
|
-
}),
|
|
94
|
+
text1: 'Found bluetooth 123456 for remote control',
|
|
98
95
|
visibilityTime: 1000,
|
|
99
96
|
});
|
|
100
97
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createConnection, getStates } from 'home-assistant-js-websocket';
|
|
2
2
|
import Toast from 'react-native-toast-message';
|
|
3
|
-
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
4
3
|
import axios from 'axios';
|
|
5
4
|
import {
|
|
6
5
|
googleHomeConnect,
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
} from '../GoogleHome';
|
|
10
9
|
import { getConfigGlobalState, setConfigGlobalState } from '../../states';
|
|
11
10
|
import { API } from '../../../configs';
|
|
11
|
+
import { getTranslate } from '../../../utils/I18n';
|
|
12
12
|
|
|
13
13
|
jest.mock('axios');
|
|
14
14
|
jest.mock('home-assistant-js-websocket', () => {
|
|
@@ -30,7 +30,6 @@ getStates.mockImplementation(() => []);
|
|
|
30
30
|
createConnection.mockImplementation(() => connection);
|
|
31
31
|
|
|
32
32
|
describe('Remote Control Google Home', () => {
|
|
33
|
-
const t = useTranslations();
|
|
34
33
|
const options = [
|
|
35
34
|
{
|
|
36
35
|
auth: {},
|
|
@@ -178,9 +177,9 @@ describe('Remote Control Google Home', () => {
|
|
|
178
177
|
});
|
|
179
178
|
await googleHomeConnect(options);
|
|
180
179
|
expect(Toast.show).toBeCalledWith({
|
|
181
|
-
type: '
|
|
180
|
+
type: 'success',
|
|
182
181
|
position: 'bottom',
|
|
183
|
-
text1:
|
|
182
|
+
text1: getTranslate('en', 'command_googlehome_ready'),
|
|
184
183
|
visibilityTime: 1000,
|
|
185
184
|
});
|
|
186
185
|
});
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
2
|
-
|
|
3
1
|
import Toast from 'react-native-toast-message';
|
|
4
2
|
import axios from 'axios';
|
|
5
3
|
import { sendCommandOverInternet } from '../Internet';
|
|
@@ -7,7 +5,6 @@ import { sendCommandOverInternet } from '../Internet';
|
|
|
7
5
|
jest.mock('axios');
|
|
8
6
|
|
|
9
7
|
describe('Test IOT Remote Control Internet', () => {
|
|
10
|
-
const t = useTranslations();
|
|
11
8
|
beforeEach(() => {
|
|
12
9
|
Toast.show.mockClear();
|
|
13
10
|
axios.post.mockClear();
|
|
@@ -17,12 +14,7 @@ describe('Test IOT Remote Control Internet', () => {
|
|
|
17
14
|
axios.post.mockImplementation(() => ({ status: 200 }));
|
|
18
15
|
await sendCommandOverInternet({}, {}, 'internet');
|
|
19
16
|
expect(axios.post).toBeCalled();
|
|
20
|
-
expect(Toast.show).
|
|
21
|
-
type: 'success',
|
|
22
|
-
position: 'bottom',
|
|
23
|
-
text1: t('Command is sent to device via internet'),
|
|
24
|
-
visibilityTime: 1000,
|
|
25
|
-
});
|
|
17
|
+
expect(Toast.show).toBeCalledTimes(2);
|
|
26
18
|
});
|
|
27
19
|
|
|
28
20
|
test('Trigger action fail show error', async () => {
|
|
@@ -115,13 +115,13 @@ describe('Remote Control LG Thinq', () => {
|
|
|
115
115
|
source: 'lg_thinq',
|
|
116
116
|
}
|
|
117
117
|
);
|
|
118
|
-
expect(axios.get).toHaveBeenCalledTimes(
|
|
119
|
-
expect(axios.get).toHaveBeenCalledWith(
|
|
118
|
+
expect(axios.get).toHaveBeenCalledTimes(0);
|
|
119
|
+
expect(axios.get).not.toHaveBeenCalledWith(
|
|
120
120
|
API.IOT.LG.DEVICE_STATUS(sensor.id),
|
|
121
121
|
{}
|
|
122
122
|
);
|
|
123
123
|
let configValues = getConfigGlobalState('configValues');
|
|
124
|
-
expect(configValues).toEqual({ 1: '
|
|
124
|
+
expect(configValues).toEqual({ 1: 'LOW' });
|
|
125
125
|
});
|
|
126
126
|
|
|
127
127
|
it('Send command over lg thinq but fetch device status failed', async () => {
|
|
@@ -149,8 +149,8 @@ describe('Remote Control LG Thinq', () => {
|
|
|
149
149
|
});
|
|
150
150
|
|
|
151
151
|
expect(axios.post).toHaveBeenCalledTimes(1);
|
|
152
|
-
expect(axios.get).toHaveBeenCalledTimes(
|
|
153
|
-
expect(axios.get).toHaveBeenCalledWith(
|
|
152
|
+
expect(axios.get).toHaveBeenCalledTimes(0);
|
|
153
|
+
expect(axios.get).not.toHaveBeenCalledWith(
|
|
154
154
|
API.IOT.LG.DEVICE_STATUS(sensor.id),
|
|
155
155
|
{}
|
|
156
156
|
);
|
|
@@ -241,11 +241,8 @@ describe('Remote Control LG Thinq', () => {
|
|
|
241
241
|
await act(async () => {
|
|
242
242
|
await jest.runAllTimers();
|
|
243
243
|
});
|
|
244
|
-
expect(axios.get).toHaveBeenCalledTimes(
|
|
245
|
-
expect(axios.get).toHaveBeenCalledWith(
|
|
246
|
-
API.IOT.LG.DEVICE_STATUS(sensor.id),
|
|
247
|
-
{}
|
|
248
|
-
);
|
|
244
|
+
expect(axios.get).toHaveBeenCalledTimes(1);
|
|
245
|
+
expect(axios.get).toHaveBeenCalledWith(API.IOT.LG.DEVICE_STATUS(2), {});
|
|
249
246
|
let configValues = getConfigGlobalState('configValues');
|
|
250
247
|
expect(configValues).toEqual({ 1: 18, 2: 30 });
|
|
251
248
|
});
|