Request URL
diff --git a/src/core/components/operation-tag.jsx b/src/core/components/operation-tag.jsx
index 0880c079e82..9f8dcf46e99 100644
--- a/src/core/components/operation-tag.jsx
+++ b/src/core/components/operation-tag.jsx
@@ -47,8 +47,6 @@ export default class OperationTag extends React.Component {
deepLinking,
} = getConfigs()
- const isDeepLinkingEnabled = deepLinking && deepLinking !== "false"
-
const Collapse = getComponent("Collapse")
const Markdown = getComponent("Markdown", true)
const DeepLink = getComponent("DeepLink")
@@ -80,7 +78,7 @@ export default class OperationTag extends React.Component {
data-is-open={showTag}
>
diff --git a/src/core/config/defaults.js b/src/core/config/defaults.js
index aa304ad1784..19c2a0a080b 100644
--- a/src/core/config/defaults.js
+++ b/src/core/config/defaults.js
@@ -11,8 +11,8 @@ const defaultOptions = Object.freeze({
urls: null,
layout: "BaseLayout",
docExpansion: "list",
- maxDisplayedTags: null,
- filter: null,
+ maxDisplayedTags: -1,
+ filter: false,
validatorUrl: "https://validator.swagger.io/validator",
oauth2RedirectUrl: `${window.location.protocol}//${window.location.host}${window.location.pathname.substring(0, window.location.pathname.lastIndexOf("/"))}/oauth2-redirect.html`,
persistAuthorization: false,
@@ -30,7 +30,7 @@ const defaultOptions = Object.freeze({
defaultModelsExpandDepth: 1,
showExtensions: false,
showCommonExtensions: false,
- withCredentials: undefined,
+ withCredentials: false,
requestSnippetsEnabled: false,
requestSnippets: {
generators: {
diff --git a/src/core/config/factorization/store.js b/src/core/config/factorization/store.js
index 9d29c6c4ae1..055aba034e6 100644
--- a/src/core/config/factorization/store.js
+++ b/src/core/config/factorization/store.js
@@ -1,10 +1,10 @@
/**
* @prettier
*/
-import merge from "../merge"
+import deepExtend from "deep-extend"
const storeFactorization = (options) => {
- const state = merge(
+ const state = deepExtend(
{
layout: {
layout: options.layout,
diff --git a/src/core/config/merge.js b/src/core/config/merge.js
index e56304fb885..04d02efaec3 100644
--- a/src/core/config/merge.js
+++ b/src/core/config/merge.js
@@ -7,12 +7,13 @@
*
* NOTE1: lodash.merge & lodash.mergeWith prefers to ignore undefined values
* NOTE2: special handling of `domNode` option is now required as `deep-extend` will corrupt it (lodash.merge handles it correctly)
- * NOTE3: oauth2RedirectUrl and withCredentials options can be set to undefined. By expecting null instead of undefined, we can't use lodash.merge.
+ * NOTE3: oauth2RedirectUrl option can be set to undefined. By expecting null instead of undefined, we can't use lodash.merge.
* NOTE4: urls.primaryName needs to handled in special way, because it's an arbitrary property on Array instance
*
* TODO(vladimir.gorej@gmail.com): remove deep-extend in favor of lodash.merge
*/
import deepExtend from "deep-extend"
+import typeCast from "./type-cast"
const merge = (target, ...sources) => {
let domNode = Symbol.for("domNode")
@@ -51,7 +52,7 @@ const merge = (target, ...sources) => {
merged.urls.primaryName = primaryName
}
- return merged
+ return typeCast(merged)
}
export default merge
diff --git a/src/core/config/type-cast/index.js b/src/core/config/type-cast/index.js
new file mode 100644
index 00000000000..608e0312b77
--- /dev/null
+++ b/src/core/config/type-cast/index.js
@@ -0,0 +1,24 @@
+/**
+ * @prettier
+ */
+import has from "lodash/has"
+import get from "lodash/get"
+import set from "lodash/fp/set"
+
+import typeCasters from "./mappings"
+
+const typeCast = (options) => {
+ return Object.entries(typeCasters).reduce(
+ (acc, [optionPath, { typeCaster, defaultValue }]) => {
+ if (has(acc, optionPath)) {
+ const uncasted = get(acc, optionPath)
+ const casted = typeCaster(uncasted, defaultValue)
+ acc = set(optionPath, casted, acc)
+ }
+ return acc
+ },
+ { ...options }
+ )
+}
+
+export default typeCast
diff --git a/src/core/config/type-cast/mappings.js b/src/core/config/type-cast/mappings.js
new file mode 100644
index 00000000000..30ef5e3dfd5
--- /dev/null
+++ b/src/core/config/type-cast/mappings.js
@@ -0,0 +1,115 @@
+/**
+ * @prettier
+ */
+import arrayTypeCaster from "./type-casters/array"
+import booleanTypeCaster from "./type-casters/boolean"
+import domNodeTypeCaster from "./type-casters/dom-node"
+import filterTypeCaster from "./type-casters/filter"
+import nullableArrayTypeCaster from "./type-casters/nullable-array"
+import nullableStringTypeCaster from "./type-casters/nullable-string"
+import numberTypeCaster from "./type-casters/number"
+import objectTypeCaster from "./type-casters/object"
+import stringTypeCaster from "./type-casters/string"
+import syntaxHighlightTypeCaster from "./type-casters/syntax-highlight"
+import undefinedStringTypeCaster from "./type-casters/undefined-string"
+import defaultOptions from "../defaults"
+
+const typeCasters = {
+ configUrl: { typeCaster: stringTypeCaster },
+ deepLinking: {
+ typeCaster: booleanTypeCaster,
+ defaultValue: defaultOptions.deepLinking,
+ },
+ defaultModelExpandDepth: {
+ typeCaster: numberTypeCaster,
+ defaultValue: defaultOptions.defaultModelExpandDepth,
+ },
+ defaultModelRendering: { typeCaster: stringTypeCaster },
+ defaultModelsExpandDepth: {
+ typeCaster: numberTypeCaster,
+ defaultValue: defaultOptions.defaultModelsExpandDepth,
+ },
+ displayOperationId: {
+ typeCaster: booleanTypeCaster,
+ defaultValue: defaultOptions.displayOperationId,
+ },
+ displayRequestDuration: {
+ typeCaster: booleanTypeCaster,
+ defaultValue: defaultOptions.displayRequestDuration,
+ },
+ docExpansion: { typeCaster: stringTypeCaster },
+ dom_id: { typeCaster: nullableStringTypeCaster },
+ domNode: { typeCaster: domNodeTypeCaster },
+ filter: { typeCaster: filterTypeCaster },
+ layout: { typeCaster: stringTypeCaster },
+ maxDisplayedTags: {
+ typeCaster: numberTypeCaster,
+ defaultValue: defaultOptions.maxDisplayedTags,
+ },
+ oauth2RedirectUrl: { typeCaster: undefinedStringTypeCaster },
+ persistAuthorization: {
+ typeCaster: booleanTypeCaster,
+ defaultValue: defaultOptions.persistAuthorization,
+ },
+ plugins: {
+ typeCaster: arrayTypeCaster,
+ defaultValue: defaultOptions.plugins,
+ },
+ pluginsOptions: {
+ typeCaster: objectTypeCaster,
+ pluginsOptions: defaultOptions.pluginsOptions,
+ },
+ "pluginsOptions.pluginsLoadType": { typeCaster: stringTypeCaster },
+ presets: {
+ typeCaster: arrayTypeCaster,
+ defaultValue: defaultOptions.presets,
+ },
+ requestSnippets: {
+ typeCaster: objectTypeCaster,
+ defaultValue: defaultOptions.requestSnippets,
+ },
+ requestSnippetsEnabled: {
+ typeCaster: booleanTypeCaster,
+ defaultValue: defaultOptions.requestSnippetsEnabled,
+ },
+ showCommonExtensions: {
+ typeCaster: booleanTypeCaster,
+ defaultValue: defaultOptions.showCommonExtensions,
+ },
+ showExtensions: {
+ typeCaster: booleanTypeCaster,
+ defaultValue: defaultOptions.showExtensions,
+ },
+ showMutatedRequest: {
+ typeCaster: booleanTypeCaster,
+ defaultValue: defaultOptions.showMutatedRequest,
+ },
+ spec: { typeCaster: objectTypeCaster, defaultValue: defaultOptions.spec },
+ supportedSubmitMethods: {
+ typeCaster: arrayTypeCaster,
+ defaultValue: defaultOptions.supportedSubmitMethods,
+ },
+ syntaxHighlight: {
+ typeCaster: syntaxHighlightTypeCaster,
+ defaultValue: defaultOptions.syntaxHighlight,
+ },
+ "syntaxHighlight.activated": {
+ typeCaster: booleanTypeCaster,
+ defaultValue: defaultOptions.syntaxHighlight.activated,
+ },
+ "syntaxHighlight.theme": { typeCaster: stringTypeCaster },
+ tryItOutEnabled: {
+ typeCaster: booleanTypeCaster,
+ defaultValue: defaultOptions.tryItOutEnabled,
+ },
+ url: { typeCaster: stringTypeCaster },
+ urls: { typeCaster: nullableArrayTypeCaster },
+ "urls.primaryName": { typeCaster: stringTypeCaster },
+ validatorUrl: { typeCaster: nullableStringTypeCaster },
+ withCredentials: {
+ typeCaster: booleanTypeCaster,
+ defaultValue: defaultOptions.withCredentials,
+ },
+}
+
+export default typeCasters
diff --git a/src/core/config/type-cast/type-casters/array.js b/src/core/config/type-cast/type-casters/array.js
new file mode 100644
index 00000000000..d11dafa78fe
--- /dev/null
+++ b/src/core/config/type-cast/type-casters/array.js
@@ -0,0 +1,7 @@
+/**
+ * @prettier
+ */
+const arrayTypeCaster = (value, defaultValue = []) =>
+ Array.isArray(value) ? value : defaultValue
+
+export default arrayTypeCaster
diff --git a/src/core/config/type-cast/type-casters/boolean.js b/src/core/config/type-cast/type-casters/boolean.js
new file mode 100644
index 00000000000..0cc584aad77
--- /dev/null
+++ b/src/core/config/type-cast/type-casters/boolean.js
@@ -0,0 +1,11 @@
+/**
+ * @prettier
+ */
+const booleanTypeCaster = (value, defaultValue = false) =>
+ value === true || value === "true" || value === 1 || value === "1"
+ ? true
+ : value === false || value === "false" || value === 0 || value === "0"
+ ? false
+ : defaultValue
+
+export default booleanTypeCaster
diff --git a/src/core/config/type-cast/type-casters/dom-node.js b/src/core/config/type-cast/type-casters/dom-node.js
new file mode 100644
index 00000000000..4186981bcf5
--- /dev/null
+++ b/src/core/config/type-cast/type-casters/dom-node.js
@@ -0,0 +1,7 @@
+/**
+ * @prettier
+ */
+const domNodeTypeCaster = (value) =>
+ value === null || value === "null" ? null : value
+
+export default domNodeTypeCaster
diff --git a/src/core/config/type-cast/type-casters/filter.js b/src/core/config/type-cast/type-casters/filter.js
new file mode 100644
index 00000000000..e13af3e787a
--- /dev/null
+++ b/src/core/config/type-cast/type-casters/filter.js
@@ -0,0 +1,11 @@
+/**
+ * @prettier
+ */
+import booleanTypeCaster from "./boolean"
+
+const filterTypeCaster = (value) => {
+ const defaultValue = String(value)
+ return booleanTypeCaster(value, defaultValue)
+}
+
+export default filterTypeCaster
diff --git a/src/core/config/type-cast/type-casters/nullable-array.js b/src/core/config/type-cast/type-casters/nullable-array.js
new file mode 100644
index 00000000000..7606fe4c4a6
--- /dev/null
+++ b/src/core/config/type-cast/type-casters/nullable-array.js
@@ -0,0 +1,6 @@
+/**
+ * @prettier
+ */
+const nullableArrayTypeCaster = (value) => (Array.isArray(value) ? value : null)
+
+export default nullableArrayTypeCaster
diff --git a/src/core/config/type-cast/type-casters/nullable-string.js b/src/core/config/type-cast/type-casters/nullable-string.js
new file mode 100644
index 00000000000..f4f0b23f95e
--- /dev/null
+++ b/src/core/config/type-cast/type-casters/nullable-string.js
@@ -0,0 +1,7 @@
+/**
+ * @prettier
+ */
+const nullableStringTypeCaster = (value) =>
+ value === null || value === "null" ? null : String(value)
+
+export default nullableStringTypeCaster
diff --git a/src/core/config/type-cast/type-casters/number.js b/src/core/config/type-cast/type-casters/number.js
new file mode 100644
index 00000000000..7fa17ae17e5
--- /dev/null
+++ b/src/core/config/type-cast/type-casters/number.js
@@ -0,0 +1,9 @@
+/**
+ * @prettier
+ */
+const numberTypeCaster = (value, defaultValue = -1) => {
+ const parsedValue = parseInt(value, 10)
+ return Number.isNaN(parsedValue) ? defaultValue : parsedValue
+}
+
+export default numberTypeCaster
diff --git a/src/core/config/type-cast/type-casters/object.js b/src/core/config/type-cast/type-casters/object.js
new file mode 100644
index 00000000000..f4a4db27e74
--- /dev/null
+++ b/src/core/config/type-cast/type-casters/object.js
@@ -0,0 +1,9 @@
+/**
+ * @prettier
+ */
+import isPlainObject from "lodash/isPlainObject"
+
+const objectTypeCaster = (value, defaultValue = {}) =>
+ isPlainObject(value) ? value : defaultValue
+
+export default objectTypeCaster
diff --git a/src/core/config/type-cast/type-casters/string.js b/src/core/config/type-cast/type-casters/string.js
new file mode 100644
index 00000000000..ed562fd2ea4
--- /dev/null
+++ b/src/core/config/type-cast/type-casters/string.js
@@ -0,0 +1,6 @@
+/**
+ * @prettier
+ */
+const stringTypeCaster = (value) => String(value)
+
+export default stringTypeCaster
diff --git a/src/core/config/type-cast/type-casters/syntax-highlight.js b/src/core/config/type-cast/type-casters/syntax-highlight.js
new file mode 100644
index 00000000000..a4d33c1c5db
--- /dev/null
+++ b/src/core/config/type-cast/type-casters/syntax-highlight.js
@@ -0,0 +1,14 @@
+/**
+ * @prettier
+ */
+import isPlainObject from "lodash/isPlainObject"
+
+const syntaxHighlightTypeCaster = (value, defaultValue) => {
+ return isPlainObject(value)
+ ? value
+ : value === false || value === "false" || value === 0 || value === "0"
+ ? { activated: false }
+ : defaultValue
+}
+
+export default syntaxHighlightTypeCaster
diff --git a/src/core/config/type-cast/type-casters/undefined-string.js b/src/core/config/type-cast/type-casters/undefined-string.js
new file mode 100644
index 00000000000..21ef142d1a7
--- /dev/null
+++ b/src/core/config/type-cast/type-casters/undefined-string.js
@@ -0,0 +1,7 @@
+/**
+ * @prettier
+ */
+const undefinedStringTypeCaster = (value) =>
+ value === undefined || value === "undefined" ? undefined : String(value)
+
+export default undefinedStringTypeCaster
diff --git a/src/core/containers/OperationContainer.jsx b/src/core/containers/OperationContainer.jsx
index 89ce7f51ae1..6efd7dfc2fb 100644
--- a/src/core/containers/OperationContainer.jsx
+++ b/src/core/containers/OperationContainer.jsx
@@ -11,7 +11,7 @@ export default class OperationContainer extends PureComponent {
const { tryItOutEnabled } = props.getConfigs()
this.state = {
- tryItOutEnabled: tryItOutEnabled === true || tryItOutEnabled === "true",
+ tryItOutEnabled,
executeInProgress: false
}
}
@@ -61,14 +61,13 @@ export default class OperationContainer extends PureComponent {
const showSummary = layoutSelectors.showSummary()
const operationId = op.getIn(["operation", "__originalOperationId"]) || op.getIn(["operation", "operationId"]) || opId(op.get("operation"), props.path, props.method) || op.get("id")
const isShownKey = ["operations", props.tag, operationId]
- const isDeepLinkingEnabled = deepLinking && deepLinking !== "false"
const allowTryItOut = supportedSubmitMethods.indexOf(props.method) >= 0 && (typeof props.allowTryItOut === "undefined" ?
props.specSelectors.allowTryItOutFor(props.path, props.method) : props.allowTryItOut)
const security = op.getIn(["operation", "security"]) || props.specSelectors.security()
return {
operationId,
- isDeepLinkingEnabled,
+ isDeepLinkingEnabled: deepLinking,
showSummary,
displayOperationId,
displayRequestDuration,
diff --git a/src/core/containers/filter.jsx b/src/core/containers/filter.jsx
index 872297f055e..440b1ac4ad9 100644
--- a/src/core/containers/filter.jsx
+++ b/src/core/containers/filter.jsx
@@ -29,11 +29,11 @@ export default class FilterContainer extends React.Component {
return (
- {filter === null || filter === false || filter === "false" ? null :
+ {filter === false ? null :
diff --git a/src/core/plugins/layout/spec-extensions/wrap-selector.js b/src/core/plugins/layout/spec-extensions/wrap-selector.js
index 712980179e0..4aed3aa0b3c 100644
--- a/src/core/plugins/layout/spec-extensions/wrap-selector.js
+++ b/src/core/plugins/layout/spec-extensions/wrap-selector.js
@@ -9,12 +9,12 @@ export const taggedOperations = (oriSelector, system) => (state, ...args) => {
// Filter, if requested
let filter = layoutSelectors.currentFilter()
if (filter) {
- if (filter !== true && filter !== "true" && filter !== "false") {
+ if (filter !== true) {
taggedOps = fn.opsFilter(taggedOps, filter)
}
}
// Limit to [max] items, if specified
- if (maxDisplayedTags && !isNaN(maxDisplayedTags) && maxDisplayedTags >= 0) {
+ if (maxDisplayedTags >= 0) {
taggedOps = taggedOps.slice(0, maxDisplayedTags)
}
diff --git a/src/core/plugins/swagger-client/configs-wrap-actions.js b/src/core/plugins/swagger-client/configs-wrap-actions.js
index 34d0e158af0..99770d6379a 100644
--- a/src/core/plugins/swagger-client/configs-wrap-actions.js
+++ b/src/core/plugins/swagger-client/configs-wrap-actions.js
@@ -2,7 +2,5 @@ export const loaded = (ori, system) => (...args) => {
ori(...args)
const value = system.getConfigs().withCredentials
- if(value !== undefined) {
- system.fn.fetch.withCredentials = typeof value === "string" ? (value === "true") : !!value
- }
+ system.fn.fetch.withCredentials = value
}
diff --git a/src/core/plugins/syntax-highlighting/components/SyntaxHighlighter.jsx b/src/core/plugins/syntax-highlighting/components/SyntaxHighlighter.jsx
index 43db2e2a70c..0ca96190937 100644
--- a/src/core/plugins/syntax-highlighting/components/SyntaxHighlighter.jsx
+++ b/src/core/plugins/syntax-highlighting/components/SyntaxHighlighter.jsx
@@ -4,7 +4,6 @@
import React from "react"
import PropTypes from "prop-types"
import ReactSyntaxHighlighter from "react-syntax-highlighter/dist/esm/light"
-import get from "lodash/get"
const SyntaxHighlighter = ({
language,
@@ -13,8 +12,7 @@ const SyntaxHighlighter = ({
syntaxHighlighting = {},
children = "",
}) => {
- const configs = getConfigs()
- const theme = get(configs, "syntaxHighlight.theme")
+ const theme = getConfigs().syntaxHighlight.theme
const { styles, defaultStyle } = syntaxHighlighting
const style = styles?.[theme] ?? defaultStyle
diff --git a/src/core/plugins/syntax-highlighting/wrap-components/SyntaxHighlighter.jsx b/src/core/plugins/syntax-highlighting/wrap-components/SyntaxHighlighter.jsx
index a9e557209f0..a505d1b8039 100644
--- a/src/core/plugins/syntax-highlighting/wrap-components/SyntaxHighlighter.jsx
+++ b/src/core/plugins/syntax-highlighting/wrap-components/SyntaxHighlighter.jsx
@@ -3,12 +3,10 @@
*/
import React from "react"
import PropTypes from "prop-types"
-import get from "lodash/get"
const SyntaxHighlighterWrapper = (Original, system) => {
const SyntaxHighlighter = ({ renderPlainText, children, ...rest }) => {
- const configs = system.getConfigs()
- const canSyntaxHighlight = !!get(configs, "syntaxHighlight.activated")
+ const canSyntaxHighlight = system.getConfigs().syntaxHighlight.activated
const PlainTextViewer = system.getComponent("PlainTextViewer")
if (!canSyntaxHighlight && typeof renderPlainText === "function") {
diff --git a/test/unit/components/filter.jsx b/test/unit/components/filter.jsx
index 4fd740a7896..caa85f0f4a7 100644
--- a/test/unit/components/filter.jsx
+++ b/test/unit/components/filter.jsx
@@ -30,21 +30,6 @@ describe("
", function(){
expect(renderedColInsideFilter.length).toEqual(1)
})
- it("does not render FilterContainer if filter is null", function(){
-
- // Given
- let props = {...mockedProps}
- props.layoutSelectors = {...mockedProps.specSelectors}
- props.layoutSelectors.currentFilter = function() {return null}
-
- // When
- let wrapper = mount(
)
-
- // Then
- const renderedColInsideFilter = wrapper.find(Col)
- expect(renderedColInsideFilter.length).toEqual(0)
- })
-
it("does not render FilterContainer if filter is false", function(){
// Given
diff --git a/test/unit/core/config/type-cast/index.js b/test/unit/core/config/type-cast/index.js
new file mode 100644
index 00000000000..c233b13fbb7
--- /dev/null
+++ b/test/unit/core/config/type-cast/index.js
@@ -0,0 +1,104 @@
+/**
+ * @prettier
+ */
+import typeCast from "core/config/type-cast"
+
+jest.mock("core/presets/apis", () => {})
+
+describe("typeCast", () => {
+ it("should cast stringified `true` and `false` values to `boolean`", () => {
+ const config = {
+ deepLinking: "true",
+ tryItOutEnabled: "false",
+ withCredentials: "true",
+ filter: "false",
+ }
+
+ const expectedConfig = {
+ deepLinking: true,
+ tryItOutEnabled: false,
+ withCredentials: true,
+ filter: false,
+ }
+
+ expect(typeCast(config)).toStrictEqual(expectedConfig)
+ })
+
+ it("should cast stringified `number` values to `number`", () => {
+ const config = {
+ defaultModelExpandDepth: "5",
+ defaultModelsExpandDepth: "-1",
+ maxDisplayedTags: "1",
+ }
+
+ const expectedConfig = {
+ defaultModelExpandDepth: 5,
+ defaultModelsExpandDepth: -1,
+ maxDisplayedTags: 1,
+ }
+
+ expect(typeCast(config)).toStrictEqual(expectedConfig)
+ })
+
+ it("should cast stringified `null` values to `null`", () => {
+ const config = {
+ validatorUrl: "null",
+ }
+
+ const expectedConfig = {
+ validatorUrl: null,
+ }
+
+ expect(typeCast(config)).toStrictEqual(expectedConfig)
+ })
+
+ it("should cast `string` values to `string`", () => {
+ const config = { defaultModelRendering: "model", filter: "pet" }
+
+ const expectedConfig = { defaultModelRendering: "model", filter: "pet" }
+
+ expect(typeCast(config)).toStrictEqual(expectedConfig)
+ })
+
+ it("should cast stringified values to correct type", () => {
+ const config = {
+ dom_id: "null",
+ oauth2RedirectUrl: "undefined",
+ syntaxHighlight: "false",
+ urls: "null",
+ }
+
+ const expectedConfig = {
+ dom_id: null,
+ oauth2RedirectUrl: undefined,
+ syntaxHighlight: { activated: false },
+ urls: null,
+ }
+
+ expect(typeCast(config)).toStrictEqual(expectedConfig)
+ })
+
+ it("should cast incorrect value types to default value", () => {
+ const config = {
+ deepLinking: "deepLinking",
+ urls: "urls",
+ syntaxHighlight: "syntaxHighlight",
+ spec: "spec",
+ maxDisplayedTags: "null",
+ defaultModelExpandDepth: {},
+ defaultModelsExpandDepth: false,
+ }
+
+ const expectedConfig = {
+ deepLinking: false,
+ urls: null,
+ syntaxHighlight: { activated: true, theme: "agate" },
+ spec: {},
+ maxDisplayedTags: -1,
+ defaultModelExpandDepth: 1,
+ defaultModelsExpandDepth: 1,
+ }
+
+ expect(typeCast(config)).toStrictEqual(expectedConfig)
+ })
+})
diff --git a/test/unit/core/plugins/swagger-js/withCredentials.js b/test/unit/core/plugins/swagger-js/withCredentials.js
index 9153d548f80..ff2487abe6b 100644
--- a/test/unit/core/plugins/swagger-js/withCredentials.js
+++ b/test/unit/core/plugins/swagger-js/withCredentials.js
@@ -49,44 +49,6 @@ describe("swagger-client plugin - withCredentials", () => {
const loadedFn = loaded(oriExecute, system)
loadedFn()
- expect(oriExecute.mock.calls.length).toBe(1)
- expect(system.fn.fetch.withCredentials).toBe(false)
- })
-
- it("should allow setting flag to true via config as string", () => {
- // for query string config
- const system = {
- fn: {
- fetch: jest.fn().mockImplementation(() => Promise.resolve())
- },
- getConfigs: () => ({
- withCredentials: "true"
- })
- }
- const oriExecute = jest.fn()
-
- const loadedFn = loaded(oriExecute, system)
- loadedFn()
-
- expect(oriExecute.mock.calls.length).toBe(1)
- expect(system.fn.fetch.withCredentials).toBe(true)
- })
-
- it("should allow setting flag to false via config as string", () => {
- // for query string config
- const system = {
- fn: {
- fetch: jest.fn().mockImplementation(() => Promise.resolve())
- },
- getConfigs: () => ({
- withCredentials: "false"
- })
- }
- const oriExecute = jest.fn()
-
- const loadedFn = loaded(oriExecute, system)
- loadedFn()
-
expect(oriExecute.mock.calls.length).toBe(1)
expect(system.fn.fetch.withCredentials).toBe(false)
})