Skip to content

Commit f523ec4

Browse files
authored
housekeeping: reorganize and rewire Mocha tests (#5600)
* move Mocha-run tests to `test/mocha` * fix relative paths * fix JSX test paths * update stagnated JSX tests * `test/setup.js` -> `test/mocha/setup.js` * use regex+globstar for test matching * remove `console.log`
1 parent c3890c2 commit f523ec4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+24
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"lint-fix": "eslint --cache --ext '.js,.jsx' src test --fix",
3131
"test": "run-s just-test-in-node e2e-cypress lint-errors",
3232
"test-in-node": "run-s lint-errors just-test-in-node",
33-
"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",
33+
"just-test-in-node": "mocha --require test/mocha/setup.js --recursive --compilers js:@babel/register --require source-map-support 'test/mocha/**/*.{js,jsx}'",
3434
"test-e2e-cypress": "cypress run",
3535
"test-e2e-selenium": "sleep 3 && nightwatch test/e2e-selenium/scenarios/ --config test/e2e-selenium/nightwatch.json",
3636
"e2e-initial-render": "nightwatch test/e2e-selenium/scenarios/ --config test/e2e-selenium/nightwatch.json --group initial-render",

test/bugs/4557-default-parameter-values.jsx renamed to test/mocha/bugs/4557-default-parameter-values.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ describe("bug #4557: default parameter values", function(){
5656
isOAS3(){ return true },
5757
isSwagger2() { return false }
5858
},
59+
oas3Selectors: {
60+
activeExamplesMember: () => null
61+
},
5962
fn: {},
6063
operation: {get: ()=>{}},
6164
onChange: createSpy(),
File renamed without changes.

test/components/json-schema-form.jsx renamed to test/mocha/components/json-schema-form.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ describe("<JsonSchemaForm/>", function(){
163163

164164
let props = {
165165
getComponent: getComponentStub,
166-
value: "",
166+
value: `{\n "id": "abc123"\n}`,
167167
onChange: (value) => {
168168
updateQueue.push({ value })
169169
},

test/components/markdown.jsx renamed to test/mocha/components/markdown.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from "react"
33
import expect from "expect"
44
import { render } from "enzyme"
55
import Markdown from "components/providers/markdown"
6-
import { Markdown as OAS3Markdown } from "corePlugins/oas3/wrap-components/markdown.js"
6+
import { Markdown as OAS3Markdown } from "corePlugins/oas3/wrap-components/markdown.jsx"
77

88
describe("Markdown component", function() {
99
describe("Swagger 2.0", function() {

test/components/model-example.jsx renamed to test/mocha/components/model-example.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ describe("<ModelExample/>", function(){
2929
getComponent: (c) => {
3030
return components[c]
3131
},
32-
specSelectors: {},
32+
specSelectors: {
33+
isOAS3: () => false
34+
},
3335
schema: {},
3436
example: "{\"example\": \"value\"}",
3537
isExecute: false,

0 commit comments

Comments
 (0)