OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
API
/
swagger-ui-5.17.14
/
test
/
unit
/
components
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/07/2024 04:33:57 AM
rwxr-xr-x
📄
filter.jsx
1.23 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
highlight-code.jsx
1.65 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
info-wrapper.jsx
1.68 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
live-response.jsx
3.32 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
markdown.jsx
5.43 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
online-validator-badge.jsx
2.3 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
operation-tag.jsx
1.32 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
operation.jsx
900 bytes
08/07/2024 04:33:56 AM
rw-r--r--
📄
operations.jsx
3.32 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
parameter-row.jsx
9.79 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
response-body.jsx
2.23 KB
08/07/2024 04:33:56 AM
rw-r--r--
📄
version-pragma-filter.jsx
1.96 KB
08/07/2024 04:33:56 AM
rw-r--r--
Editing: operations.jsx
Close
import React from "react" import { render } from "enzyme" import { fromJS } from "immutable" import DeepLink from "core/components/deep-link" import Operations from "core/components/operations" import {Collapse} from "core/components/layout-utils" const components = { Collapse, DeepLink, OperationContainer: ({ path, method }) => <span className="mocked-op" id={`${path}-${method}`} />, OperationTag: "div", } describe("<Operations/>", function(){ it("should render a Swagger2 `get` method, but not a `trace` or `foo` method", function(){ let props = { fn: {}, specActions: {}, layoutActions: {}, getComponent: (name)=> { return components[name] || null }, getConfigs: () => { return {} }, specSelectors: { isOAS3() { return false }, url() { return "https://petstore.swagger.io/v2/swagger.json" }, validOperationMethods() { return ["get", "put", "post", "delete", "options", "head", "patch"] }, taggedOperations() { return fromJS({ "default": { "operations": [ { "path": "/pets/{id}", "method": "get" }, { "path": "/pets/{id}", "method": "trace" }, { "path": "/pets/{id}", "method": "foo" }, ] } }) }, }, layoutSelectors: { currentFilter() { return null }, isShown() { return true }, show() { return true } } } let wrapper = render(<Operations {...props}/>) expect(wrapper.find("span.mocked-op").length).toEqual(1) expect(wrapper.find("span.mocked-op").eq(0).attr("id")).toEqual("/pets/{id}-get") }) it("should render an OAS3 `get` and `trace` method, but not a `foo` method", function(){ let props = { fn: {}, specActions: {}, layoutActions: {}, getComponent: (name)=> { return components[name] || null }, getConfigs: () => { return {} }, specSelectors: { isOAS3() { return true }, url() { return "https://petstore.swagger.io/v2/swagger.json" }, validOperationMethods() { return ["get", "put", "post", "delete", "options", "head", "patch", "trace"] }, taggedOperations() { return fromJS({ "default": { "operations": [ { "path": "/pets/{id}", "method": "get" }, { "path": "/pets/{id}", "method": "trace" }, { "path": "/pets/{id}", "method": "foo" }, ] } }) }, }, layoutSelectors: { currentFilter() { return null }, isShown() { return true }, show() { return true } } } let wrapper = render(<Operations {...props}/>) expect(wrapper.find("span.mocked-op").length).toEqual(2) expect(wrapper.find("span.mocked-op").eq(0).attr("id")).toEqual("/pets/{id}-get") expect(wrapper.find("span.mocked-op").eq(1).attr("id")).toEqual("/pets/{id}-trace") }) })