fix: align OpenAPI 3.x.y file uploads with specification (#10409)
Refs #9278
This commit is contained in:
@@ -4,6 +4,7 @@ import { Select, Input, TextArea } from "core/components/layout-utils"
|
||||
import { mount, render } from "enzyme"
|
||||
import * as JsonSchemaComponents from "core/plugins/json-schema-5/components/json-schema-components"
|
||||
import { foldType } from "core/plugins/json-schema-2020-12-samples/fn/index"
|
||||
import { makeIsFileUploadIntended } from "core/plugins/oas3/fn"
|
||||
|
||||
const components = {...JsonSchemaComponents, Select, Input, TextArea}
|
||||
|
||||
@@ -13,6 +14,16 @@ const getComponentStub = (name) => {
|
||||
return null
|
||||
}
|
||||
|
||||
const getSystemStub = () => ({
|
||||
getConfigs: () => ({
|
||||
fileUploadMediaTypes: [],
|
||||
}),
|
||||
fn: {
|
||||
hasSchemaType: () => {},
|
||||
isFileUploadIntendedOAS30: () => {},
|
||||
},
|
||||
})
|
||||
|
||||
describe("<JsonSchemaComponents.JsonSchemaForm/>", function(){
|
||||
describe("strings", function() {
|
||||
it("should render the correct options for a string enum parameter", function(){
|
||||
@@ -26,6 +37,7 @@ describe("<JsonSchemaComponents.JsonSchemaForm/>", function(){
|
||||
jsonSchema202012: {
|
||||
foldType,
|
||||
},
|
||||
isFileUploadIntended: makeIsFileUploadIntended(getSystemStub)
|
||||
},
|
||||
schema: Immutable.fromJS({
|
||||
type: "string",
|
||||
@@ -53,6 +65,7 @@ describe("<JsonSchemaComponents.JsonSchemaForm/>", function(){
|
||||
jsonSchema202012: {
|
||||
foldType,
|
||||
},
|
||||
isFileUploadIntended: makeIsFileUploadIntended(getSystemStub)
|
||||
},
|
||||
schema: Immutable.fromJS({
|
||||
type: "string",
|
||||
@@ -78,6 +91,7 @@ describe("<JsonSchemaComponents.JsonSchemaForm/>", function(){
|
||||
jsonSchema202012: {
|
||||
foldType,
|
||||
},
|
||||
isFileUploadIntended: makeIsFileUploadIntended(getSystemStub)
|
||||
},
|
||||
required: true,
|
||||
schema: Immutable.fromJS({
|
||||
@@ -106,6 +120,7 @@ describe("<JsonSchemaComponents.JsonSchemaForm/>", function(){
|
||||
jsonSchema202012: {
|
||||
foldType,
|
||||
},
|
||||
isFileUploadIntended: makeIsFileUploadIntended(getSystemStub)
|
||||
},
|
||||
schema: Immutable.fromJS({
|
||||
type: "boolean"
|
||||
@@ -133,6 +148,7 @@ describe("<JsonSchemaComponents.JsonSchemaForm/>", function(){
|
||||
jsonSchema202012: {
|
||||
foldType,
|
||||
},
|
||||
isFileUploadIntended: makeIsFileUploadIntended(getSystemStub)
|
||||
},
|
||||
schema: Immutable.fromJS({
|
||||
type: "boolean",
|
||||
@@ -160,6 +176,7 @@ describe("<JsonSchemaComponents.JsonSchemaForm/>", function(){
|
||||
jsonSchema202012: {
|
||||
foldType,
|
||||
},
|
||||
isFileUploadIntended: makeIsFileUploadIntended(getSystemStub)
|
||||
},
|
||||
schema: Immutable.fromJS({
|
||||
type: "boolean",
|
||||
@@ -188,6 +205,7 @@ describe("<JsonSchemaComponents.JsonSchemaForm/>", function(){
|
||||
jsonSchema202012: {
|
||||
foldType,
|
||||
},
|
||||
isFileUploadIntended: makeIsFileUploadIntended(getSystemStub)
|
||||
},
|
||||
required: true,
|
||||
schema: Immutable.fromJS({
|
||||
@@ -219,6 +237,7 @@ describe("<JsonSchemaComponents.JsonSchemaForm/>", function(){
|
||||
jsonSchema202012: {
|
||||
foldType,
|
||||
},
|
||||
isFileUploadIntended: makeIsFileUploadIntended(getSystemStub)
|
||||
},
|
||||
errors: List(),
|
||||
schema: Immutable.fromJS({
|
||||
@@ -252,6 +271,7 @@ describe("<JsonSchemaComponents.JsonSchemaForm/>", function(){
|
||||
jsonSchema202012: {
|
||||
foldType,
|
||||
},
|
||||
isFileUploadIntended: makeIsFileUploadIntended(getSystemStub)
|
||||
},
|
||||
schema: Immutable.fromJS({
|
||||
type: "NotARealType"
|
||||
@@ -278,6 +298,7 @@ describe("<JsonSchemaComponents.JsonSchemaForm/>", function(){
|
||||
jsonSchema202012: {
|
||||
foldType,
|
||||
},
|
||||
isFileUploadIntended: makeIsFileUploadIntended(getSystemStub)
|
||||
},
|
||||
schema: Immutable.fromJS({
|
||||
type: "NotARealType",
|
||||
|
||||
Reference in New Issue
Block a user