webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js in katello-4.4.2.2 vs webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js in katello-4.5.0.rc1
- old
+ new
@@ -1,8 +1,8 @@
/* eslint-disable no-useless-escape */
import React from 'react';
-import { renderWithRedux, patientlyWaitFor, fireEvent } from 'react-testing-lib-wrapper';
+import { renderWithRedux, patientlyWaitFor, fireEvent, act } from 'react-testing-lib-wrapper';
import api, { foremanApi } from '../../../../services/api';
import nock, {
nockInstance, assertNockRequest, mockAutocomplete, mockSetting, mockForemanAutocomplete,
} from '../../../../test-utils/nockWrapper';
import CONTENT_VIEWS_KEY from '../../ContentViewsConstants';
@@ -14,27 +14,31 @@
import affectedActivationKeysData from '../../Details/Versions/Delete/__tests__/cvAffectedActivationKeys.fixture.json';
import affectedHostData from './affectedHosts.fixtures.json';
import cVDropDownOptionsData from '../../Details/Versions/Delete/__tests__/cvDropDownOptionsResponse.fixture.json';
import cvDeleteResponse from '../../Details/Versions/Delete/__tests__/cvVersionRemoveResponse.fixture.json';
-const cvIndexPath = api.getApiUrl('/content_views?organization_id=1&nondefault=true&include_permissions=true&per_page=20&page=1');
+const cvIndexPath = api.getApiUrl('/content_views');
const autocompleteUrl = '/content_views/auto_complete_search';
const renderOptions = { apiNamespace: CONTENT_VIEWS_KEY };
const environmentPathsPath = api.getApiUrl('/organizations/1/environments/paths');
-
const cvVersionsPath = api.getApiUrl('/content_view_versions');
-
const cvDetailsPath = api.getApiUrl('/content_views/20');
-
const activationKeyURL = api.getApiUrl('/activation_keys');
-
const hostURL = foremanApi.getApiUrl('/hosts');
-
const cVDropDownOptionsPath = api.getApiUrl('/content_views?organization_id=1&environment_id=9&include_default=true&include_permissions=true&full_result=true');
-
const cvDeleteUrl = api.getApiUrl('/content_views/20/remove');
+const baseQuery = {
+ organization_id: 1,
+ nondefault: true,
+ include_permissions: true,
+ per_page: 20,
+ page: 1,
+ sort_by: 'name',
+ sort_order: 'asc',
+};
+
let scopeBookmark;
let firstCV;
let searchDelayScope;
let autoSearchScope;
beforeEach(() => {
@@ -56,10 +60,11 @@
test('Can call API for CVs and show Delete Wizard for the row', async (done) => {
const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
const scope = nockInstance
.get(cvIndexPath)
+ .query(baseQuery)
.reply(200, cvIndexData);
const envPathDeleteScope = nockInstance
.get(environmentPathsPath)
.query(true)
@@ -108,10 +113,11 @@
const autocompleteScope = mockAutocomplete(nockInstance, autocompleteUrl);
const scope = nockInstance
.get(cvIndexPath)
+ .query(true)
.reply(200, cvIndexData);
const envPathDeleteScope = nockInstance
.get(environmentPathsPath)
.query(true)
@@ -241,6 +247,7 @@
assertNockRequest(akAutoSearchScope);
assertNockRequest(activationKeysScope);
assertNockRequest(cVDropDownOptionsScope);
assertNockRequest(cvDeleteScope);
assertNockRequest(cvRedirectScope, done);
+ act(done);
});