@eohjsc/react-native-smart-city 0.7.3-rc23 → 0.7.3-rc24
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/package.json
CHANGED
|
@@ -52,7 +52,7 @@ const EditSubUnit = ({ route }) => {
|
|
|
52
52
|
}, [getListContacts, group, isFocused]);
|
|
53
53
|
|
|
54
54
|
const onBack = useCallback(() => {
|
|
55
|
-
const { routes } = navigation.
|
|
55
|
+
const { routes } = navigation.getState();
|
|
56
56
|
const calledByRoute = routes[routes.length - 3].name;
|
|
57
57
|
|
|
58
58
|
switch (calledByRoute) {
|
|
@@ -63,9 +63,10 @@ const EditSubUnit = ({ route }) => {
|
|
|
63
63
|
navigation.navigate(Routes.UnitDetail, {
|
|
64
64
|
isEditSubUnit: true,
|
|
65
65
|
isAddSubUnit: false,
|
|
66
|
+
unitId: unit?.id,
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
|
-
}, [navigation]);
|
|
69
|
+
}, [navigation, unit?.id]);
|
|
69
70
|
|
|
70
71
|
const updateSubUnit = useCallback(
|
|
71
72
|
async (params, headers) => {
|
|
@@ -118,7 +119,6 @@ const EditSubUnit = ({ route }) => {
|
|
|
118
119
|
if (success) {
|
|
119
120
|
//dispatch(removeSubUnit(station.id));
|
|
120
121
|
ToastBottomHelper.success(t('text_remove_sub_unit_success'));
|
|
121
|
-
navigation.pop();
|
|
122
122
|
onBack();
|
|
123
123
|
} else {
|
|
124
124
|
ToastBottomHelper.error(t('text_remove_sub_unit_fail'));
|
|
@@ -212,7 +212,9 @@ describe('Test AddSubUnit', () => {
|
|
|
212
212
|
},
|
|
213
213
|
isAddUnit: true,
|
|
214
214
|
};
|
|
215
|
-
mock.onPost(API.UNIT.CREATE_UNIT()).reply(400
|
|
215
|
+
mock.onPost(API.UNIT.CREATE_UNIT()).reply(400, {
|
|
216
|
+
non_field_errors: 'You have reached max units',
|
|
217
|
+
});
|
|
216
218
|
await act(async () => {
|
|
217
219
|
tree = await create(wrapComponent(route));
|
|
218
220
|
});
|
|
@@ -224,7 +226,7 @@ describe('Test AddSubUnit', () => {
|
|
|
224
226
|
expect(Toast.show).toHaveBeenCalledWith({
|
|
225
227
|
type: 'error',
|
|
226
228
|
position: 'bottom',
|
|
227
|
-
text1:
|
|
229
|
+
text1: 'You have reached max units',
|
|
228
230
|
visibilityTime: 1000,
|
|
229
231
|
});
|
|
230
232
|
});
|
|
@@ -70,7 +70,7 @@ describe('Test EditSubUnit', () => {
|
|
|
70
70
|
it('alertAction rightButtonClick success, previous screen Routes.UnitDetail', async () => {
|
|
71
71
|
mock.onDelete(API.SUB_UNIT.REMOVE_SUB_UNIT(1, 2)).reply(200);
|
|
72
72
|
|
|
73
|
-
global.
|
|
73
|
+
global.mockedGetState.mockImplementation(() => ({
|
|
74
74
|
routes: [
|
|
75
75
|
{ name: Routes.UnitDetail },
|
|
76
76
|
{ name: 'route 2' },
|
|
@@ -98,7 +98,7 @@ describe('Test EditSubUnit', () => {
|
|
|
98
98
|
|
|
99
99
|
it('alertAction rightButtonClick success', async () => {
|
|
100
100
|
mock.onDelete(API.SUB_UNIT.REMOVE_SUB_UNIT(1, 2)).reply(200);
|
|
101
|
-
global.
|
|
101
|
+
global.mockedGetState.mockImplementation(() => ({
|
|
102
102
|
routes: [
|
|
103
103
|
{ name: 'UnitDetail' },
|
|
104
104
|
{ name: 'route 2' },
|
|
@@ -122,7 +122,7 @@ describe('Test EditSubUnit', () => {
|
|
|
122
122
|
.onDelete('https://backend.eoh.io/api/property_manager/1/sub_units/2/')
|
|
123
123
|
.reply(400);
|
|
124
124
|
|
|
125
|
-
global.
|
|
125
|
+
global.mockedGetState.mockImplementation(() => ({
|
|
126
126
|
routes: [{ name: 'route 1' }, { name: 'route 2' }, { name: 'route 3' }],
|
|
127
127
|
}));
|
|
128
128
|
|