Skip to content

Commit d57eb8b

Browse files
committed
test(test-in-node): fix npm script
Refs #2710
1 parent ce1dd93 commit d57eb8b

File tree

5 files changed

+40
-40
lines changed

5 files changed

+40
-40
lines changed

test/mocha/plugins/editor/editor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import expect, { createSpy } from "expect"
22
import rewiremock from "rewiremock"
33
import Enzyme, { shallow } from "enzyme"
4-
import Adapter from "enzyme-adapter-react-15"
4+
import Adapter from "@wojtekmaj/enzyme-adapter-react-17"
55
import React from "react"
66
import FakeAce from "test/mocha/mocks/ace.js"
77
import { fromJS } from "immutable"

test/unit/plugins/editor/editor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import rewiremock from 'rewiremock';
22
import Enzyme, { shallow } from 'enzyme';
3-
import Adapter from 'enzyme-adapter-react-15';
3+
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
44
import React from 'react';
55
import FakeAce, { Session } from 'test/unit/mocks/ace.js';
66
import { fromJS } from 'immutable';

test/unit/standalone/topbar-insert/form-data-helpers.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { fromJS } from 'immutable';
33
import React from 'react';
44
import { configure, mount } from 'enzyme';
5-
import Adapter from 'enzyme-adapter-react-15';
5+
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
66
import AddForm from 'src/standalone/topbar-insert/forms/components/AddForm';
77
import FormChild from 'src/standalone/topbar-insert/forms/components/FormChild';
88
import FormDropdown from 'src/standalone/topbar-insert/forms/components/FormDropdown';
@@ -36,7 +36,7 @@ describe('editor topbar insert form UI generation', () => {
3636
};
3737
});
3838

