From 775dffd5af62856cefc8413488f9a62cab769e34 Mon Sep 17 00:00:00 2001 From: Vladimir Gorej Date: Fri, 25 Jun 2021 16:45:34 +0200 Subject: [PATCH] test(test:unit-jest): fix npm script Refs #2710 --- test/unit/plugins/editor-metadata/index.js | 19 ++++++++++--------- test/unit/plugins/selectors.js | 13 +++++++------ .../validate-semantic/validate-helper.js | 16 ++++++++-------- test/unit/standalone/topbar-insert/index.js | 14 +++++++------- 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/test/unit/plugins/editor-metadata/index.js b/test/unit/plugins/editor-metadata/index.js index 50e87ab18de..ef8e4fad2a4 100644 --- a/test/unit/plugins/editor-metadata/index.js +++ b/test/unit/plugins/editor-metadata/index.js @@ -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 @@ -32,7 +33,7 @@ function getSystem(spec) { }) ] }); - + resolve(system); }); } @@ -109,7 +110,7 @@ describe('editor metadata plugin', () => { }); } ); - + it('should return isValid for a valid spec', async () => { const spec = { swagger: '2.0', @@ -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', diff --git a/test/unit/plugins/selectors.js b/test/unit/plugins/selectors.js index 274a07c00e9..c1b73cd43f5 100644 --- a/test/unit/plugins/selectors.js +++ b/test/unit/plugins/selectors.js @@ -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 diff --git a/test/unit/plugins/validate-semantic/validate-helper.js b/test/unit/plugins/validate-semantic/validate-helper.js index 32c37ccaa93..9fb6e255044 100644 --- a/test/unit/plugins/validate-semantic/validate-helper.js +++ b/test/unit/plugins/validate-semantic/validate-helper.js @@ -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'; @@ -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 diff --git a/test/unit/standalone/topbar-insert/index.js b/test/unit/standalone/topbar-insert/index.js index 85f7be6776c..01736598dc7 100644 --- a/test/unit/standalone/topbar-insert/index.js +++ b/test/unit/standalone/topbar-insert/index.js @@ -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'; @@ -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