foreman_rh_cloud 3.0.18.1 → 3.0.19
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.
- checksums.yaml +4 -4
- data/app/controllers/foreman_inventory_upload/tasks_controller.rb +14 -3
- data/app/controllers/foreman_inventory_upload/uploads_settings_controller.rb +8 -0
- data/app/models/insights_resolution.rb +1 -1
- data/config/routes.rb +1 -1
- data/lib/foreman_inventory_upload.rb +5 -0
- data/lib/foreman_inventory_upload/generators/queries.rb +1 -1
- data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +5 -1
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/insights_cloud/async/insights_full_sync.rb +17 -21
- data/lib/inventory_sync/async/host_result.rb +11 -6
- data/lib/inventory_sync/async/inventory_full_sync.rb +24 -41
- data/lib/inventory_sync/async/inventory_hosts_sync.rb +34 -0
- data/lib/inventory_sync/async/query_inventory_job.rb +54 -0
- data/lib/tasks/insights.rake +1 -1
- data/package.json +1 -1
- data/test/jobs/insights_full_sync_test.rb +14 -10
- data/test/jobs/inventory_full_sync_test.rb +181 -11
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +81 -46
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonConstants.js +3 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonSelectors.js +6 -12
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonFixtures.js +1 -9
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonSelectors.test.js +18 -27
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonSelectors.test.js.snap +1 -16
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +58 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js +51 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/index.js +2 -5
- data/webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js +0 -2
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +2 -0
- data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js +4 -0
- metadata +25 -25
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js +0 -36
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonActions.test.js +0 -31
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonReducer.test.js +0 -26
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonActions.test.js.snap +0 -98
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonReducer.test.js.snap +0 -18
@@ -1,18 +1,3 @@
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
2
|
|
3
|
-
exports[`SyncButton selectors should return InventorySync 1`] = `
|
4
|
-
Object {
|
5
|
-
"disconnectHosts": 0,
|
6
|
-
"error": "some-error",
|
7
|
-
"status": "RESOLVED",
|
8
|
-
"syncHosts": 1,
|
9
|
-
}
|
10
|
-
`;
|
11
|
-
|
12
|
-
exports[`SyncButton selectors should return InventorySync SyncHosts 1`] = `1`;
|
13
|
-
|
14
|
-
exports[`SyncButton selectors should return InventorySync disconnectHosts 1`] = `0`;
|
15
|
-
|
16
|
-
exports[`SyncButton selectors should return InventorySync error 1`] = `"some-error"`;
|
17
|
-
|
18
|
-
exports[`SyncButton selectors should return InventorySync status 1`] = `"RESOLVED"`;
|
3
|
+
exports[`SyncButton selectors should return InventorySync status 1`] = `"PENDING"`;
|
@@ -0,0 +1,58 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`SyncButton integration test Successful task was triggered on the server resulting in an info toast and polling on the task: handleSync was called 1`] = `
|
4
|
+
Array [
|
5
|
+
Array [
|
6
|
+
Object {
|
7
|
+
"payload": Object {
|
8
|
+
"message": Object {
|
9
|
+
"message": <Toast
|
10
|
+
disconnectHosts={2}
|
11
|
+
syncHosts={0}
|
12
|
+
/>,
|
13
|
+
"sticky": true,
|
14
|
+
"type": "success",
|
15
|
+
},
|
16
|
+
},
|
17
|
+
"type": "TOASTS_ADD",
|
18
|
+
},
|
19
|
+
],
|
20
|
+
Array [
|
21
|
+
Object {
|
22
|
+
"errorToast": [Function],
|
23
|
+
"interval": 3000,
|
24
|
+
"type": "API_GET",
|
25
|
+
"url": "/foreman_inventory_upload/tasks/1",
|
26
|
+
},
|
27
|
+
],
|
28
|
+
Array [
|
29
|
+
Object {
|
30
|
+
"payload": Object {
|
31
|
+
"message": Object {
|
32
|
+
"message": <span>
|
33
|
+
Inventory sync has started:
|
34
|
+
|
35
|
+
<a
|
36
|
+
href="/foreman_tasks/tasks/1"
|
37
|
+
rel="noopener noreferrer"
|
38
|
+
target="_blank"
|
39
|
+
>
|
40
|
+
view the task page for more details
|
41
|
+
</a>
|
42
|
+
</span>,
|
43
|
+
"sticky": false,
|
44
|
+
"type": "info",
|
45
|
+
},
|
46
|
+
},
|
47
|
+
"type": "TOASTS_ADD",
|
48
|
+
},
|
49
|
+
],
|
50
|
+
Array [
|
51
|
+
Object {
|
52
|
+
"errorToast": [Function],
|
53
|
+
"type": "API_POST",
|
54
|
+
"url": "/foreman_inventory_upload/tasks",
|
55
|
+
},
|
56
|
+
],
|
57
|
+
]
|
58
|
+
`;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { IntegrationTestHelper } from '@theforeman/test';
|
3
|
+
import * as API from 'foremanReact/redux/API';
|
4
|
+
import { noop } from 'foremanReact/common/helpers';
|
5
|
+
import SyncButton from '../index';
|
6
|
+
import { successResponse } from './SyncButtonFixtures';
|
7
|
+
import {
|
8
|
+
INVENTORY_SYNC,
|
9
|
+
INVENTORY_SYNC_TASK_UPDATE,
|
10
|
+
} from '../SyncButtonConstants';
|
11
|
+
|
12
|
+
jest.spyOn(API, 'post');
|
13
|
+
jest.spyOn(API, 'get');
|
14
|
+
|
15
|
+
describe('SyncButton integration test', () => {
|
16
|
+
it('Successful task was triggered on the server resulting in an info toast and polling on the task', async () => {
|
17
|
+
API.post.mockImplementation(({ handleSuccess = noop, key, ...action }) => {
|
18
|
+
if (key === INVENTORY_SYNC) {
|
19
|
+
handleSuccess(successResponse);
|
20
|
+
}
|
21
|
+
return { type: 'API_POST', ...action };
|
22
|
+
});
|
23
|
+
API.get.mockImplementation(({ handleSuccess = noop, key, ...action }) => {
|
24
|
+
if (key === INVENTORY_SYNC_TASK_UPDATE) {
|
25
|
+
handleSuccess(
|
26
|
+
{
|
27
|
+
data: {
|
28
|
+
endedAt: '2021-03-22T15:59:02.468+02:00',
|
29
|
+
output: {
|
30
|
+
host_statuses: {
|
31
|
+
sync: 0,
|
32
|
+
disconnect: 2,
|
33
|
+
},
|
34
|
+
},
|
35
|
+
result: 'success',
|
36
|
+
},
|
37
|
+
},
|
38
|
+
jest.fn
|
39
|
+
);
|
40
|
+
}
|
41
|
+
return { type: 'API_GET', ...action };
|
42
|
+
});
|
43
|
+
|
44
|
+
const integrationTestHelper = new IntegrationTestHelper();
|
45
|
+
const wrapper = integrationTestHelper.mount(<SyncButton />);
|
46
|
+
const instance = wrapper.find('SyncButton').instance();
|
47
|
+
instance.props.handleSync();
|
48
|
+
await IntegrationTestHelper.flushAllPromises();
|
49
|
+
integrationTestHelper.takeActionsSnapshot('handleSync was called');
|
50
|
+
});
|
51
|
+
});
|
@@ -2,21 +2,18 @@ import { bindActionCreators } from 'redux';
|
|
2
2
|
import { connect } from 'react-redux';
|
3
3
|
|
4
4
|
import * as actions from './SyncButtonActions';
|
5
|
-
import reducer from './SyncButtonReducer';
|
6
5
|
import SyncButton from './SyncButton';
|
7
6
|
import { selectCloudToken } from '../../../InventorySettings/InventorySettingsSelectors';
|
8
|
-
import {
|
7
|
+
import { selectTaskStatus } from './SyncButtonSelectors';
|
9
8
|
|
10
9
|
// map state to props
|
11
10
|
const mapStateToProps = state => ({
|
12
11
|
cloudToken: selectCloudToken(state),
|
13
|
-
status:
|
12
|
+
status: selectTaskStatus(state),
|
14
13
|
});
|
15
14
|
|
16
15
|
// map action dispatchers to props
|
17
16
|
const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
|
18
17
|
|
19
|
-
export const reducers = { inventorySync: reducer };
|
20
|
-
|
21
18
|
// export connected component
|
22
19
|
export default connect(mapStateToProps, mapDispatchToProps)(SyncButton);
|
@@ -2,13 +2,11 @@ import { combineReducers } from 'redux';
|
|
2
2
|
import { reducers as accountListReducers } from './Components/AccountList';
|
3
3
|
import { reducers as dashboardReducers } from './Components/Dashboard';
|
4
4
|
import { reducers as filterReducers } from './Components/InventoryFilter';
|
5
|
-
import { reducers as inventorySyncReducers } from './Components/PageHeader/components/SyncButton';
|
6
5
|
|
7
6
|
export default {
|
8
7
|
inventoryUpload: combineReducers({
|
9
8
|
...accountListReducers,
|
10
9
|
...dashboardReducers,
|
11
10
|
...filterReducers,
|
12
|
-
...inventorySyncReducers,
|
13
11
|
}),
|
14
12
|
};
|
@@ -61,6 +61,7 @@ exports[`InsightsTable rendering render with Props 1`] = `
|
|
61
61
|
expandId="expandable-toggle"
|
62
62
|
gridBreakPoint="grid-md"
|
63
63
|
isStickyHeader={false}
|
64
|
+
isTreeTable={false}
|
64
65
|
onSelect={[Function]}
|
65
66
|
onSort={[Function]}
|
66
67
|
ouiaSafe={true}
|
@@ -137,6 +138,7 @@ exports[`InsightsTable rendering render with Props 1`] = `
|
|
137
138
|
"currPage": "Current page",
|
138
139
|
"items": "",
|
139
140
|
"itemsPerPage": "Items per page",
|
141
|
+
"ofWord": "of",
|
140
142
|
"optionsToggle": "Items per page",
|
141
143
|
"page": "",
|
142
144
|
"paginationTitle": "Pagination",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_rh_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Red Hat Cloud team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katello
|
@@ -213,6 +213,8 @@ files:
|
|
213
213
|
- lib/insights_cloud/async/rules_result.rb
|
214
214
|
- lib/inventory_sync/async/host_result.rb
|
215
215
|
- lib/inventory_sync/async/inventory_full_sync.rb
|
216
|
+
- lib/inventory_sync/async/inventory_hosts_sync.rb
|
217
|
+
- lib/inventory_sync/async/query_inventory_job.rb
|
216
218
|
- lib/tasks/foreman_rh_cloud_tasks.rake
|
217
219
|
- lib/tasks/insights.rake
|
218
220
|
- lib/tasks/rh_cloud_inventory.rake
|
@@ -397,17 +399,14 @@ files:
|
|
397
399
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButton.js
|
398
400
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js
|
399
401
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonConstants.js
|
400
|
-
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js
|
401
402
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonSelectors.js
|
402
403
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButton.test.js
|
403
|
-
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonActions.test.js
|
404
404
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonFixtures.js
|
405
|
-
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonReducer.test.js
|
406
405
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonSelectors.test.js
|
407
406
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap
|
408
|
-
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonActions.test.js.snap
|
409
|
-
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonReducer.test.js.snap
|
410
407
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonSelectors.test.js.snap
|
408
|
+
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap
|
409
|
+
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js
|
411
410
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Modal.js
|
412
411
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js
|
413
412
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/modal.scss
|
@@ -588,6 +587,7 @@ files:
|
|
588
587
|
- webpack/__mocks__/foremanReact/redux/API/APISelectors.js
|
589
588
|
- webpack/__mocks__/foremanReact/redux/API/index.js
|
590
589
|
- webpack/__mocks__/foremanReact/redux/actions/toasts.js
|
590
|
+
- webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js
|
591
591
|
- webpack/__mocks__/foremanReact/routes/RouterSelector.js
|
592
592
|
- webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js
|
593
593
|
- webpack/__tests__/ForemanRhCloudHelpers.test.js
|
@@ -610,7 +610,7 @@ homepage: https://github.com/theforeman/foreman_rh_cloud
|
|
610
610
|
licenses:
|
611
611
|
- GPL-3.0
|
612
612
|
metadata: {}
|
613
|
-
post_install_message:
|
613
|
+
post_install_message:
|
614
614
|
rdoc_options: []
|
615
615
|
require_paths:
|
616
616
|
- lib
|
@@ -625,31 +625,31 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
625
625
|
- !ruby/object:Gem::Version
|
626
626
|
version: '0'
|
627
627
|
requirements: []
|
628
|
-
rubygems_version: 3.
|
629
|
-
signing_key:
|
628
|
+
rubygems_version: 3.1.4
|
629
|
+
signing_key:
|
630
630
|
specification_version: 4
|
631
631
|
summary: Summary of ForemanRhCloud.
|
632
632
|
test_files:
|
633
|
-
- test/controllers/uploads_controller_test.rb
|
634
|
-
- test/controllers/insights_sync/settings_controller_test.rb
|
635
633
|
- test/controllers/accounts_controller_test.rb
|
636
|
-
- test/controllers/uploads_settings_controller_test.rb
|
637
634
|
- test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
|
635
|
+
- test/controllers/insights_sync/settings_controller_test.rb
|
638
636
|
- test/controllers/reports_controller_test.rb
|
639
|
-
- test/
|
640
|
-
- test/
|
637
|
+
- test/controllers/uploads_controller_test.rb
|
638
|
+
- test/controllers/uploads_settings_controller_test.rb
|
639
|
+
- test/factories/insights_factories.rb
|
640
|
+
- test/factories/inventory_upload_factories.rb
|
641
641
|
- test/jobs/insights_full_sync_test.rb
|
642
642
|
- test/jobs/insights_rules_sync_test.rb
|
643
643
|
- test/jobs/inventory_full_sync_test.rb
|
644
|
-
- test/
|
645
|
-
- test/
|
646
|
-
- test/unit/
|
647
|
-
- test/unit/
|
648
|
-
- test/unit/metadata_generator_test.rb
|
644
|
+
- test/jobs/upload_report_job_test.rb
|
645
|
+
- test/test_plugin_helper.rb
|
646
|
+
- test/unit/archived_report_generator_test.rb
|
647
|
+
- test/unit/fact_helpers_test.rb
|
649
648
|
- test/unit/insights_facet_test.rb
|
650
|
-
- test/unit/
|
651
|
-
- test/unit/services/foreman_rh_cloud/branch_info_test.rb
|
649
|
+
- test/unit/metadata_generator_test.rb
|
652
650
|
- test/unit/rh_cloud_http_proxy_test.rb
|
653
|
-
- test/unit/
|
654
|
-
- test/unit/
|
651
|
+
- test/unit/services/foreman_rh_cloud/branch_info_test.rb
|
652
|
+
- test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb
|
653
|
+
- test/unit/shell_process_job_test.rb
|
655
654
|
- test/unit/slice_generator_test.rb
|
655
|
+
- test/unit/tags_generator_test.rb
|
data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
import Immutable from 'seamless-immutable';
|
2
|
-
import { STATUS } from 'foremanReact/constants';
|
3
|
-
import {
|
4
|
-
INVENTORY_SYNC_REQUEST,
|
5
|
-
INVENTORY_SYNC_SUCCESS,
|
6
|
-
INVENTORY_SYNC_ERROR,
|
7
|
-
} from './SyncButtonConstants';
|
8
|
-
|
9
|
-
export default (
|
10
|
-
state = Immutable({}),
|
11
|
-
{ type, payload: { syncHosts, disconnectHosts, error } = {} }
|
12
|
-
) => {
|
13
|
-
switch (type) {
|
14
|
-
case INVENTORY_SYNC_REQUEST:
|
15
|
-
return state.merge({
|
16
|
-
...state,
|
17
|
-
status: STATUS.PENDING,
|
18
|
-
error: null,
|
19
|
-
});
|
20
|
-
case INVENTORY_SYNC_SUCCESS:
|
21
|
-
return state.merge({
|
22
|
-
...state,
|
23
|
-
status: STATUS.RESOLVED,
|
24
|
-
syncHosts,
|
25
|
-
disconnectHosts,
|
26
|
-
});
|
27
|
-
case INVENTORY_SYNC_ERROR:
|
28
|
-
return state.merge({
|
29
|
-
...state,
|
30
|
-
status: STATUS.ERROR,
|
31
|
-
error,
|
32
|
-
});
|
33
|
-
default:
|
34
|
-
return state;
|
35
|
-
}
|
36
|
-
};
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { testActionSnapshotWithFixtures } from '@theforeman/test';
|
2
|
-
import { API } from 'foremanReact/redux/API';
|
3
|
-
import { handleSync } from '../SyncButtonActions';
|
4
|
-
import { successResponse } from './SyncButtonFixtures';
|
5
|
-
|
6
|
-
jest.mock('foremanReact/redux/API');
|
7
|
-
API.post.mockImplementation(async () => successResponse);
|
8
|
-
|
9
|
-
const fixtures = {
|
10
|
-
'should handleSync': () => handleSync(),
|
11
|
-
'should handleSync with error message': () => {
|
12
|
-
API.post.mockImplementationOnce(() =>
|
13
|
-
Promise.reject(new Error('Network error!'))
|
14
|
-
);
|
15
|
-
|
16
|
-
return handleSync();
|
17
|
-
},
|
18
|
-
'should handleSync with custom error message': () => {
|
19
|
-
API.post.mockImplementationOnce(() => {
|
20
|
-
const customError = new Error('Server error!');
|
21
|
-
customError.response = {
|
22
|
-
data: { message: 'Custom error to display in a toast' },
|
23
|
-
};
|
24
|
-
return Promise.reject(customError);
|
25
|
-
});
|
26
|
-
|
27
|
-
return handleSync();
|
28
|
-
},
|
29
|
-
};
|
30
|
-
|
31
|
-
describe('SyncButton actions', () => testActionSnapshotWithFixtures(fixtures));
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import { testReducerSnapshotWithFixtures } from '@theforeman/test';
|
2
|
-
import reducer from '../SyncButtonReducer';
|
3
|
-
import { syncHosts, disconnectHosts } from './SyncButtonFixtures';
|
4
|
-
import {
|
5
|
-
INVENTORY_SYNC_REQUEST,
|
6
|
-
INVENTORY_SYNC_SUCCESS,
|
7
|
-
} from '../SyncButtonConstants';
|
8
|
-
|
9
|
-
const fixtures = {
|
10
|
-
'should return the initial state': {},
|
11
|
-
'should handle INVENTORY_SYNC_REQUEST': {
|
12
|
-
action: {
|
13
|
-
type: INVENTORY_SYNC_REQUEST,
|
14
|
-
payload: {},
|
15
|
-
},
|
16
|
-
},
|
17
|
-
'should handle INVENTORY_SYNC_SUCCESS': {
|
18
|
-
action: {
|
19
|
-
type: INVENTORY_SYNC_SUCCESS,
|
20
|
-
payload: { syncHosts, disconnectHosts },
|
21
|
-
},
|
22
|
-
},
|
23
|
-
};
|
24
|
-
|
25
|
-
describe('AccountList reducer', () =>
|
26
|
-
testReducerSnapshotWithFixtures(reducer, fixtures));
|
@@ -1,98 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`SyncButton actions should handleSync 1`] = `
|
4
|
-
Array [
|
5
|
-
Array [
|
6
|
-
Object {
|
7
|
-
"payload": Object {},
|
8
|
-
"type": "INVENTORY_SYNC_REQUEST",
|
9
|
-
},
|
10
|
-
],
|
11
|
-
Array [
|
12
|
-
Object {
|
13
|
-
"payload": Object {
|
14
|
-
"disconnectHosts": 0,
|
15
|
-
"syncHosts": 1,
|
16
|
-
},
|
17
|
-
"type": "INVENTORY_SYNC_SUCCESS",
|
18
|
-
},
|
19
|
-
],
|
20
|
-
Array [
|
21
|
-
Object {
|
22
|
-
"payload": Object {
|
23
|
-
"message": Object {
|
24
|
-
"message": <Toast
|
25
|
-
disconnectHosts={0}
|
26
|
-
syncHosts={1}
|
27
|
-
/>,
|
28
|
-
"sticky": true,
|
29
|
-
"type": "success",
|
30
|
-
},
|
31
|
-
},
|
32
|
-
"type": "TOASTS_ADD",
|
33
|
-
},
|
34
|
-
],
|
35
|
-
]
|
36
|
-
`;
|
37
|
-
|
38
|
-
exports[`SyncButton actions should handleSync with custom error message 1`] = `
|
39
|
-
Array [
|
40
|
-
Array [
|
41
|
-
Object {
|
42
|
-
"payload": Object {},
|
43
|
-
"type": "INVENTORY_SYNC_REQUEST",
|
44
|
-
},
|
45
|
-
],
|
46
|
-
Array [
|
47
|
-
Object {
|
48
|
-
"payload": Object {
|
49
|
-
"error": "Server error!",
|
50
|
-
},
|
51
|
-
"type": "INVENTORY_SYNC_ERROR",
|
52
|
-
},
|
53
|
-
],
|
54
|
-
Array [
|
55
|
-
Object {
|
56
|
-
"payload": Object {
|
57
|
-
"message": Object {
|
58
|
-
"message": "Custom error to display in a toast",
|
59
|
-
"sticky": true,
|
60
|
-
"type": "error",
|
61
|
-
},
|
62
|
-
},
|
63
|
-
"type": "TOASTS_ADD",
|
64
|
-
},
|
65
|
-
],
|
66
|
-
]
|
67
|
-
`;
|
68
|
-
|
69
|
-
exports[`SyncButton actions should handleSync with error message 1`] = `
|
70
|
-
Array [
|
71
|
-
Array [
|
72
|
-
Object {
|
73
|
-
"payload": Object {},
|
74
|
-
"type": "INVENTORY_SYNC_REQUEST",
|
75
|
-
},
|
76
|
-
],
|
77
|
-
Array [
|
78
|
-
Object {
|
79
|
-
"payload": Object {
|
80
|
-
"error": "Network error!",
|
81
|
-
},
|
82
|
-
"type": "INVENTORY_SYNC_ERROR",
|
83
|
-
},
|
84
|
-
],
|
85
|
-
Array [
|
86
|
-
Object {
|
87
|
-
"payload": Object {
|
88
|
-
"message": Object {
|
89
|
-
"message": "Network error!",
|
90
|
-
"sticky": true,
|
91
|
-
"type": "error",
|
92
|
-
},
|
93
|
-
},
|
94
|
-
"type": "TOASTS_ADD",
|
95
|
-
},
|
96
|
-
],
|
97
|
-
]
|
98
|
-
`;
|