Skip to content

Commit 1307950

Browse files
Merge pull request #9979 from GilbertCherrie/delete_unused_dependencies
Delete unused packages
2 parents 9b9fdb6 + b2c1015 commit 1307950

8 files changed

Lines changed: 153 additions & 1333 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// TODO: Can be removed when we upgrade CodeMirror to version 6 after changing react-codemirror2 to react-codemirror
2+
// Mock Range.prototype methods for CodeMirror
3+
if (typeof Range !== 'undefined' && !Range.prototype.getBoundingClientRect) {
4+
Range.prototype.getBoundingClientRect = () => ({
5+
bottom: 0,
6+
height: 0,
7+
left: 0,
8+
right: 0,
9+
top: 0,
10+
width: 0,
11+
x: 0,
12+
y: 0,
13+
toJSON: () => {},
14+
});
15+
}
16+
17+
if (typeof Range !== 'undefined' && !Range.prototype.getClientRects) {
18+
Range.prototype.getClientRects = () => ({
19+
length: 0,
20+
item: () => null,
21+
});
22+
}

app/javascript/spec/helpers/mockAsyncRequest.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

app/javascript/spec/orchestration-template/orchestration-template-form.spec.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import '../helpers/miqFlashLater';
77
import '../helpers/miqSparkle';
88
import '../helpers/miqAjaxButton';
99
import '../helpers/sprintf';
10+
import '../helpers/codemirrorRangeMock';
1011
import { mount } from '../helpers/mountForm';
1112

1213
import OrcherstrationTemplateForm from '../../components/orchestration-template/orcherstration-template-form';
@@ -33,7 +34,7 @@ describe('OrcherstrationTemplate form', () => {
3334
addFlashSpy.mockRestore();
3435
});
3536

