Skip to content

Commit

Permalink
test(test:unit-jest): fix npm script
Browse files Browse the repository at this point in the history
Refs #2710
  • Loading branch information
char0n committed Jun 25, 2021
1 parent 4894340 commit 37b7530
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 30 deletions.
19 changes: 10 additions & 9 deletions test/unit/plugins/editor-metadata/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import SwaggerUi from 'swagger-ui';
import SwaggerUI from 'swagger-ui';
import EditorMetadataPlugin from 'plugins/editor-metadata';

function getSystem(spec) {
return new Promise((resolve) => {
const system = SwaggerUi({
const system = SwaggerUI({
spec,
domNode: null,
presets: [
SwaggerUi.plugins.SpecIndex,
SwaggerUi.plugins.ErrIndex,
SwaggerUi.plugins.DownloadUrl,
SwaggerUi.plugins.SwaggerJsIndex,
SwaggerUI.plugins.SpecIndex,
SwaggerUI.plugins.ErrIndex,
SwaggerUI.plugins.DownloadUrl,
SwaggerUI.plugins.SwaggerJsIndex,
SwaggerUI.plugins.RequestSnippetsIndex,
],
initialState: {
layout: undefined
Expand All @@ -32,7 +33,7 @@ function getSystem(spec) {
})
]
});

resolve(system);
});
}
Expand Down Expand Up @@ -109,7 +110,7 @@ describe('editor metadata plugin', () => {
});
}
);

it('should return isValid for a valid spec', async () => {
const spec = {
swagger: '2.0',
Expand All @@ -133,7 +134,7 @@ describe('editor metadata plugin', () => {
expect(system.getEditorMetadata().isValid).toBe(true);
});


it('should return isValid for an invalid spec', async () => {
const spec = {
swagger: '2.0',
Expand Down
13 changes: 7 additions & 6 deletions test/unit/plugins/selectors.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import SwaggerUi from 'swagger-ui';
import SwaggerUI from 'swagger-ui';
import ValidateBasePlugin from 'plugins/validate-base';
import ValidateSemanticPlugin from 'plugins/validate-semantic';
import ASTPlugin from 'plugins/ast';

function getSystem(spec) {
return new Promise((resolve) => {
const system = SwaggerUi({
const system = SwaggerUI({
spec,
domNode: null,
presets: [
SwaggerUi.plugins.SpecIndex,
SwaggerUi.plugins.ErrIndex,
SwaggerUi.plugins.DownloadUrl,
SwaggerUi.plugins.SwaggerJsIndex,
SwaggerUI.plugins.SpecIndex,
SwaggerUI.plugins.ErrIndex,
SwaggerUI.plugins.DownloadUrl,
SwaggerUI.plugins.SwaggerJsIndex,
SwaggerUI.plugins.RequestSnippetsIndex,
],
initialState: {
layout: undefined
Expand Down
16 changes: 8 additions & 8 deletions test/unit/plugins/validate-semantic/validate-helper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

import SwaggerUi from 'swagger-ui';
import SwaggerUI from 'swagger-ui';
import debounce from 'lodash/debounce';

import ValidateBasePlugin from 'plugins/validate-base';
Expand All @@ -12,15 +11,16 @@ const DELAY_MS = (typeof envDelay === 'string' ? parseInt(envDelay) : envDelay)

export default function validateHelper(spec) {
return new Promise((resolve) => {
const system = SwaggerUi({
const system = SwaggerUI({
spec,
domNode: null,
presets: [
SwaggerUi.plugins.SpecIndex,
SwaggerUi.plugins.ErrIndex,
SwaggerUi.plugins.DownloadUrl,
SwaggerUi.plugins.SwaggerJsIndex,
SwaggerUi.plugins.Oas3Index
SwaggerUI.plugins.SpecIndex,
SwaggerUI.plugins.ErrIndex,
SwaggerUI.plugins.DownloadUrl,
SwaggerUI.plugins.SwaggerJsIndex,
SwaggerUI.plugins.Oas3Index,
SwaggerUI.plugins.RequestSnippetsIndex,
],
initialState: {
layout: undefined
Expand Down
14 changes: 7 additions & 7 deletions test/unit/standalone/topbar-insert/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

import React from 'react';
import SwaggerUi from 'swagger-ui';
import SwaggerUI from 'swagger-ui';
import insertPlugin from 'src/standalone/topbar-insert';
import { fromJS } from 'immutable';
import { configure, mount } from 'enzyme';
Expand All @@ -10,14 +9,15 @@ configure({ adapter: new Adapter() });

function getSystem(spec) {
return new Promise((resolve) => {
const system = SwaggerUi({
const system = SwaggerUI({
spec,
domNode: null,
presets: [
SwaggerUi.plugins.SpecIndex,
SwaggerUi.plugins.ErrIndex,
SwaggerUi.plugins.DownloadUrl,
SwaggerUi.plugins.SwaggerJsIndex,
SwaggerUI.plugins.SpecIndex,
SwaggerUI.plugins.ErrIndex,
SwaggerUI.plugins.DownloadUrl,
SwaggerUI.plugins.SwaggerJsIndex,
SwaggerUI.plugins.RequestSnippetsIndex,
],
initialState: {
layout: undefined
Expand Down

0 comments on commit 37b7530

Please sign in to comment.