diff --git a/package.json b/package.json
index 0f6cee157e1..68335819f24 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
"lint-fix": "eslint --cache --ext '.js,.jsx' src test --fix",
"test": "run-s just-test-in-node e2e-cypress lint-errors",
"test-in-node": "run-s lint-errors just-test-in-node",
- "just-test-in-node": "mocha --require test/setup.js --recursive --compilers js:@babel/register --require source-map-support test/core test/components test/bugs test/docker test/swagger-ui-dist-package test/xss",
+ "just-test-in-node": "mocha --require test/mocha/setup.js --recursive --compilers js:@babel/register --require source-map-support 'test/mocha/**/*.{js,jsx}'",
"test-e2e-cypress": "cypress run",
"test-e2e-selenium": "sleep 3 && nightwatch test/e2e-selenium/scenarios/ --config test/e2e-selenium/nightwatch.json",
"e2e-initial-render": "nightwatch test/e2e-selenium/scenarios/ --config test/e2e-selenium/nightwatch.json --group initial-render",
diff --git a/test/bugs/3199-sanitization-escaping.jsx b/test/mocha/bugs/3199-sanitization-escaping.jsx
similarity index 100%
rename from test/bugs/3199-sanitization-escaping.jsx
rename to test/mocha/bugs/3199-sanitization-escaping.jsx
diff --git a/test/bugs/3279-empty-markdown-source.jsx b/test/mocha/bugs/3279-empty-markdown-source.jsx
similarity index 100%
rename from test/bugs/3279-empty-markdown-source.jsx
rename to test/mocha/bugs/3279-empty-markdown-source.jsx
diff --git a/test/bugs/4557-default-parameter-values.jsx b/test/mocha/bugs/4557-default-parameter-values.jsx
similarity index 96%
rename from test/bugs/4557-default-parameter-values.jsx
rename to test/mocha/bugs/4557-default-parameter-values.jsx
index ab63cf192a8..b8223de36bb 100644
--- a/test/bugs/4557-default-parameter-values.jsx
+++ b/test/mocha/bugs/4557-default-parameter-values.jsx
@@ -56,6 +56,9 @@ describe("bug #4557: default parameter values", function(){
isOAS3(){ return true },
isSwagger2() { return false }
},
+ oas3Selectors: {
+ activeExamplesMember: () => null
+ },
fn: {},
operation: {get: ()=>{}},
onChange: createSpy(),
diff --git a/test/components/filter.jsx b/test/mocha/components/filter.jsx
similarity index 100%
rename from test/components/filter.jsx
rename to test/mocha/components/filter.jsx
diff --git a/test/components/info-wrapper.jsx b/test/mocha/components/info-wrapper.jsx
similarity index 100%
rename from test/components/info-wrapper.jsx
rename to test/mocha/components/info-wrapper.jsx
diff --git a/test/components/json-schema-form.jsx b/test/mocha/components/json-schema-form.jsx
similarity index 99%
rename from test/components/json-schema-form.jsx
rename to test/mocha/components/json-schema-form.jsx
index 69d00369279..d8554007089 100644
--- a/test/components/json-schema-form.jsx
+++ b/test/mocha/components/json-schema-form.jsx
@@ -163,7 +163,7 @@ describe("", function(){
let props = {
getComponent: getComponentStub,
- value: "",
+ value: `{\n "id": "abc123"\n}`,
onChange: (value) => {
updateQueue.push({ value })
},
diff --git a/test/components/live-response.jsx b/test/mocha/components/live-response.jsx
similarity index 100%
rename from test/components/live-response.jsx
rename to test/mocha/components/live-response.jsx
diff --git a/test/components/markdown.jsx b/test/mocha/components/markdown.jsx
similarity index 99%
rename from test/components/markdown.jsx
rename to test/mocha/components/markdown.jsx
index 0585c6768f0..a89003b327f 100644
--- a/test/components/markdown.jsx
+++ b/test/mocha/components/markdown.jsx
@@ -3,7 +3,7 @@ import React from "react"
import expect from "expect"
import { render } from "enzyme"
import Markdown from "components/providers/markdown"
-import { Markdown as OAS3Markdown } from "corePlugins/oas3/wrap-components/markdown.js"
+import { Markdown as OAS3Markdown } from "corePlugins/oas3/wrap-components/markdown.jsx"
describe("Markdown component", function() {
describe("Swagger 2.0", function() {
diff --git a/test/components/model-example.jsx b/test/mocha/components/model-example.jsx
similarity index 98%
rename from test/components/model-example.jsx
rename to test/mocha/components/model-example.jsx
index eb8c8a27c3e..7c2ad54fe24 100644
--- a/test/components/model-example.jsx
+++ b/test/mocha/components/model-example.jsx
@@ -29,7 +29,9 @@ describe("", function(){
getComponent: (c) => {
return components[c]
},
- specSelectors: {},
+ specSelectors: {
+ isOAS3: () => false
+ },
schema: {},
example: "{\"example\": \"value\"}",
isExecute: false,
diff --git a/test/components/models.jsx b/test/mocha/components/models.jsx
similarity index 100%
rename from test/components/models.jsx
rename to test/mocha/components/models.jsx
diff --git a/test/components/object-model.jsx b/test/mocha/components/object-model.jsx
similarity index 100%
rename from test/components/object-model.jsx
rename to test/mocha/components/object-model.jsx
diff --git a/test/components/online-validator-badge.jsx b/test/mocha/components/online-validator-badge.jsx
similarity index 100%
rename from test/components/online-validator-badge.jsx
rename to test/mocha/components/online-validator-badge.jsx
diff --git a/test/components/operation.jsx b/test/mocha/components/operation.jsx
similarity index 100%
rename from test/components/operation.jsx
rename to test/mocha/components/operation.jsx
diff --git a/test/components/operations.jsx b/test/mocha/components/operations.jsx
similarity index 100%
rename from test/components/operations.jsx
rename to test/mocha/components/operations.jsx
diff --git a/test/components/primitive-model.jsx b/test/mocha/components/primitive-model.jsx
similarity index 100%
rename from test/components/primitive-model.jsx
rename to test/mocha/components/primitive-model.jsx
diff --git a/test/components/response-body.jsx b/test/mocha/components/response-body.jsx
similarity index 100%
rename from test/components/response-body.jsx
rename to test/mocha/components/response-body.jsx
diff --git a/test/components/response.jsx b/test/mocha/components/response.jsx
similarity index 94%
rename from test/components/response.jsx
rename to test/mocha/components/response.jsx
index 6919435af60..04624f833dc 100644
--- a/test/components/response.jsx
+++ b/test/mocha/components/response.jsx
@@ -1,7 +1,7 @@
import React from "react"
import expect from "expect"
import { shallow } from "enzyme"
-import { fromJS } from "immutable"
+import { fromJS, List } from "immutable"
import Response from "components/response"
import ModelExample from "components/model-example"
import { inferSchema } from "corePlugins/samples/fn"
@@ -28,7 +28,9 @@ describe("", function() {
},
contentType: "application/json",
className: "for-test",
+ specPath: List(),
response: fromJS({
+ schema: {
type: "object",
properties: {
// Note reverse order: c, b, a
@@ -42,6 +44,7 @@ describe("", function() {
type: "string"
}
}
+ }
}),
code: "200"
}
@@ -55,4 +58,4 @@ describe("", function() {
const modelExampleSchemaProperties = renderedModelExample.props().schema.toJS().properties
expect( Object.keys(modelExampleSchemaProperties) ).toEqual(["c", "b", "a"])
})
-})
\ No newline at end of file
+})
diff --git a/test/components/schemes-wrapper.jsx b/test/mocha/components/schemes-wrapper.jsx
similarity index 100%
rename from test/components/schemes-wrapper.jsx
rename to test/mocha/components/schemes-wrapper.jsx
diff --git a/test/components/schemes.jsx b/test/mocha/components/schemes.jsx
similarity index 100%
rename from test/components/schemes.jsx
rename to test/mocha/components/schemes.jsx
diff --git a/test/components/version-pragma-filter.jsx b/test/mocha/components/version-pragma-filter.jsx
similarity index 100%
rename from test/components/version-pragma-filter.jsx
rename to test/mocha/components/version-pragma-filter.jsx
diff --git a/test/core/curlify.js b/test/mocha/core/curlify.js
similarity index 100%
rename from test/core/curlify.js
rename to test/mocha/core/curlify.js
diff --git a/test/core/helpers/get-parameter-schema.js b/test/mocha/core/helpers/get-parameter-schema.js
similarity index 97%
rename from test/core/helpers/get-parameter-schema.js
rename to test/mocha/core/helpers/get-parameter-schema.js
index 9775ffccaf9..cac6e746eaf 100644
--- a/test/core/helpers/get-parameter-schema.js
+++ b/test/mocha/core/helpers/get-parameter-schema.js
@@ -4,7 +4,7 @@
import expect from "expect"
import Im, { fromJS } from "immutable"
-import getParameterSchema from "../../../src/helpers/get-parameter-schema"
+import getParameterSchema from "../../../../src/helpers/get-parameter-schema"
describe("getParameterSchema", () => {
it("should return an empty Map when given no parameters", () => {
diff --git a/test/core/oauth2-authorize.js b/test/mocha/core/oauth2-authorize.js
similarity index 100%
rename from test/core/oauth2-authorize.js
rename to test/mocha/core/oauth2-authorize.js
diff --git a/test/core/plugins/auth/actions.js b/test/mocha/core/plugins/auth/actions.js
similarity index 100%
rename from test/core/plugins/auth/actions.js
rename to test/mocha/core/plugins/auth/actions.js
diff --git a/test/core/plugins/auth/preauthorize.js b/test/mocha/core/plugins/auth/preauthorize.js
similarity index 100%
rename from test/core/plugins/auth/preauthorize.js
rename to test/mocha/core/plugins/auth/preauthorize.js
diff --git a/test/core/plugins/auth/selectors.js b/test/mocha/core/plugins/auth/selectors.js
similarity index 100%
rename from test/core/plugins/auth/selectors.js
rename to test/mocha/core/plugins/auth/selectors.js
diff --git a/test/core/plugins/auth/wrap-spec-actions.js b/test/mocha/core/plugins/auth/wrap-spec-actions.js
similarity index 100%
rename from test/core/plugins/auth/wrap-spec-actions.js
rename to test/mocha/core/plugins/auth/wrap-spec-actions.js
diff --git a/test/core/plugins/configs/actions.js b/test/mocha/core/plugins/configs/actions.js
similarity index 100%
rename from test/core/plugins/configs/actions.js
rename to test/mocha/core/plugins/configs/actions.js
diff --git a/test/core/plugins/err/transformers/not-of-type.js b/test/mocha/core/plugins/err/transformers/not-of-type.js
similarity index 100%
rename from test/core/plugins/err/transformers/not-of-type.js
rename to test/mocha/core/plugins/err/transformers/not-of-type.js
diff --git a/test/core/plugins/err/transformers/parameter-oneof.js b/test/mocha/core/plugins/err/transformers/parameter-oneof.js
similarity index 100%
rename from test/core/plugins/err/transformers/parameter-oneof.js
rename to test/mocha/core/plugins/err/transformers/parameter-oneof.js
diff --git a/test/core/plugins/filter/opsFilter.js b/test/mocha/core/plugins/filter/opsFilter.js
similarity index 100%
rename from test/core/plugins/filter/opsFilter.js
rename to test/mocha/core/plugins/filter/opsFilter.js
diff --git a/test/core/plugins/oas3/helpers.js b/test/mocha/core/plugins/oas3/helpers.js
similarity index 100%
rename from test/core/plugins/oas3/helpers.js
rename to test/mocha/core/plugins/oas3/helpers.js
diff --git a/test/core/plugins/oas3/servers-wrapper.jsx b/test/mocha/core/plugins/oas3/servers-wrapper.jsx
similarity index 100%
rename from test/core/plugins/oas3/servers-wrapper.jsx
rename to test/mocha/core/plugins/oas3/servers-wrapper.jsx
diff --git a/test/core/plugins/oas3/state-integration.js b/test/mocha/core/plugins/oas3/state-integration.js
similarity index 100%
rename from test/core/plugins/oas3/state-integration.js
rename to test/mocha/core/plugins/oas3/state-integration.js
diff --git a/test/core/plugins/oas3/wrap-auth-selectors.js b/test/mocha/core/plugins/oas3/wrap-auth-selectors.js
similarity index 100%
rename from test/core/plugins/oas3/wrap-auth-selectors.js
rename to test/mocha/core/plugins/oas3/wrap-auth-selectors.js
diff --git a/test/core/plugins/oas3/wrap-spec-selectors.js b/test/mocha/core/plugins/oas3/wrap-spec-selectors.js
similarity index 100%
rename from test/core/plugins/oas3/wrap-spec-selectors.js
rename to test/mocha/core/plugins/oas3/wrap-spec-selectors.js
diff --git a/test/core/plugins/samples/fn.js b/test/mocha/core/plugins/samples/fn.js
similarity index 100%
rename from test/core/plugins/samples/fn.js
rename to test/mocha/core/plugins/samples/fn.js
diff --git a/test/core/plugins/spec/actions.js b/test/mocha/core/plugins/spec/actions.js
similarity index 100%
rename from test/core/plugins/spec/actions.js
rename to test/mocha/core/plugins/spec/actions.js
diff --git a/test/core/plugins/spec/assets/petstore.json b/test/mocha/core/plugins/spec/assets/petstore.json
similarity index 100%
rename from test/core/plugins/spec/assets/petstore.json
rename to test/mocha/core/plugins/spec/assets/petstore.json
diff --git a/test/core/plugins/spec/reducer.js b/test/mocha/core/plugins/spec/reducer.js
similarity index 100%
rename from test/core/plugins/spec/reducer.js
rename to test/mocha/core/plugins/spec/reducer.js
diff --git a/test/core/plugins/spec/selectors.js b/test/mocha/core/plugins/spec/selectors.js
similarity index 100%
rename from test/core/plugins/spec/selectors.js
rename to test/mocha/core/plugins/spec/selectors.js
diff --git a/test/core/plugins/swagger-js/withCredentials.js b/test/mocha/core/plugins/swagger-js/withCredentials.js
similarity index 100%
rename from test/core/plugins/swagger-js/withCredentials.js
rename to test/mocha/core/plugins/swagger-js/withCredentials.js
diff --git a/test/core/system/system.jsx b/test/mocha/core/system/system.jsx
similarity index 100%
rename from test/core/system/system.jsx
rename to test/mocha/core/system/system.jsx
diff --git a/test/core/system/wrapComponent.jsx b/test/mocha/core/system/wrapComponent.jsx
similarity index 100%
rename from test/core/system/wrapComponent.jsx
rename to test/mocha/core/system/wrapComponent.jsx
diff --git a/test/core/utils.js b/test/mocha/core/utils.js
similarity index 100%
rename from test/core/utils.js
rename to test/mocha/core/utils.js
diff --git a/test/docker/oauth.js b/test/mocha/docker/oauth.js
similarity index 95%
rename from test/docker/oauth.js
rename to test/mocha/docker/oauth.js
index 3a6ffc3d3c5..e7d7ad68663 100644
--- a/test/docker/oauth.js
+++ b/test/mocha/docker/oauth.js
@@ -1,5 +1,5 @@
const expect = require("expect")
-const oauthBlockBuilder = require("../../docker/configurator/oauth")
+const oauthBlockBuilder = require("../../../docker/configurator/oauth")
const dedent = require("dedent")
describe("docker: env translator - oauth block", function() {
@@ -55,4 +55,4 @@ describe("docker: env translator - oauth block", function() {
additionalQueryStringParams: { "a": 1234, "b": "stuff" },
})`))
})
-})
\ No newline at end of file
+})
diff --git a/test/docker/translator.js b/test/mocha/docker/translator.js
similarity index 99%
rename from test/docker/translator.js
rename to test/mocha/docker/translator.js
index 6e1344aa9bf..8b49ba95777 100644
--- a/test/docker/translator.js
+++ b/test/mocha/docker/translator.js
@@ -1,5 +1,5 @@
const expect = require("expect")
-const translator = require("../../docker/configurator/translator")
+const translator = require("../../../docker/configurator/translator")
const dedent = require("dedent")
describe("docker: env translator", function() {
@@ -336,4 +336,4 @@ describe("docker: env translator", function() {
).trim())
})
})
-})
\ No newline at end of file
+})
diff --git a/test/setup.js b/test/mocha/setup.js
similarity index 100%
rename from test/setup.js
rename to test/mocha/setup.js
diff --git a/test/swagger-ui-dist-package/absolute-path.js b/test/mocha/swagger-ui-dist-package/absolute-path.js
similarity index 62%
rename from test/swagger-ui-dist-package/absolute-path.js
rename to test/mocha/swagger-ui-dist-package/absolute-path.js
index 252a298ab4e..473f60ae6ab 100644
--- a/test/swagger-ui-dist-package/absolute-path.js
+++ b/test/mocha/swagger-ui-dist-package/absolute-path.js
@@ -1,12 +1,12 @@
/* eslint-env mocha */
import expect from "expect"
import path from "path"
-import getAbsoluteFSPath from "../../swagger-ui-dist-package/absolute-path"
+import getAbsoluteFSPath from "../../../swagger-ui-dist-package/absolute-path"
describe("swagger-ui-dist", function(){
describe("getAbsoluteFSPath", function(){
it("returns absolute path", function(){
- const expectedPath = path.resolve(__dirname, "../../swagger-ui-dist-package")
+ const expectedPath = path.resolve(__dirname, "../../../swagger-ui-dist-package")
expect(getAbsoluteFSPath()).toEqual(expectedPath)
})
})
diff --git a/test/xss/anchor-target-rel/info.jsx b/test/mocha/xss/anchor-target-rel/info.jsx
similarity index 100%
rename from test/xss/anchor-target-rel/info.jsx
rename to test/mocha/xss/anchor-target-rel/info.jsx
diff --git a/test/xss/anchor-target-rel/link.jsx b/test/mocha/xss/anchor-target-rel/link.jsx
similarity index 100%
rename from test/xss/anchor-target-rel/link.jsx
rename to test/mocha/xss/anchor-target-rel/link.jsx
diff --git a/test/xss/anchor-target-rel/markdown.jsx b/test/mocha/xss/anchor-target-rel/markdown.jsx
similarity index 98%
rename from test/xss/anchor-target-rel/markdown.jsx
rename to test/mocha/xss/anchor-target-rel/markdown.jsx
index 0e30accc2ae..aade97d3a4a 100644
--- a/test/xss/anchor-target-rel/markdown.jsx
+++ b/test/mocha/xss/anchor-target-rel/markdown.jsx
@@ -3,7 +3,7 @@ import React from "react"
import expect from "expect"
import { render } from "enzyme"
import Markdown from "components/providers/markdown"
-import { Markdown as OAS3Markdown } from "corePlugins/oas3/wrap-components/markdown.js"
+import { Markdown as OAS3Markdown } from "corePlugins/oas3/wrap-components/markdown.jsx"
describe("Markdown Link Anchor Safety", function () {
describe("Swagger 2.0", function () {
@@ -63,4 +63,4 @@ function withMarkdownWrapper(str, { isOAS3 = false } = {}) {
}
return `
`
-}
\ No newline at end of file
+}
diff --git a/test/xss/anchor-target-rel/online-validator-badge.jsx b/test/mocha/xss/anchor-target-rel/online-validator-badge.jsx
similarity index 100%
rename from test/xss/anchor-target-rel/online-validator-badge.jsx
rename to test/mocha/xss/anchor-target-rel/online-validator-badge.jsx
diff --git a/test/xss/info-sanitization.jsx b/test/mocha/xss/info-sanitization.jsx
similarity index 100%
rename from test/xss/info-sanitization.jsx
rename to test/mocha/xss/info-sanitization.jsx
diff --git a/test/xss/markdown-script-sanitization.jsx b/test/mocha/xss/markdown-script-sanitization.jsx
similarity index 98%
rename from test/xss/markdown-script-sanitization.jsx
rename to test/mocha/xss/markdown-script-sanitization.jsx
index 6fcb6338b0a..4c433dc316a 100644
--- a/test/xss/markdown-script-sanitization.jsx
+++ b/test/mocha/xss/markdown-script-sanitization.jsx
@@ -3,7 +3,7 @@ import React from "react"
import expect from "expect"
import { render } from "enzyme"
import Markdown from "components/providers/markdown"
-import { Markdown as OAS3Markdown } from "corePlugins/oas3/wrap-components/markdown.js"
+import { Markdown as OAS3Markdown } from "corePlugins/oas3/wrap-components/markdown.jsx"
describe("Markdown Script Sanitization", function() {
describe("Swagger 2.0", function() {