36-
it('should call submit function', async(done) => {
37+
it('should call submit function', async() => {
3738
fetchMock.postOnce('/api/orchestration_templates', {});
3839
let wrapper;
3940
await act(async() => {
@@ -58,10 +59,9 @@ describe('OrcherstrationTemplate form', () => {
5859
content: 'Some random content',
5960
}));
6061
expect(sparkleOnSpy).toHaveBeenCalledTimes(1);
61-
done();
6262
});
6363

64-
it('should call miqFlashLater on cancel action', async(done) => {
64+
it('should call miqFlashLater on cancel action', async() => {
6565
let wrapper;
6666
await act(async() => {
6767
wrapper = mount(<OrcherstrationTemplateForm {...initialProps} />);
@@ -77,10 +77,9 @@ describe('OrcherstrationTemplate form', () => {
7777
'success',
7878
'/catalog/explorer',
7979
);
80-
done();
8180
});
8281

83-
it('should render edit variant', async(done) => {
82+
it('should render edit variant', async() => {
8483
const sparkleOnSpy = jest.spyOn(window, 'miqSparkleOn');
8584
fetchMock.patchOnce('/api/orchestration_templates/123', {});
8685
fetchMock.getOnce('/api/orchestration_templates/123?attributes=name,description,type,ems_id,draft,content', {
@@ -104,10 +103,9 @@ describe('OrcherstrationTemplate form', () => {
104103
content: 'content',
105104
}));
106105
expect(sparkleOnSpy).toHaveBeenCalledTimes(1);
107-
done();
108106
});
109107

110-
it('should render copy variant', async(done) => {
108+
it('should render copy variant', async() => {
111109
const sparkleOnSpy = jest.spyOn(window, 'miqSparkleOn');
112110
fetchMock.postOnce('/api/orchestration_templates/123', {});
113111
fetchMock.getOnce('/api/orchestration_templates/123?attributes=name,description,type,ems_id,draft,content', {
@@ -141,7 +139,6 @@ describe('OrcherstrationTemplate form', () => {
141139
},
142140
}));
143141
expect(sparkleOnSpy).toHaveBeenCalledTimes(1);
144-
done();
145142
});
146143
});
147144

@@ -167,7 +164,7 @@ describe('Orcherstration Stack form', () => {
167164
spyMiqAjaxButton.mockRestore();
168165
});
169166

170-
it('should render copy variant', async(done) => {
167+
it('should render copy variant', async() => {
171168
const sparkleOnSpy = jest.spyOn(window, 'miqSparkleOn');
172169
fetchMock.postOnce('/api/orchestration_templates/123', {});
173170
fetchMock.getOnce('/api/orchestration_templates/123?attributes=name,description,type,ems_id,draft,content', {
@@ -195,10 +192,9 @@ describe('Orcherstration Stack form', () => {
195192
expect(fetchMock.lastCall()).toBeTruthy();
196193
expect(sparkleOnSpy).toHaveBeenCalledTimes(1);
197194
expect(wrapper).toMatchSnapshot();
198-
done();
199195
});
200196

201-
it('should call submit function', async(done) => {
197+
it('should call submit function', () => {
202198
const addContent = {
203199
templateId: 123,
204200
templateName: 'template_name',
@@ -209,16 +205,14 @@ describe('Orcherstration Stack form', () => {
209205

210206
miqAjaxButton(`/orchestration_stack/stacks_ot_copy?button=add`, addContent);
211207
expect(spyMiqAjaxButton).toHaveBeenCalledWith('/orchestration_stack/stacks_ot_copy?button=add', addContent);
212-
done();
213208
});
214209

215-
it('should call cancel function', async(done) => {
210+
it('should call cancel function', () => {
216211
const cancelMessage = __('Copy of Orchestration Template was cancelled by the user');
217212
miqRedirectBack(cancelMessage, 'success', `/orchestration_stack/show/${123}?display=stack_orchestration_template#/`);
218213

219214
expect(miqRedirectBack).toHaveBeenCalledWith(
220215
cancelMessage, 'success', `/orchestration_stack/show/${123}?display=stack_orchestration_template#/`
221216
);
222-
done();
223217
});
224218
});

app/javascript/spec/pxe-customization-template-form/pxe-customization-template-form.spec.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import fetchMock from 'fetch-mock';
44

55
import { act } from 'react-dom/test-utils';
66
import '../helpers/miqSparkle';
7+
import '../helpers/codemirrorRangeMock';
78
import { mount } from '../helpers/mountForm';
89
import PxeCustomizationTemplateForm from '../../components/pxe-customization-template-form/index';
910

1011
describe('Pxe Customization Template Form Component', () => {
11-
1212
const api = {
1313
resources: [
1414
{
@@ -35,44 +35,41 @@ describe('Pxe Customization Template Form Component', () => {
3535
fetchMock.restore();
3636
});
3737

38-
it('should render adding a new pxe customization template', async (done) => {
38+
it('should render adding a new pxe customization template', async() => {
3939
fetchMock.get('/api/pxe_image_types?attributes=name,id&expand=resources', api);
4040
let wrapper;
4141

42-
await act(async () => {
42+
await act(async() => {
4343
wrapper = mount(<PxeCustomizationTemplateForm />);
4444
});
4545
wrapper.update();
4646
expect(fetchMock.calls()).toHaveLength(2);
4747
expect(toJson(wrapper)).toMatchSnapshot();
48-
done();
4948
});
5049

51-
it('should render editing a pxe customization template', async (done) => {
50+
it('should render editing a pxe customization template', async() => {
5251
fetchMock.get('/api/pxe_image_types?attributes=name,id&expand=resources', api);
5352
fetchMock.get('/api/customization_templates/1', editOrCopyObject);
5453
let wrapper;
5554

56-
await act(async () => {
55+
await act(async() => {
5756
wrapper = mount(<PxeCustomizationTemplateForm recordId="1" />);
5857
});
5958
wrapper.update();
6059
expect(fetchMock.calls()).toHaveLength(3);
6160
expect(toJson(wrapper)).toMatchSnapshot();
62-
done();
6361
});
6462

65-
it('should render copying a pxe customization template', async (done) => {
63+
it('should render copying a pxe customization template', async() => {
6664
fetchMock.get('/api/pxe_image_types?attributes=name,id&expand=resources', api);
6765
fetchMock.get('/api/customization_templates/1', editOrCopyObject);
6866
let wrapper;
6967

70-
await act(async () => {
68+
await act(async() => {
7169
wrapper = mount(<PxeCustomizationTemplateForm copy="1" />);
7270
});
7371
wrapper.update();
7472
expect(fetchMock.calls()).toHaveLength(3);
7573
expect(toJson(wrapper)).toMatchSnapshot();
76-
done();
7774
});
7875
});

app/javascript/spec/report-data-table.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { mount } from 'enzyme';
33
import fetchMock from 'fetch-mock';
44
import { act } from 'react-dom/test-utils';
55

6-
import './helpers/mockAsyncRequest';
76
import './helpers/miqSparkle';
87

98
import ReportDataTable from '../components/data-tables/report-data-table/report-data-table';

config/webpack/shared.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@ module.exports = {
121121
}, {}
122122
),
123123
'shims': [
124-
'es6-shim',
125-
'array-includes',
126-
'whatwg-fetch',
127124
'core-js/stable',
128125
'regenerator-runtime/runtime',
129126
],

package.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,15 @@
5353
"angular-patternfly": "~3.26.0",
5454
"angular-ui-bootstrap": "~2.5.6",
5555
"angular-ui-sortable": "~0.19.0",
56-
"array-includes": "^3.1.9",
5756
"awesome-debounce-promise": "^2.1.0",
5857
"bootstrap-filestyle": "~1.2.1",
5958
"bootstrap-select": "^1.13.18",
6059
"bootstrap-switch": "3.3.4",
6160
"classnames": "~2.5.0",
6261
"codemirror": "~5.65.0",
6362
"connected-react-router": "~6.9.0",
64-
"create-react-context": "~0.3.0",
6563
"d3": "^7.8.2",
6664
"dompurify": "^3.3.2",
67-
"es6-shim": "~0.35.8",
6865
"history": "^4.7.2",
6966
"jquery": "~2.2.4",
7067
"jquery-ui": "~1.14.0",
@@ -99,8 +96,6 @@
9996
"spice-html5-bower": "~1.7.3",
10097
"spin.js": "~4.1.0",
10198
"sprintf-js": "~1.1.1",
102-
"table-resolver": "^4.1.1",
103-
"ui-select": "0.19.8",
10499
"whatwg-fetch": "~3.6.20",
105100
"xml_display": "~0.1.1"
106101
},
@@ -142,7 +137,6 @@
142137
"imports-loader": "~0.8.0",
143138
"jasmine-jquery": "~2.1.1",
144139
"jest": "~26.6.3",
145-
"jest-cli": "^25.5.3",
146140
"js-yaml": "~3.14.0",
147141
"ng-annotate-loader": "~0.7.0",
148142
"node-fetch": "~2.7.0",

0 commit comments

Comments
 (0)