Skip to content

Commit

Permalink
test(test-in-node): fix npm script
Browse files Browse the repository at this point in the history
Refs #2710
  • Loading branch information
char0n committed Jul 29, 2021
1 parent fecc89c commit f83bf3d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion test/mocha/plugins/editor/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import expect, { createSpy } from "expect"
import rewiremock from "rewiremock"
import Enzyme, { shallow } from "enzyme"
import Adapter from "enzyme-adapter-react-15"
import Adapter from "@wojtekmaj/enzyme-adapter-react-17"
import React from "react"
import FakeAce from "test/mocha/mocks/ace.js"
import { fromJS } from "immutable"
Expand Down
2 changes: 1 addition & 1 deletion test/unit/plugins/editor/editor.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import rewiremock from 'rewiremock';
import Enzyme, { shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
import React from 'react';
import FakeAce, { Session } from 'test/unit/mocks/ace.js';
import { fromJS } from 'immutable';
Expand Down
8 changes: 4 additions & 4 deletions test/unit/standalone/topbar-insert/form-data-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { fromJS } from 'immutable';
import React from 'react';
import { configure, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
import AddForm from 'src/standalone/topbar-insert/forms/components/AddForm';
import FormChild from 'src/standalone/topbar-insert/forms/components/FormChild';
import FormDropdown from 'src/standalone/topbar-insert/forms/components/FormDropdown';
Expand Down Expand Up @@ -36,7 +36,7 @@ describe('editor topbar insert form UI generation', () => {
};
});

it('should produce a valid form UI for a simple form object', () => {
it('should produce a valid form UI for a simple form object', () => {
const form = fromJS({
fielda: {
value: 'test value',
Expand Down Expand Up @@ -77,7 +77,7 @@ describe('editor topbar insert form UI generation', () => {
updateForm: newForm => updateForm(newForm, path.concat(['listItem']))
}
});

let path = [];

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

expect(wrapper.find('select').length).toEqual(2);
});
});
});
62 changes: 31 additions & 31 deletions test/unit/standalone/topbar-insert/form-objects.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import React from 'react';
import { configure, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
import { fromJS, List } from 'immutable';

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

describe('operation object', () => {
let form = operationForm(null, []);

const tag = form.getIn(['tags', 'defaultItem'])(null, []);

form = form
Expand All @@ -64,12 +64,12 @@ describe('editor topbar insert forms', () => {
.setIn(['description', 'value'], 'test description')
.setIn(['operationid', 'value'], 'testid')
.setIn(['tags', 'value'], new List([tag.setIn(['tag', 'value'], 'test tag' )]));

const object = operationObject(form);

it(
'should correctly process the operation form into the operation object',
() => {
() => {
const expected = {
summary: 'test summary',
description: 'test description',
Expand All @@ -81,15 +81,15 @@ describe('editor topbar insert forms', () => {
}
}
};

expect(object).toEqual(expected);
}
);

it('should correctly render the form UI for the form object', () => {
const element = <InsertForm {...props} formData={form} />;
const wrapper = mount(element);

expect(wrapper.find('input').length).toEqual(4);
expect(wrapper.find('select').length).toEqual(2);
});
Expand All @@ -99,7 +99,7 @@ describe('editor topbar insert forms', () => {
const license = licenseForm(null, [], null)
.setIn(['value', 'name', 'value'], 'test name')
.setIn(['value', 'url', 'value'], 'test url');

const contact = contactForm(null, [])
.setIn(['value', 'name', 'value'], 'test name')
.setIn(['value', 'url', 'value'], 'test url')
Expand All @@ -115,9 +115,9 @@ describe('editor topbar insert forms', () => {

it(
'should correctly process the info form into the info object',
() => {
() => {
const object = infoObject(form);

const expected = {
title: 'test title',
version: 'test version',
Expand All @@ -133,15 +133,15 @@ describe('editor topbar insert forms', () => {
email: 'testemail@test.com'
}
};

expect(object).toEqual(expected);
}
);

it('should correctly render the form UI for the form object', () => {
const element = <InsertForm {...props} formData={form} />;
const wrapper = mount(element);

expect(wrapper.find('input').length).toEqual(4);
});
});
Expand All @@ -155,7 +155,7 @@ describe('editor topbar insert forms', () => {
.setIn(['summary', 'value'], 'test summary')
.setIn(['description', 'value'], 'test description');

it('should correctly process the path form into the path object', () => {
it('should correctly process the path form into the path object', () => {
const object = pathObject(form);
const expected = {
key: '/test',
Expand All @@ -170,18 +170,18 @@ describe('editor topbar insert forms', () => {
it('should correctly render the form UI for the form object', () => {
const element = <InsertForm {...props} formData={form} />;
const wrapper = mount(element);

expect(wrapper.find('input').length).toEqual(3);
});
});

describe('tag declarations object', () => {
let form = tagsForm(null, []);

const externalDocs = externalDocumentationForm(null, [])
.setIn(['url', 'value'], 'test url')
.setIn(['description', 'value'], 'test description');

const tag = tagForm(null, [])
.setIn(['name', 'value'], 'test tag name')
.setIn(['description', 'value'], 'test description')
Expand All @@ -206,12 +206,12 @@ describe('editor topbar insert forms', () => {
];
expect(object).toEqual(expected);
}
);
);

it('should correctly render the form UI for the form object', () => {
const element = <InsertForm {...props} formData={form} />;
const wrapper = mount(element);

expect(wrapper.find('input').length).toEqual(2);
});
});
Expand All @@ -231,7 +231,7 @@ describe('editor topbar insert forms', () => {

it(
'should correctly process the servers form into the servers object',
() => {
() => {
const object = serversObject(form);
const expected = [
{
Expand All @@ -248,15 +248,15 @@ describe('editor topbar insert forms', () => {
}
}
];

expect(object).toEqual(expected);
}
);

it('should correctly render the form UI for the form object', () => {
const element = <InsertForm {...props} formData={form} />;
const wrapper = mount(element);

expect(wrapper.find('input').length).toEqual(6);
});
});
Expand All @@ -265,31 +265,31 @@ describe('editor topbar insert forms', () => {
const selectOperation = selectOperationForm(null, [])
.setIn(['path', 'value'], '/test')
.setIn(['operation', 'value'], 'GET');

let form = addOperationTagsForm(null, [])
.setIn(['selectoperation', 'value'], selectOperation)
.setIn(['tags', 'value', 0, 'tag', 'value'], 'test tag');

it(
'should correctly process the add tags to operation into the add tags object',
() => {
() => {
const object = addOperationTagsObject(form);

const expected = {
selectedOperation: ['paths', '/test', 'GET'],
tags: [
'test tag'
]
};

expect(object).toEqual(expected);
}
);

it('should correctly render the form UI for the form object', () => {
const element = <InsertForm {...props} formData={form} />;
const wrapper = mount(element);

expect(wrapper.find('input').length).toEqual(1);
expect(wrapper.find('select').length).toEqual(2);
});
Expand All @@ -301,31 +301,31 @@ describe('editor topbar insert forms', () => {
.setIn(['operation', 'value'], 'GET')
.setIn(['response', 'value'], '200')
.setIn(['mediatype', 'value'], 'application/json');

let form = exampleForm(null, [])
.setIn(['selectresponse', 'value'], selectResponse)
.setIn(['exampleName', 'value'], 'sample example name')
.setIn(['exampleValue', 'value'], 'sample example value');

it(
'should correctly process the add example form into the form values object',
() => {
() => {
const object = exampleObject(form);

const expected = {
responsePath: ['paths', '/test', 'GET', 'responses', '200', 'content', 'application/json', 'examples'],
exampleValue: 'sample example value',
exampleName: 'sample example name'
};

expect(object).toEqual(expected);
}
);

it('should correctly render the form UI for the form object', () => {
const element = <InsertForm {...props} formData={form} />;
const wrapper = mount(element);

expect(wrapper.find('input').length).toEqual(1);
expect(wrapper.find('select').length).toEqual(4);
});
Expand Down
6 changes: 3 additions & 3 deletions test/unit/standalone/topbar-insert/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SwaggerUi from 'swagger-ui';
import insertPlugin from 'src/standalone/topbar-insert';
import { fromJS } from 'immutable';
import { configure, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';

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

Expand Down Expand Up @@ -48,7 +48,7 @@ function getSystem(spec) {
})
]
});

resolve(system);
});
}
Expand All @@ -71,7 +71,7 @@ describe('editor topbar insert menu plugin', () => {
expect(wrapper.find('.menu-item').length).toEqual(1);
}
);

it('should correctly update the spec when addToSpec is called', async () => {
const spec = {
'openapi': '3.0.0',
Expand Down

0 comments on commit f83bf3d

Please sign in to comment.