@redocly/openapi-docs 3.24.0-next.9 → 3.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{redocly-openapi-docs.min.AiChatProvider-DcsGB2gP.js → redocly-openapi-docs.min.AiChatProvider-j-VDfFJ9.js} +3 -3
- package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-wCZA4usG.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-BBRBmffc.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiPanel-jo7fqtSt.js → redocly-openapi-docs.min.AiPanel-DTzHqAiI.js} +116 -116
- package/dist/redocly-openapi-docs.min.FileWatcher-DDoyaS7A.js +1 -0
- package/dist/redocly-openapi-docs.min.Observable-D6wKbFwB.js +1 -0
- package/dist/redocly-openapi-docs.min.SemanticSearchService-DNFOPBZK.js +1 -0
- package/dist/{redocly-openapi-docs.min.SqliteDBStorage-B_f6WR8o.js → redocly-openapi-docs.min.SqliteDBStorage-Dy40Vq04.js} +1 -1
- package/dist/redocly-openapi-docs.min.TauriFileSystemAdapter-CpViFqJQ.js +1 -0
- package/dist/redocly-openapi-docs.min.TauriRootStorage-TCUrp2uB.js +1 -0
- package/dist/redocly-openapi-docs.min.ai-chat-mappers-CmX-8902.js +1 -0
- package/dist/redocly-openapi-docs.min.core-BYyFOtMX.js +1 -0
- package/dist/redocly-openapi-docs.min.external-resolver-BkceRyB4.js +2 -0
- package/dist/redocly-openapi-docs.min.index-BCcol5vU.js +1 -0
- package/dist/redocly-openapi-docs.min.index-C6uU_v-b.js +1 -0
- package/dist/redocly-openapi-docs.min.index-CmXZfuiZ.js +7730 -0
- package/dist/redocly-openapi-docs.min.index-DVWw0ICA.js +1 -0
- package/dist/redocly-openapi-docs.min.index-YnvLQkG_.js +1 -0
- package/dist/redocly-openapi-docs.min.index-xl_tBaHD.js +1 -0
- package/dist/redocly-openapi-docs.min.js +1 -1
- package/dist/{redocly-openapi-docs.min.lint-C-zlwxhp.js → redocly-openapi-docs.min.lint-2YpbCz3r.js} +69 -69
- package/dist/{redocly-openapi-docs.min.lint-graphql-qEh9cZHx.js → redocly-openapi-docs.min.lint-graphql-Bgfcu2tP.js} +1 -1
- package/dist/redocly-openapi-docs.min.periodic-revalidation-Dsp-n7ui.js +1 -0
- package/dist/redocly-openapi-docs.min.promise-map-limit-Db_42GvV.js +1 -0
- package/dist/{redocly-openapi-docs.min.respect-run-hfNPYQ9x.js → redocly-openapi-docs.min.respect-run-Ct8taisL.js} +1 -1
- package/dist/redocly-openapi-docs.min.standalone-BPCdJgtH.js +11995 -0
- package/dist/redocly-openapi-docs.min.tauri-path-CmqBCxGb.js +1 -0
- package/dist/{redocly-openapi-docs.min.useAiChatQueries-DgSsCKMW.js → redocly-openapi-docs.min.useAiChatQueries-t8oy8jik.js} +80 -80
- package/lib/components/ApiInfo/__tests__/ApiInfo.test.d.ts +1 -0
- package/lib/components/ApiInfo/__tests__/ApiInfo.test.js +46 -0
- package/lib/components/Callbacks/CallbackOperation.js +1 -1
- package/lib/components/Callbacks/__tests__/Callbacks.test.d.ts +1 -0
- package/lib/components/Callbacks/__tests__/Callbacks.test.js +46 -0
- package/lib/components/Content/__tests__/useAutoScroll.test.d.ts +1 -0
- package/lib/components/Content/__tests__/useAutoScroll.test.js +88 -0
- package/lib/components/Content/useAutoScroll.js +1 -1
- package/lib/components/ContentItem/__tests__/useIsExpanded.test.d.ts +1 -0
- package/lib/components/ContentItem/__tests__/useIsExpanded.test.js +123 -0
- package/lib/components/ContentItem/useIsExpanded.js +1 -1
- package/lib/components/ContentItems/ContentItems.js +1 -1
- package/lib/components/ContentItems/VirtualList.js +1 -1
- package/lib/components/ContentItems/__tests__/Items.test.d.ts +1 -0
- package/lib/components/ContentItems/__tests__/Items.test.js +66 -0
- package/lib/components/ContentItems/__tests__/VirtualList.test.d.ts +1 -0
- package/lib/components/ContentItems/__tests__/VirtualList.test.js +135 -0
- package/lib/components/ContentItems/useScrollOnRender.js +1 -1
- package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.d.ts +1 -0
- package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.js +63 -0
- package/lib/components/Download/__tests__/DownloadSpecification.test.d.ts +1 -0
- package/lib/components/Download/__tests__/DownloadSpecification.test.js +52 -0
- package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.d.ts +1 -0
- package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.js +60 -0
- package/lib/components/ExpandAllButton/__tests__/helpers.test.d.ts +1 -0
- package/lib/components/ExpandAllButton/__tests__/helpers.test.js +133 -0
- package/lib/components/Language/__tests__/LanguageDropdown.test.d.ts +1 -0
- package/lib/components/Language/__tests__/LanguageDropdown.test.js +23 -0
- package/lib/components/Markdown/__tests__/Markdown.test.d.ts +1 -0
- package/lib/components/Markdown/__tests__/Markdown.test.js +34 -0
- package/lib/components/McpOverview/__tests__/McpOverview.test.d.ts +1 -0
- package/lib/components/McpOverview/__tests__/McpOverview.test.js +66 -0
- package/lib/components/McpTool/__tests__/McpPrompt.test.d.ts +1 -0
- package/lib/components/McpTool/__tests__/McpPrompt.test.js +57 -0
- package/lib/components/McpTool/__tests__/McpResource.test.d.ts +1 -0
- package/lib/components/McpTool/__tests__/McpResource.test.js +81 -0
- package/lib/components/McpTool/__tests__/McpTool.test.d.ts +1 -0
- package/lib/components/McpTool/__tests__/McpTool.test.js +82 -0
- package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.d.ts +1 -0
- package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.js +79 -0
- package/lib/components/OperationItem/__tests__/OperationItem.test.d.ts +1 -0
- package/lib/components/OperationItem/__tests__/OperationItem.test.js +70 -0
- package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.d.ts +16 -0
- package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.js +42 -0
- package/lib/components/Overview/__tests__/Overview.test.d.ts +1 -0
- package/lib/components/Overview/__tests__/Overview.test.js +59 -0
- package/lib/components/PayloadSamples/__tests__/Example.test.d.ts +1 -0
- package/lib/components/PayloadSamples/__tests__/Example.test.js +36 -0
- package/lib/components/PayloadSamples/__tests__/ExampleValue.test.d.ts +1 -0
- package/lib/components/PayloadSamples/__tests__/ExampleValue.test.js +197 -0
- package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.d.ts +1 -0
- package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.js +38 -0
- package/lib/components/PropertyDetails/__tests__/Extensions.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/Extensions.test.js +21 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetail.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetail.test.js +52 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetails.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/FieldDetails.test.js +191 -0
- package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.js +365 -0
- package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.d.ts +1 -0
- package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.js +23 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.d.ts +1 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.js +16 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.d.ts +1 -0
- package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.js +104 -0
- package/lib/components/RenderHook/__tests__/RenderHook.test.d.ts +1 -0
- package/lib/components/RenderHook/__tests__/RenderHook.test.js +15 -0
- package/lib/components/Replay/__tests__/utils.test.d.ts +1 -0
- package/lib/components/Replay/__tests__/utils.test.js +526 -0
- package/lib/components/Request/__tests__/RequestDetails.test.d.ts +1 -0
- package/lib/components/Request/__tests__/RequestDetails.test.js +98 -0
- package/lib/components/RequestSamples/__tests__/Example.test.d.ts +1 -0
- package/lib/components/RequestSamples/__tests__/Example.test.js +384 -0
- package/lib/components/RequestSamples/__tests__/RequestSamples.test.d.ts +1 -0
- package/lib/components/RequestSamples/__tests__/RequestSamples.test.js +226 -0
- package/lib/components/RequestSamples/__tests__/useCodeSamples.test.d.ts +1 -0
- package/lib/components/RequestSamples/__tests__/useCodeSamples.test.js +64 -0
- package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.d.ts +1 -0
- package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.js +29 -0
- package/lib/components/Responses/OperationResponseList.js +1 -1
- package/lib/components/Responses/__tests__/OperationResponseList.test.d.ts +1 -0
- package/lib/components/Responses/__tests__/OperationResponseList.test.js +89 -0
- package/lib/components/Responses/__tests__/ResponseDetails.test.d.ts +1 -0
- package/lib/components/Responses/__tests__/ResponseDetails.test.js +111 -0
- package/lib/components/Responses/__tests__/ResponsesHeaders.test.d.ts +1 -0
- package/lib/components/Responses/__tests__/ResponsesHeaders.test.js +26 -0
- package/lib/components/Schema/Schema.js +1 -1
- package/lib/components/Schema/SubSchema.js +1 -1
- package/lib/components/Schema/__tests__/ArraySchema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/ArraySchema.test.js +93 -0
- package/lib/components/Schema/__tests__/ObjectSchema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/ObjectSchema.test.js +115 -0
- package/lib/components/Schema/__tests__/OneOfSchema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/OneOfSchema.test.js +33 -0
- package/lib/components/Schema/__tests__/Schema.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/Schema.test.js +67 -0
- package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.d.ts +1 -0
- package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.js +22 -0
- package/lib/components/Schema/useOneOfLocationIdx.js +1 -1
- package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.d.ts +1 -0
- package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.js +95 -0
- package/lib/components/Security/__tests__/Security.test.d.ts +1 -0
- package/lib/components/Security/__tests__/Security.test.js +38 -0
- package/lib/components/Security/__tests__/SecurityButton.test.d.ts +1 -0
- package/lib/components/Security/__tests__/SecurityButton.test.js +92 -0
- package/lib/components/Security/__tests__/SecurityModal.test.d.ts +1 -0
- package/lib/components/Security/__tests__/SecurityModal.test.js +172 -0
- package/lib/components/ServerList/__tests__/ServerList.test.d.ts +1 -0
- package/lib/components/ServerList/__tests__/ServerList.test.js +83 -0
- package/lib/components/SideMenu/hooks/useMenuItems.js +1 -1
- package/lib/components/StickySidebar/StickyResponsiveSidebar.js +1 -1
- package/lib/components/Tabs/__tests__/Tabs.test.d.ts +1 -0
- package/lib/components/Tabs/__tests__/Tabs.test.js +27 -0
- package/lib/components/TagItem/OperationsNavigation.js +1 -1
- package/lib/components/TagItem/TagItem.js +1 -1
- package/lib/components/ViewNested/__tests__/ViewNested.test.d.ts +1 -0
- package/lib/components/ViewNested/__tests__/ViewNested.test.js +42 -0
- package/lib/components/__tests__/Samples/ExampleSwitch.test.d.ts +1 -0
- package/lib/components/__tests__/Samples/ExampleSwitch.test.js +45 -0
- package/lib/components/__tests__/Samples/use-example-key.test.d.ts +1 -0
- package/lib/components/__tests__/Samples/use-example-key.test.js +28 -0
- package/lib/components/__tests__/common/ClearButton.test.d.ts +1 -0
- package/lib/components/__tests__/common/ClearButton.test.js +18 -0
- package/lib/components/__tests__/common/Dropdown.test.d.ts +1 -0
- package/lib/components/__tests__/common/Dropdown.test.js +52 -0
- package/lib/components/__tests__/mocks/examples.d.ts +4 -0
- package/lib/components/__tests__/mocks/examples.js +115 -0
- package/lib/components/common/LinkToField.js +1 -1
- package/lib/components/common/__tests__/Dropdown.test.d.ts +1 -0
- package/lib/components/common/__tests__/Dropdown.test.js +129 -0
- package/lib/components/common/__tests__/LinkToField.test.d.ts +1 -0
- package/lib/components/common/__tests__/LinkToField.test.js +39 -0
- package/lib/components/common/linkify.js +1 -1
- package/lib/hooks/useRouter.js +1 -1
- package/lib/hooks/useUppercase2LowercaseRedirect.js +1 -1
- package/lib/jotai/__tests__/app.test.d.ts +1 -0
- package/lib/jotai/__tests__/app.test.js +53 -0
- package/lib/models/__tests__/Callback.test.d.ts +1 -0
- package/lib/models/__tests__/Callback.test.js +15 -0
- package/lib/models/__tests__/FieldModel.test.d.ts +1 -0
- package/lib/models/__tests__/FieldModel.test.js +117 -0
- package/lib/models/__tests__/MediaContent.test.d.ts +1 -0
- package/lib/models/__tests__/MediaContent.test.js +105 -0
- package/lib/models/__tests__/Operation.test.d.ts +1 -0
- package/lib/models/__tests__/Operation.test.js +459 -0
- package/lib/models/__tests__/Response.test.d.ts +1 -0
- package/lib/models/__tests__/Response.test.js +221 -0
- package/lib/models/__tests__/Schema.circular.test.d.ts +1 -0
- package/lib/models/__tests__/Schema.circular.test.js +694 -0
- package/lib/models/__tests__/Schema.test.d.ts +1 -0
- package/lib/models/__tests__/Schema.test.js +1395 -0
- package/lib/models/__tests__/example.test.d.ts +1 -0
- package/lib/models/__tests__/example.test.js +90 -0
- package/lib/models/__tests__/group.test.d.ts +1 -0
- package/lib/models/__tests__/group.test.js +52 -0
- package/lib/models/__tests__/helpers.d.ts +5 -0
- package/lib/models/__tests__/helpers.js +62 -0
- package/lib/models/__tests__/request.test.d.ts +1 -0
- package/lib/models/__tests__/request.test.js +119 -0
- package/lib/services/__tests__/OpenAPIParser.test.d.ts +1 -0
- package/lib/services/__tests__/OpenAPIParser.test.js +80 -0
- package/lib/services/__tests__/check.test.d.ts +1 -0
- package/lib/services/__tests__/check.test.js +22 -0
- package/lib/services/__tests__/utils.test.d.ts +1 -0
- package/lib/services/__tests__/utils.test.js +42 -0
- package/lib/services/code-samples/__tests__/apply-environments.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/apply-environments.test.js +64 -0
- package/lib/services/code-samples/__tests__/build-code-samples.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/build-code-samples.test.js +70 -0
- package/lib/services/code-samples/__tests__/convertSampleToString.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/convertSampleToString.test.js +116 -0
- package/lib/services/code-samples/__tests__/generator-data-value.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/generator-data-value.test.js +277 -0
- package/lib/services/code-samples/__tests__/generator-serialized-value.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/generator-serialized-value.test.js +258 -0
- package/lib/services/code-samples/__tests__/generator-value.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/generator-value.test.js +273 -0
- package/lib/services/code-samples/__tests__/generator.test.d.ts +249 -0
- package/lib/services/code-samples/__tests__/generator.test.js +1201 -0
- package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.d.ts +1 -0
- package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.js +31 -0
- package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.js +222 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.js +129 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.js +49 -0
- package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.js +172 -0
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.js +172 -0
- package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.js +130 -0
- package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.js +191 -0
- package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.js +172 -0
- package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.js +85 -0
- package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.js +85 -0
- package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.js +126 -0
- package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.js +105 -0
- package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.js +126 -0
- package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.js +129 -0
- package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.js +129 -0
- package/lib/services/config-options/__tests__/helpers.test.d.ts +1 -0
- package/lib/services/config-options/__tests__/helpers.test.js +234 -0
- package/lib/services/history/__tests__/helpers.test.d.ts +1 -0
- package/lib/services/history/__tests__/helpers.test.js +19 -0
- package/lib/services/menu/__tests__/buildNestedTagsItems.test.d.ts +1 -0
- package/lib/services/menu/__tests__/buildNestedTagsItems.test.js +109 -0
- package/lib/services/menu/__tests__/builder.test.d.ts +1 -0
- package/lib/services/menu/__tests__/builder.test.js +307 -0
- package/lib/services/menu/__tests__/operation.test.d.ts +1 -0
- package/lib/services/menu/__tests__/operation.test.js +240 -0
- package/lib/services/menu/__tests__/tags.test.d.ts +1 -0
- package/lib/services/menu/__tests__/tags.test.js +71 -0
- package/lib/telemetry/RedocTelemetry.js +31 -1
- package/lib/telemetry/__tests__/RedocTelemetry.test.d.ts +1 -0
- package/lib/telemetry/__tests__/RedocTelemetry.test.js +107 -0
- package/lib/testProviders.d.ts +6 -0
- package/lib/testProviders.js +14 -0
- package/lib/utils/__tests__/areArraysEqual.test.d.ts +1 -0
- package/lib/utils/__tests__/areArraysEqual.test.js +33 -0
- package/lib/utils/__tests__/argValuesHelpers.d.ts +1 -0
- package/lib/utils/__tests__/argValuesHelpers.js +56 -0
- package/lib/utils/__tests__/calculateMaxLength.test.d.ts +1 -0
- package/lib/utils/__tests__/calculateMaxLength.test.js +119 -0
- package/lib/utils/__tests__/configure-helpers.test.d.ts +1 -0
- package/lib/utils/__tests__/configure-helpers.test.js +356 -0
- package/lib/utils/__tests__/convertSwagger2OpenAPI.test.d.ts +1 -0
- package/lib/utils/__tests__/convertSwagger2OpenAPI.test.js +392 -0
- package/lib/utils/__tests__/debounce.test.d.ts +1 -0
- package/lib/utils/__tests__/debounce.test.js +54 -0
- package/lib/utils/__tests__/debug.test.d.ts +1 -0
- package/lib/utils/__tests__/debug.test.js +23 -0
- package/lib/utils/__tests__/dom.test.d.ts +1 -0
- package/lib/utils/__tests__/dom.test.js +108 -0
- package/lib/utils/__tests__/getBreadcrumbs.test.d.ts +1 -0
- package/lib/utils/__tests__/getBreadcrumbs.test.js +98 -0
- package/lib/utils/__tests__/hasNestedFields.test.d.ts +1 -0
- package/lib/utils/__tests__/hasNestedFields.test.js +147 -0
- package/lib/utils/__tests__/helpers.test.d.ts +1 -0
- package/lib/utils/__tests__/helpers.test.js +174 -0
- package/lib/utils/__tests__/isMobile.test.d.ts +1 -0
- package/lib/utils/__tests__/isMobile.test.js +28 -0
- package/lib/utils/__tests__/loadAndBundleSpec.test.d.ts +1 -0
- package/lib/utils/__tests__/loadAndBundleSpec.test.js +22 -0
- package/lib/utils/__tests__/local-storage.test.d.ts +1 -0
- package/lib/utils/__tests__/local-storage.test.js +48 -0
- package/lib/utils/__tests__/object.test.d.ts +1 -0
- package/lib/utils/__tests__/object.test.js +45 -0
- package/lib/utils/__tests__/openapi.test.d.ts +1 -0
- package/lib/utils/__tests__/openapi.test.js +1378 -0
- package/lib/utils/__tests__/path.test.d.ts +1 -0
- package/lib/utils/__tests__/path.test.js +16 -0
- package/lib/utils/__tests__/queryString.test.d.ts +1 -0
- package/lib/utils/__tests__/queryString.test.js +60 -0
- package/lib/utils/__tests__/replaceVariables.test.d.ts +1 -0
- package/lib/utils/__tests__/replaceVariables.test.js +46 -0
- package/lib/utils/__tests__/simplifyAstStructure.test.d.ts +1 -0
- package/lib/utils/__tests__/simplifyAstStructure.test.js +26 -0
- package/lib/utils/__tests__/sort.test.d.ts +1 -0
- package/lib/utils/__tests__/sort.test.js +16 -0
- package/lib/utils/__tests__/string.test.d.ts +1 -0
- package/lib/utils/__tests__/string.test.js +16 -0
- package/lib/utils/__tests__/theme-helpers.test.d.ts +1 -0
- package/lib/utils/__tests__/theme-helpers.test.js +24 -0
- package/lib/utils/__tests__/url.test.d.ts +1 -0
- package/lib/utils/__tests__/url.test.js +134 -0
- package/lib/utils/path.d.ts +1 -1
- package/package.json +12 -12
- package/dist/redocly-openapi-docs.min.ai-chat-mappers-MY79QAeW.js +0 -1
- package/dist/redocly-openapi-docs.min.external-resolver-3KMJv7SC.js +0 -2
- package/dist/redocly-openapi-docs.min.index-BYVMr_la.js +0 -1
- package/dist/redocly-openapi-docs.min.index-CsqzTi3Z.js +0 -7586
- package/dist/redocly-openapi-docs.min.index-D8F7x0S6.js +0 -1
- package/dist/redocly-openapi-docs.min.index-qqKTpI_q.js +0 -1
- package/dist/redocly-openapi-docs.min.standalone-Ci6886Cr.js +0 -12114
- package/dist/redocly-openapi-docs.min.tauri-path-Bs1-AQjc.js +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import * as Jotai from 'jotai';
|
|
4
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
5
|
+
import { getSchema } from '../../../models/index.js';
|
|
6
|
+
import schemasExpansionLevel from './fixtures/schemaExpansionLevel.json';
|
|
7
|
+
import { Schema } from '../Schema.js';
|
|
8
|
+
import { TestBrowserRouter } from '../../../testProviders.js';
|
|
9
|
+
const options = normalizeOptions({});
|
|
10
|
+
vi.mock('jotai', async () => ({
|
|
11
|
+
...(await vi.importActual('jotai')),
|
|
12
|
+
useAtomValue: vi.fn(),
|
|
13
|
+
}));
|
|
14
|
+
describe('ArraySchema', () => {
|
|
15
|
+
it("should render Schema with Array when schemasExpansionLevel is 'all'", async () => {
|
|
16
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({ schemasExpansionLevel: 'all' }));
|
|
17
|
+
const parser = new OpenAPIParser(schemasExpansionLevel, undefined, options);
|
|
18
|
+
const schema = getSchema({
|
|
19
|
+
parser,
|
|
20
|
+
schemaOrRef: schemasExpansionLevel.components.schemas.User,
|
|
21
|
+
pointer: '',
|
|
22
|
+
options,
|
|
23
|
+
deps: {
|
|
24
|
+
operation: {
|
|
25
|
+
pointer: 'schemasExpansionLevel',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
const { getByText } = render(_jsx(Schema, { schema: schema }), {
|
|
30
|
+
wrapper: TestBrowserRouter,
|
|
31
|
+
});
|
|
32
|
+
expect(getByText('Dumb Property 3')).toBeInTheDocument();
|
|
33
|
+
});
|
|
34
|
+
it("should render Schema with Array when schemasExpansionLevel is '3'", async () => {
|
|
35
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({ schemasExpansionLevel: '3' }));
|
|
36
|
+
const parser = new OpenAPIParser(schemasExpansionLevel, undefined, options);
|
|
37
|
+
const schema = getSchema({
|
|
38
|
+
parser,
|
|
39
|
+
schemaOrRef: schemasExpansionLevel.components.schemas.User,
|
|
40
|
+
pointer: '',
|
|
41
|
+
options,
|
|
42
|
+
deps: {
|
|
43
|
+
operation: {
|
|
44
|
+
pointer: 'schemasExpansionLevel',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
const { getByText, queryByText } = render(_jsx(Schema, { schema: schema }), {
|
|
49
|
+
wrapper: TestBrowserRouter,
|
|
50
|
+
});
|
|
51
|
+
expect(getByText('Dumb Property 1')).toBeInTheDocument();
|
|
52
|
+
expect(queryByText('Dumb Property 2')).toBeInTheDocument();
|
|
53
|
+
});
|
|
54
|
+
it('should automatically expand nested array when parent element is expanded', async () => {
|
|
55
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({ schemasExpansionLevel: '4' }));
|
|
56
|
+
const parser = new OpenAPIParser(schemasExpansionLevel, undefined, options);
|
|
57
|
+
const schema = getSchema({
|
|
58
|
+
parser,
|
|
59
|
+
schemaOrRef: schemasExpansionLevel.components.schemas.User,
|
|
60
|
+
pointer: '',
|
|
61
|
+
options,
|
|
62
|
+
deps: {
|
|
63
|
+
operation: {
|
|
64
|
+
pointer: 'schemasExpansionLevel',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
const { getByText } = render(_jsx(Schema, { schema: schema }), {
|
|
69
|
+
wrapper: TestBrowserRouter,
|
|
70
|
+
});
|
|
71
|
+
expect(getByText('Dumb Property 1 in nested array')).toBeInTheDocument();
|
|
72
|
+
});
|
|
73
|
+
it("should not render inner Schema with Array when schemasExpansionLevel is '0'", async () => {
|
|
74
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({ schemasExpansionLevel: '0' }));
|
|
75
|
+
const parser = new OpenAPIParser(schemasExpansionLevel, undefined, options);
|
|
76
|
+
const schema = getSchema({
|
|
77
|
+
parser,
|
|
78
|
+
schemaOrRef: schemasExpansionLevel.components.schemas.User,
|
|
79
|
+
pointer: '',
|
|
80
|
+
options,
|
|
81
|
+
deps: {
|
|
82
|
+
operation: {
|
|
83
|
+
pointer: 'schemasExpansionLevel',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
const { queryByText } = render(_jsx(Schema, { schema: schema }), {
|
|
88
|
+
wrapper: TestBrowserRouter,
|
|
89
|
+
});
|
|
90
|
+
expect(queryByText('Dumb Property')).toBeNull();
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=ArraySchema.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import * as Jotai from 'jotai';
|
|
4
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
5
|
+
import { getSchema } from '../../../models/index.js';
|
|
6
|
+
import schemasExpansionLevel from './fixtures/schemaExpansionLevel.json';
|
|
7
|
+
import requiredField from './fixtures/requiredField.json';
|
|
8
|
+
import { Schema } from '../Schema.js';
|
|
9
|
+
import { TestBrowserRouter } from '../../../testProviders.js';
|
|
10
|
+
const options = normalizeOptions({});
|
|
11
|
+
vi.mock('jotai', async () => ({
|
|
12
|
+
...(await vi.importActual('jotai')),
|
|
13
|
+
useAtomValue: vi.fn(),
|
|
14
|
+
}));
|
|
15
|
+
describe('ObjectSchema', () => {
|
|
16
|
+
it("should render Schema when schemasExpansionLevel is 'all'", async () => {
|
|
17
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({ schemasExpansionLevel: 'all' }));
|
|
18
|
+
const parser = new OpenAPIParser(schemasExpansionLevel, undefined, options);
|
|
19
|
+
const schema = getSchema({
|
|
20
|
+
parser,
|
|
21
|
+
schemaOrRef: schemasExpansionLevel.components.schemas.Pet,
|
|
22
|
+
pointer: '',
|
|
23
|
+
options,
|
|
24
|
+
deps: {
|
|
25
|
+
operation: {
|
|
26
|
+
pointer: 'schemasExpansionLevel',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const { getByText } = render(_jsx(Schema, { schema: schema }), {
|
|
31
|
+
wrapper: TestBrowserRouter,
|
|
32
|
+
});
|
|
33
|
+
expect(getByText('Dumb Property 6')).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
it("should render Schema when schemasExpansionLevel is '3'", async () => {
|
|
36
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({ schemasExpansionLevel: '3' }));
|
|
37
|
+
const parser = new OpenAPIParser(schemasExpansionLevel, undefined, options);
|
|
38
|
+
const schema = getSchema({
|
|
39
|
+
parser,
|
|
40
|
+
schemaOrRef: schemasExpansionLevel.components.schemas.Pet,
|
|
41
|
+
pointer: '',
|
|
42
|
+
options,
|
|
43
|
+
deps: {
|
|
44
|
+
operation: {
|
|
45
|
+
pointer: 'schemasExpansionLevel',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
const { getByText, queryByText } = render(_jsx(Schema, { schema: schema }), {
|
|
50
|
+
wrapper: TestBrowserRouter,
|
|
51
|
+
});
|
|
52
|
+
expect(getByText('Dumb Property 3')).toBeInTheDocument();
|
|
53
|
+
expect(queryByText('Dumb Property 4')).toBeNull();
|
|
54
|
+
});
|
|
55
|
+
it("should not render inner Schema when schemasExpansionLevel is '0'", async () => {
|
|
56
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({ schemasExpansionLevel: '0' }));
|
|
57
|
+
const parser = new OpenAPIParser(schemasExpansionLevel, undefined, options);
|
|
58
|
+
const schema = getSchema({
|
|
59
|
+
parser,
|
|
60
|
+
schemaOrRef: schemasExpansionLevel.components.schemas.Pet,
|
|
61
|
+
pointer: '',
|
|
62
|
+
options,
|
|
63
|
+
deps: {
|
|
64
|
+
operation: {
|
|
65
|
+
pointer: 'schemasExpansionLevel',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
const { queryByText } = render(_jsx(Schema, { schema: schema }), {
|
|
70
|
+
wrapper: TestBrowserRouter,
|
|
71
|
+
});
|
|
72
|
+
expect(queryByText('Test Sub Category')).toBeNull();
|
|
73
|
+
});
|
|
74
|
+
it("should render Schema when required is 'category' -> 'sub'", async () => {
|
|
75
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({}));
|
|
76
|
+
const parser = new OpenAPIParser(requiredField, undefined, options);
|
|
77
|
+
const schema = getSchema({
|
|
78
|
+
parser,
|
|
79
|
+
schemaOrRef: requiredField.components.schemas.Pet,
|
|
80
|
+
pointer: '',
|
|
81
|
+
options,
|
|
82
|
+
deps: {
|
|
83
|
+
operation: {
|
|
84
|
+
pointer: 'schemasExpansionLevel',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
const { getByText, queryByText } = render(_jsx(Schema, { schema: schema }), {
|
|
89
|
+
wrapper: TestBrowserRouter,
|
|
90
|
+
});
|
|
91
|
+
expect(getByText('Dumb Property 2')).toBeInTheDocument();
|
|
92
|
+
expect(queryByText('Dumb Property 3')).toBeNull();
|
|
93
|
+
});
|
|
94
|
+
it("should render Schema when required is 'tags' -> 'sub' at Array schema", async () => {
|
|
95
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({}));
|
|
96
|
+
const parser = new OpenAPIParser(requiredField, undefined, options);
|
|
97
|
+
const schema = getSchema({
|
|
98
|
+
parser,
|
|
99
|
+
schemaOrRef: requiredField.components.schemas.User,
|
|
100
|
+
pointer: '',
|
|
101
|
+
options,
|
|
102
|
+
deps: {
|
|
103
|
+
operation: {
|
|
104
|
+
pointer: 'schemasExpansionLevel',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
const { getByText, queryByText } = render(_jsx(Schema, { schema: schema }), {
|
|
109
|
+
wrapper: TestBrowserRouter,
|
|
110
|
+
});
|
|
111
|
+
expect(getByText('Dumb Property 1')).toBeInTheDocument();
|
|
112
|
+
expect(queryByText('Dumb Property 2')).toBeNull();
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
//# sourceMappingURL=ObjectSchema.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
4
|
+
import { getSchema } from '../../../models/index.js';
|
|
5
|
+
import oneOfWithDiscriminator from './fixtures/oneOfWithDiscriminator.json';
|
|
6
|
+
import { Schema } from '../Schema.js';
|
|
7
|
+
import { TestBrowserRouter } from '../../../testProviders.js';
|
|
8
|
+
const options = normalizeOptions({});
|
|
9
|
+
describe('OneOfSchema', () => {
|
|
10
|
+
it('should render correct oneOf and discriminator based on deep link', () => {
|
|
11
|
+
const parser = new OpenAPIParser(oneOfWithDiscriminator, undefined, options);
|
|
12
|
+
const schema = getSchema({
|
|
13
|
+
parser,
|
|
14
|
+
schemaOrRef: { $ref: '#/components/schemas/OneOfSchema' },
|
|
15
|
+
pointer: '',
|
|
16
|
+
options,
|
|
17
|
+
deps: {
|
|
18
|
+
operation: {
|
|
19
|
+
pointer: '/paths/schema',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
absolutePointer: '/paths/schema',
|
|
23
|
+
});
|
|
24
|
+
history.pushState({}, '', 'user/createuser#user/createuser/t=request&path=pet&oneof=1&d=1&oneof=0');
|
|
25
|
+
const { getByText } = render(_jsx(Schema, { schema: schema }), {
|
|
26
|
+
wrapper: TestBrowserRouter,
|
|
27
|
+
});
|
|
28
|
+
expect(getByText('Type of the shape - Shape')).toBeInTheDocument();
|
|
29
|
+
expect(getByText('Whether or not the triangle is equilateral')).toBeInTheDocument();
|
|
30
|
+
expect(getByText('Perimeter of the Equilateral')).toBeInTheDocument();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=OneOfSchema.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { act, fireEvent, render } from '@testing-library/react';
|
|
3
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
4
|
+
import { getSchema } from '../../../models/index.js';
|
|
5
|
+
import oneOfWithDiscriminator from './fixtures/oneOfWithDiscriminator.json';
|
|
6
|
+
import singleOneOf from './fixtures/singleOneOf.json';
|
|
7
|
+
import { Schema } from '../Schema.js';
|
|
8
|
+
import { TestBrowserRouter } from '../../../testProviders.js';
|
|
9
|
+
const options = normalizeOptions({});
|
|
10
|
+
describe('SchemaView', () => {
|
|
11
|
+
describe('OneOf', () => {
|
|
12
|
+
it('should render oneOf with a single item and display its schema fields', () => {
|
|
13
|
+
const parser = new OpenAPIParser(singleOneOf, undefined, options);
|
|
14
|
+
const schema = getSchema({
|
|
15
|
+
parser,
|
|
16
|
+
schemaOrRef: singleOneOf.paths['/example'].get.responses['200'].content['application/json'].schema,
|
|
17
|
+
pointer: '',
|
|
18
|
+
options,
|
|
19
|
+
deps: {
|
|
20
|
+
operation: {
|
|
21
|
+
pointer: '/paths/example',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
absolutePointer: '/paths/example',
|
|
25
|
+
});
|
|
26
|
+
const { getByText } = render(_jsx(Schema, { schema: schema }), {
|
|
27
|
+
wrapper: TestBrowserRouter,
|
|
28
|
+
});
|
|
29
|
+
expect(getByText('One of:')).toBeInTheDocument();
|
|
30
|
+
expect(getByText('UserResponse')).toBeInTheDocument();
|
|
31
|
+
expect(getByText('type')).toBeInTheDocument();
|
|
32
|
+
expect(getByText('data')).toBeInTheDocument();
|
|
33
|
+
});
|
|
34
|
+
it('should render oneOf with a discriminator without affecting each other', () => {
|
|
35
|
+
const parser = new OpenAPIParser(oneOfWithDiscriminator, undefined, options);
|
|
36
|
+
const schema = getSchema({
|
|
37
|
+
parser,
|
|
38
|
+
schemaOrRef: { $ref: '#/components/schemas/OneOfSchema' },
|
|
39
|
+
pointer: '',
|
|
40
|
+
options,
|
|
41
|
+
deps: {
|
|
42
|
+
operation: {
|
|
43
|
+
pointer: '/paths/schema',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
absolutePointer: '/paths/schema',
|
|
47
|
+
});
|
|
48
|
+
const { getByText } = render(_jsx(Schema, { schema: schema }), {
|
|
49
|
+
wrapper: TestBrowserRouter,
|
|
50
|
+
});
|
|
51
|
+
expect(getByText('Shape')).toBeInTheDocument();
|
|
52
|
+
act(() => {
|
|
53
|
+
fireEvent.click(getByText('Shape'));
|
|
54
|
+
});
|
|
55
|
+
expect(getByText('Discriminator')).toBeInTheDocument();
|
|
56
|
+
expect(getByText('square')).toBeInTheDocument();
|
|
57
|
+
expect(getByText('triangle')).toBeInTheDocument();
|
|
58
|
+
expect(getByText('sideLength')).toBeInTheDocument();
|
|
59
|
+
act(() => {
|
|
60
|
+
fireEvent.click(getByText('triangle'));
|
|
61
|
+
});
|
|
62
|
+
expect(getByText('equilateral')).toBeInTheDocument();
|
|
63
|
+
expect(getByText('Whether or not the triangle is equilateral')).toBeInTheDocument();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=Schema.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
|
+
import { useOneOfLocationIdx } from '../useOneOfLocationIdx.js';
|
|
3
|
+
vi.mock('react-router', () => ({
|
|
4
|
+
useLocation: vi.fn().mockReturnValue({
|
|
5
|
+
hash: '#plans/postplan/t=request&path=&oneof=1/trial&oneof=0/period',
|
|
6
|
+
}),
|
|
7
|
+
}));
|
|
8
|
+
describe('useOneOfLocationIdx', () => {
|
|
9
|
+
it('should return the index of the oneOf item in the hash', () => {
|
|
10
|
+
const oneOf = [{}, {}, {}];
|
|
11
|
+
const level = 1;
|
|
12
|
+
const { result } = renderHook(() => useOneOfLocationIdx(oneOf, level));
|
|
13
|
+
expect(result.current).toBe(1);
|
|
14
|
+
});
|
|
15
|
+
it('should return -1 if the oneOf item is not found in the hash', () => {
|
|
16
|
+
const oneOf = [{}, {}, {}];
|
|
17
|
+
const level = 3;
|
|
18
|
+
const { result } = renderHook(() => useOneOfLocationIdx(oneOf, level));
|
|
19
|
+
expect(result.current).toBe(-1);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=useOneOfLocationIdx.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useLocation as s}from"react-router
|
|
1
|
+
import{useLocation as s}from"react-router";import{useMemo as r}from"react";const i=/(?=oneof=)/g;function m(o,n){const t=s();return r(()=>o.findIndex((c,e)=>t.hash.split(i)[n]?.includes(`oneof=${e}`)),[n,t.hash,o])}export{m as useOneOfLocationIdx};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, fireEvent } from '@testing-library/react';
|
|
3
|
+
import * as Jotai from 'jotai';
|
|
4
|
+
import { ClipboardService } from '@redocly/theme/core/openapi';
|
|
5
|
+
import { SchemaCatalogLink } from '../SchemaCatalogLink.js';
|
|
6
|
+
vi.mock('jotai', async () => ({
|
|
7
|
+
...(await vi.importActual('jotai')),
|
|
8
|
+
useAtomValue: vi.fn(),
|
|
9
|
+
}));
|
|
10
|
+
vi.mock('../../../utils/dom', async () => ({
|
|
11
|
+
...(await vi.importActual('../../../utils/dom')),
|
|
12
|
+
IS_BROWSER: true,
|
|
13
|
+
}));
|
|
14
|
+
vi.mock('@redocly/theme/core/openapi', async () => {
|
|
15
|
+
const actual = await vi.importActual('@redocly/theme/core/openapi');
|
|
16
|
+
const actualClipboard = actual.ClipboardService;
|
|
17
|
+
return {
|
|
18
|
+
...actual,
|
|
19
|
+
ClipboardService: {
|
|
20
|
+
...actualClipboard,
|
|
21
|
+
copyCustom: vi.fn(),
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
describe('SchemaCatalogLink', () => {
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
vi.clearAllMocks();
|
|
28
|
+
vi.useFakeTimers();
|
|
29
|
+
Object.defineProperty(global, 'navigator', {
|
|
30
|
+
value: {
|
|
31
|
+
clipboard: {
|
|
32
|
+
writeText: vi.fn(),
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
writable: true,
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
afterEach(() => {
|
|
39
|
+
vi.useRealTimers();
|
|
40
|
+
});
|
|
41
|
+
it('should render correctly', () => {
|
|
42
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue({
|
|
43
|
+
parser: {
|
|
44
|
+
definition: {
|
|
45
|
+
'x-schema-catalog-link': '/_bundle/test.yaml',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
const result = render(_jsx(SchemaCatalogLink, { schemaRef: "#/components/schemas/test" }));
|
|
50
|
+
expect(result.baseElement).toMatchSnapshot();
|
|
51
|
+
});
|
|
52
|
+
it('should not render if x-schema-catalog-link is not defined', () => {
|
|
53
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue({
|
|
54
|
+
parser: {
|
|
55
|
+
definition: {},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
const result = render(_jsx(SchemaCatalogLink, { schemaRef: "#/components/schemas/test" }));
|
|
59
|
+
expect(result.baseElement).toMatchSnapshot();
|
|
60
|
+
});
|
|
61
|
+
it('should render correctly on server', async () => {
|
|
62
|
+
vi.doMock('../../../utils/dom', async () => ({
|
|
63
|
+
...(await vi.importActual('../../../utils/dom')),
|
|
64
|
+
IS_BROWSER: vi.fn().mockReturnValue(false),
|
|
65
|
+
}));
|
|
66
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue({
|
|
67
|
+
parser: {
|
|
68
|
+
definition: {
|
|
69
|
+
'x-schema-catalog-link': '/_bundle/test.yaml',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
const result = render(_jsx(SchemaCatalogLink, { schemaRef: "#/components/schemas/test" }));
|
|
74
|
+
expect(result.baseElement).toMatchSnapshot();
|
|
75
|
+
});
|
|
76
|
+
it('should copy link to clipboard when copy button is clicked', async () => {
|
|
77
|
+
vi.doMock('../../../utils/dom', async () => ({
|
|
78
|
+
...(await vi.importActual('../../../utils/dom')),
|
|
79
|
+
IS_BROWSER: vi.fn().mockReturnValue(true),
|
|
80
|
+
}));
|
|
81
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue({
|
|
82
|
+
parser: {
|
|
83
|
+
definition: {
|
|
84
|
+
'x-schema-catalog-link': '/_bundle/test.yaml',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
const result = render(_jsx(SchemaCatalogLink, { schemaRef: "#/components/schemas/test" }));
|
|
89
|
+
// Find the copy button by role
|
|
90
|
+
const copyButton = result.getByRole('button');
|
|
91
|
+
fireEvent.click(copyButton);
|
|
92
|
+
expect(ClipboardService.copyCustom).toHaveBeenCalled();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=SchemaCatalogLink.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { act, fireEvent, render } from '@testing-library/react';
|
|
3
|
+
import { Security } from '../Security.js';
|
|
4
|
+
vi.mock('jotai', async () => ({
|
|
5
|
+
...(await vi.importActual('jotai')),
|
|
6
|
+
useAtomValue: vi.fn(() => ({ options: { hideSecuritySection: false } })),
|
|
7
|
+
}));
|
|
8
|
+
vi.mock('../SecurityModal', async () => ({
|
|
9
|
+
SecurityModal: vi.fn(() => _jsx("div", { children: "Mocked SecurityModal" })),
|
|
10
|
+
}));
|
|
11
|
+
describe('Security Component', () => {
|
|
12
|
+
it('should not renders SecurityButton initially when securities is empty', () => {
|
|
13
|
+
const { queryByText } = render(_jsx(Security, { securities: [] }));
|
|
14
|
+
expect(queryByText('Security')).not.toBeInTheDocument();
|
|
15
|
+
});
|
|
16
|
+
it('renders SecurityModal when SecurityButton is clicked', async () => {
|
|
17
|
+
const securities = [
|
|
18
|
+
{
|
|
19
|
+
schemes: [
|
|
20
|
+
{
|
|
21
|
+
description: 'For this sample, you can use the api key `special-key` to test the authorization filters.\n',
|
|
22
|
+
type: 'apiKey',
|
|
23
|
+
name: 'api_key',
|
|
24
|
+
in: 'header',
|
|
25
|
+
id: 'api_key',
|
|
26
|
+
sectionId: 'api_key',
|
|
27
|
+
scopes: ['write:pets', 'read:pets'],
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
const { getByRole, getByText } = render(_jsx(Security, { securities: securities }));
|
|
33
|
+
fireEvent.click(getByRole('button', { name: 'View details' }));
|
|
34
|
+
await act(async () => { });
|
|
35
|
+
expect(getByText('Mocked SecurityModal')).toBeInTheDocument();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=Security.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
3
|
+
import { SecurityButton } from '../SecurityButton.js';
|
|
4
|
+
describe('SecurityButton Component', () => {
|
|
5
|
+
const securities = [
|
|
6
|
+
{ schemes: [{ id: 'scheme1' }] },
|
|
7
|
+
{ schemes: [{ id: 'scheme2' }, { id: 'scheme3' }] },
|
|
8
|
+
];
|
|
9
|
+
it('should render the button with `View details` text', () => {
|
|
10
|
+
const { getByRole } = render(_jsx(SecurityButton, { securities: [securities[0]], onClick: () => { } }));
|
|
11
|
+
expect(getByRole('button', { name: 'View details' })).toBeInTheDocument();
|
|
12
|
+
});
|
|
13
|
+
it('should render the panel with correct text for a single security scheme', () => {
|
|
14
|
+
const { getByTestId } = render(_jsx(SecurityButton, { securities: [securities[0]], onClick: () => { } }));
|
|
15
|
+
expect(getByTestId('panel-body')).toHaveTextContent('scheme1');
|
|
16
|
+
});
|
|
17
|
+
it('should render the panel with correct text for multiple Authentication Types', () => {
|
|
18
|
+
const schemas = [
|
|
19
|
+
[{ schemes: [{ id: 'A' }] }, { schemes: [{ id: 'B' }] }], // Should render "A or B"
|
|
20
|
+
[{ schemes: [{ id: 'A' }, { id: 'B' }] }], // Should render "A and B"
|
|
21
|
+
[{ schemes: [{ id: 'A' }, { id: 'B' }] }, { schemes: [{ id: 'C' }, { id: 'D' }] }], // Should render "(A and B) or (C and D)"
|
|
22
|
+
];
|
|
23
|
+
const { getAllByTestId } = render(_jsxs(_Fragment, { children: [_jsx(SecurityButton, { securities: schemas[0], onClick: () => { } }), _jsx(SecurityButton, { securities: schemas[1], onClick: () => { } }), _jsx(SecurityButton, { securities: schemas[2], onClick: () => { } })] }));
|
|
24
|
+
const panelBodies = getAllByTestId('panel-body');
|
|
25
|
+
expect(panelBodies[0]).toHaveTextContent('A or B');
|
|
26
|
+
expect(panelBodies[1]).toHaveTextContent('A and B');
|
|
27
|
+
expect(panelBodies[2]).toHaveTextContent('(A and B) or (C and D)');
|
|
28
|
+
});
|
|
29
|
+
it('shows required scopes for oauth2 schemes (truncated with +N)', () => {
|
|
30
|
+
const securities = [
|
|
31
|
+
{
|
|
32
|
+
schemes: [
|
|
33
|
+
{
|
|
34
|
+
id: 'OAuth2',
|
|
35
|
+
type: 'oauth2',
|
|
36
|
+
scopes: ['read:users', 'write:users', 'admin:users', 'delete:users', 'sudo:users'],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
const { getByTestId } = render(_jsx(SecurityButton, { securities: securities, onClick: () => { } }));
|
|
42
|
+
const body = getByTestId('panel-body');
|
|
43
|
+
expect(body).toHaveTextContent('OAuth2');
|
|
44
|
+
expect(body).toHaveTextContent('Required scopes');
|
|
45
|
+
expect(body).toHaveTextContent('read:users');
|
|
46
|
+
expect(body).toHaveTextContent('write:users');
|
|
47
|
+
expect(body).toHaveTextContent('admin:users');
|
|
48
|
+
expect(body).toHaveTextContent('delete:users');
|
|
49
|
+
expect(body).toHaveTextContent('+1');
|
|
50
|
+
});
|
|
51
|
+
it('allows focusing the +N scope tag with keyboard', () => {
|
|
52
|
+
const securities = [
|
|
53
|
+
{
|
|
54
|
+
schemes: [
|
|
55
|
+
{
|
|
56
|
+
id: 'OAuth2',
|
|
57
|
+
type: 'oauth2',
|
|
58
|
+
scopes: ['read:users', 'write:users', 'admin:users', 'delete:users', 'sudo:users'],
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
const { getByText } = render(_jsx(SecurityButton, { securities: securities, onClick: () => { } }));
|
|
64
|
+
const plusOne = getByText('+1');
|
|
65
|
+
const focusable = plusOne.closest('[role="button"]');
|
|
66
|
+
expect(focusable).not.toBeNull();
|
|
67
|
+
expect(focusable).toHaveAttribute('tabindex', '0');
|
|
68
|
+
});
|
|
69
|
+
it('show truncated scope names for oauth2 schemes', () => {
|
|
70
|
+
const securities = [
|
|
71
|
+
{
|
|
72
|
+
schemes: [
|
|
73
|
+
{
|
|
74
|
+
id: 'OAuth2',
|
|
75
|
+
type: 'oauth2',
|
|
76
|
+
scopes: ['scope:verylongscopenameforoauthsecurityscheme'],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
const { getByTestId } = render(_jsx(SecurityButton, { securities: securities, onClick: () => { } }));
|
|
82
|
+
const body = getByTestId('panel-body');
|
|
83
|
+
expect(body).toHaveTextContent('scope:verylongscopenameforoauths..');
|
|
84
|
+
});
|
|
85
|
+
it('calls the onClick callback when the button is clicked', () => {
|
|
86
|
+
const onClickMock = vi.fn();
|
|
87
|
+
const { getByRole } = render(_jsx(SecurityButton, { securities: securities, onClick: onClickMock }));
|
|
88
|
+
fireEvent.click(getByRole('button', { name: 'View details' }));
|
|
89
|
+
expect(onClickMock).toHaveBeenCalled();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=SecurityButton.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|