39-
it('should produce a valid form UI for a simple form object', () => {
39+
it('should produce a valid form UI for a simple form object', () => {
4040
const form = fromJS({
4141
fielda: {
4242
value: 'test value',
@@ -77,7 +77,7 @@ describe('editor topbar insert form UI generation', () => {
7777
updateForm: newForm => updateForm(newForm, path.concat(['listItem']))
7878
}
7979
});
80-
80+
8181
let path = [];
8282

8383
const form = fromJS({
@@ -175,4 +175,4 @@ describe('editor topbar insert form UI generation', () => {
175175

176176
expect(wrapper.find('select').length).toEqual(2);
177177
});
178-
});
178+
});

test/unit/standalone/topbar-insert/form-objects.js

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
import React from 'react';
33
import { configure, mount } from 'enzyme';
4-
import Adapter from 'enzyme-adapter-react-15';
4+
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
55
import { fromJS, List } from 'immutable';
66

77
import AddForm from 'src/standalone/topbar-insert/forms/components/AddForm';
@@ -55,7 +55,7 @@ describe('editor topbar insert forms', () => {
5555

5656
describe('operation object', () => {
5757
let form = operationForm(null, []);
58-
58+
5959
const tag = form.getIn(['tags', 'defaultItem'])(null, []);
6060

6161
form = form
@@ -64,12 +64,12 @@ describe('editor topbar insert forms', () => {
6464
.setIn(['description', 'value'], 'test description')
6565
.setIn(['operationid', 'value'], 'testid')
6666
.setIn(['tags', 'value'], new List([tag.setIn(['tag', 'value'], 'test tag' )]));
67-
67+
6868
const object = operationObject(form);
6969

7070
it(
7171
'should correctly process the operation form into the operation object',
72-
() => {
72+
() => {
7373
const expected = {
7474
summary: 'test summary',
7575
description: 'test description',
@@ -81,15 +81,15 @@ describe('editor topbar insert forms', () => {
8181
}
8282
}
8383
};
84-
84+
8585
expect(object).toEqual(expected);
8686
}
8787
);
88-
88+
8989
it('should correctly render the form UI for the form object', () => {
9090
const element = <InsertForm {...props} formData={form} />;
9191
const wrapper = mount(element);
92-
92+
9393
expect(wrapper.find('input').length).toEqual(4);
9494
expect(wrapper.find('select').length).toEqual(2);
9595
});
@@ -99,7 +99,7 @@ describe('editor topbar insert forms', () => {
9999
const license = licenseForm(null, [], null)
100100
.setIn(['value', 'name', 'value'], 'test name')
101101
.setIn(['value', 'url', 'value'], 'test url');
102-
102+
103103
const contact = contactForm(null, [])
104104
.setIn(['value', 'name', 'value'], 'test name')
105105
.setIn(['value', 'url', 'value'], 'test url')
@@ -115,9 +115,9 @@ describe('editor topbar insert forms', () => {
115115

116116
it(
117117
'should correctly process the info form into the info object',
118-
() => {
118+
() => {
119119
const object = infoObject(form);
120-
120+
121121
const expected = {
122122
title: 'test title',
123123
version: 'test version',
@@ -133,15 +133,15 @@ describe('editor topbar insert forms', () => {
133133
email: 'testemail@test.com'
134134
}
135135
};
136-
136+
137137
expect(object).toEqual(expected);
138138
}
139139
);
140140

141141
it('should correctly render the form UI for the form object', () => {
142142
const element = <InsertForm {...props} formData={form} />;
143143
const wrapper = mount(element);
144-
144+
145145
expect(wrapper.find('input').length).toEqual(4);
146146
});
147147
});
@@ -155,7 +155,7 @@ describe('editor topbar insert forms', () => {
155155
.setIn(['summary', 'value'], 'test summary')
156156
.setIn(['description', 'value'], 'test description');
157157

158-
it('should correctly process the path form into the path object', () => {
158+
it('should correctly process the path form into the path object', () => {
159159
const object = pathObject(form);
160160
const expected = {
161161
key: '/test',
@@ -170,18 +170,18 @@ describe('editor topbar insert forms', () => {
170170
it('should correctly render the form UI for the form object', () => {
171171
const element = <InsertForm {...props} formData={form} />;
172172
const wrapper = mount(element);
173-
173+
174174
expect(wrapper.find('input').length).toEqual(3);
175175
});
176176
});
177177

178178
describe('tag declarations object', () => {
179179
let form = tagsForm(null, []);
180-
180+
181181
const externalDocs = externalDocumentationForm(null, [])
182182
.setIn(['url', 'value'], 'test url')
183183
.setIn(['description', 'value'], 'test description');
184-
184+
185185
const tag = tagForm(null, [])
186186
.setIn(['name', 'value'], 'test tag name')
187187
.setIn(['description', 'value'], 'test description')
@@ -206,12 +206,12 @@ describe('editor topbar insert forms', () => {
206206
];
207207
expect(object).toEqual(expected);
208208
}
209-
);
209+
);
210210

211211
it('should correctly render the form UI for the form object', () => {
212212
const element = <InsertForm {...props} formData={form} />;
213213
const wrapper = mount(element);
214-
214+
215215
expect(wrapper.find('input').length).toEqual(2);
216216
});
217217
});
@@ -231,7 +231,7 @@ describe('editor topbar insert forms', () => {
231231

232232
it(
233233
'should correctly process the servers form into the servers object',
234-
() => {
234+
() => {
235235
const object = serversObject(form);
236236
const expected = [
237237
{
@@ -248,15 +248,15 @@ describe('editor topbar insert forms', () => {
248248
}
249249
}
250250
];
251-
251+
252252
expect(object).toEqual(expected);
253253
}
254254
);
255255

256256
it('should correctly render the form UI for the form object', () => {
257257
const element = <InsertForm {...props} formData={form} />;
258258
const wrapper = mount(element);
259-
259+
260260
expect(wrapper.find('input').length).toEqual(6);
261261
});
262262
});
@@ -265,31 +265,31 @@ describe('editor topbar insert forms', () => {
265265
const selectOperation = selectOperationForm(null, [])
266266
.setIn(['path', 'value'], '/test')
267267
.setIn(['operation', 'value'], 'GET');
268-
268+
269269
let form = addOperationTagsForm(null, [])
270270
.setIn(['selectoperation', 'value'], selectOperation)
271271
.setIn(['tags', 'value', 0, 'tag', 'value'], 'test tag');
272272

273273
it(
274274
'should correctly process the add tags to operation into the add tags object',
275-
() => {
275+
() => {
276276
const object = addOperationTagsObject(form);
277-
277+
278278
const expected = {
279279
selectedOperation: ['paths', '/test', 'GET'],
280280
tags: [
281281
'test tag'
282282
]
283283
};
284-
284+
285285
expect(object).toEqual(expected);
286286
}
287287
);
288288

289289
it('should correctly render the form UI for the form object', () => {
290290
const element = <InsertForm {...props} formData={form} />;
291291
const wrapper = mount(element);
292-
292+
293293
expect(wrapper.find('input').length).toEqual(1);
294294
expect(wrapper.find('select').length).toEqual(2);
295295
});
@@ -301,31 +301,31 @@ describe('editor topbar insert forms', () => {
301301
.setIn(['operation', 'value'], 'GET')
302302
.setIn(['response', 'value'], '200')
303303
.setIn(['mediatype', 'value'], 'application/json');
304-
304+
305305
let form = exampleForm(null, [])
306306
.setIn(['selectresponse', 'value'], selectResponse)
307307
.setIn(['exampleName', 'value'], 'sample example name')
308308
.setIn(['exampleValue', 'value'], 'sample example value');
309309

310310
it(
311311
'should correctly process the add example form into the form values object',
312-
() => {
312+
() => {
313313
const object = exampleObject(form);
314-
314+
315315
const expected = {
316316
responsePath: ['paths', '/test', 'GET', 'responses', '200', 'content', 'application/json', 'examples'],
317317
exampleValue: 'sample example value',
318318
exampleName: 'sample example name'
319319
};
320-
320+
321321
expect(object).toEqual(expected);
322322
}
323323
);
324324

325325
it('should correctly render the form UI for the form object', () => {
326326
const element = <InsertForm {...props} formData={form} />;
327327
const wrapper = mount(element);
328-
328+
329329
expect(wrapper.find('input').length).toEqual(1);
330330
expect(wrapper.find('select').length).toEqual(4);
331331
});

test/unit/standalone/topbar-insert/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import SwaggerUi from 'swagger-ui';
44
import insertPlugin from 'src/standalone/topbar-insert';
55
import { fromJS } from 'immutable';
66
import { configure, mount } from 'enzyme';
7-
import Adapter from 'enzyme-adapter-react-15';
7+
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
88

99
configure({ adapter: new Adapter() });
1010

@@ -48,7 +48,7 @@ function getSystem(spec) {
4848
})
4949
]
5050
});
51-
51+
5252
resolve(system);
5353
});
5454
}
@@ -71,7 +71,7 @@ describe('editor topbar insert menu plugin', () => {
7171
expect(wrapper.find('.menu-item').length).toEqual(1);
7272
}
7373
);
74-
74+
7575
it('should correctly update the spec when addToSpec is called', async () => {
7676
const spec = {
7777
'openapi': '3.0.0',

0 commit comments

Comments
 (0)