@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,52 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, renderHook } from '@testing-library/react';
|
|
3
|
+
import util from 'util';
|
|
4
|
+
import { DownloadSpecification } from '../DownloadSpecification.js';
|
|
5
|
+
import { useDownloadInfo } from '../useDownloadInfo.js';
|
|
6
|
+
Object.defineProperty(global, 'TextEncoder', {
|
|
7
|
+
value: util.TextEncoder,
|
|
8
|
+
});
|
|
9
|
+
describe('DownloadSpecification', () => {
|
|
10
|
+
it('DownloadButton renders correctly without title', () => {
|
|
11
|
+
const downloadUrls = [
|
|
12
|
+
{
|
|
13
|
+
url: 'downloadDefinitionUrlValue.json',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
url: 'downloadDefinitionUrlValue.yaml',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
url: 'downloadDefinitionUrlValue.txt',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
const { result } = renderHook(() => useDownloadInfo({
|
|
23
|
+
downloadUrls,
|
|
24
|
+
}));
|
|
25
|
+
const downloadObjects = result?.current ?? [];
|
|
26
|
+
const { container } = render(_jsx(DownloadSpecification, { downloadObjects: downloadObjects }));
|
|
27
|
+
expect(container).toMatchSnapshot();
|
|
28
|
+
});
|
|
29
|
+
it('DownloadButton renders correctly with title', () => {
|
|
30
|
+
const downloadUrls = [
|
|
31
|
+
{
|
|
32
|
+
title: 'OpenAPI Description json format',
|
|
33
|
+
url: 'downloadDefinitionUrlValue.json',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: 'OpenAPI Description yaml format',
|
|
37
|
+
url: 'downloadDefinitionUrlValue.yaml',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: 'OpenAPI Description text format',
|
|
41
|
+
url: 'downloadDefinitionUrlValue.txt',
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
const { result } = renderHook(() => useDownloadInfo({
|
|
45
|
+
downloadUrls,
|
|
46
|
+
}));
|
|
47
|
+
const downloadObjects = result?.current ?? [];
|
|
48
|
+
const { container } = render(_jsx(DownloadSpecification, { downloadObjects: downloadObjects }));
|
|
49
|
+
expect(container).toMatchSnapshot();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=DownloadSpecification.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useAtom } from 'jotai/index';
|
|
3
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
4
|
+
import { ExpandAllButton } from '../ExpandAllButton.js';
|
|
5
|
+
import { useTranslate, useTelemetry } from '../../../hooks/index.js';
|
|
6
|
+
// Mock the dependencies
|
|
7
|
+
vi.mock('jotai/index', () => ({
|
|
8
|
+
useAtom: vi.fn(),
|
|
9
|
+
useAtomValue: vi.fn(),
|
|
10
|
+
atom: vi.fn(),
|
|
11
|
+
}));
|
|
12
|
+
vi.mock('../../../hooks', () => ({
|
|
13
|
+
useTranslate: vi.fn(),
|
|
14
|
+
useTelemetry: vi.fn(), // Add mock for useTelemetry
|
|
15
|
+
}));
|
|
16
|
+
vi.mock('@redocly/theme', () => ({
|
|
17
|
+
Button: ({ children, ...props }) => _jsx("button", { ...props, children: children }),
|
|
18
|
+
MaximizeIcon: () => _jsx("span", { "data-testid": "maximize-icon" }),
|
|
19
|
+
}));
|
|
20
|
+
describe('ExpandAllButton', () => {
|
|
21
|
+
const mockSetOperationState = vi.fn();
|
|
22
|
+
const mockTranslate = vi.fn((_key, defaultValue) => defaultValue);
|
|
23
|
+
const mockTelemetrySend = vi.fn();
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
vi.clearAllMocks();
|
|
26
|
+
useAtom.mockReturnValue([
|
|
27
|
+
{ request: { expandedAll: false }, response: { expandedAll: false } },
|
|
28
|
+
mockSetOperationState,
|
|
29
|
+
]);
|
|
30
|
+
useTranslate.mockReturnValue(mockTranslate);
|
|
31
|
+
useTelemetry.mockReturnValue({
|
|
32
|
+
sendExpandCollapseAllClickedMessage: mockTelemetrySend,
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
it('renders correctly with initial state', () => {
|
|
36
|
+
render(_jsx(ExpandAllButton, { operationPointer: "test", type: "request" }));
|
|
37
|
+
expect(screen.getByRole('button')).toHaveTextContent('Expand all');
|
|
38
|
+
});
|
|
39
|
+
it('toggles state when clicked', () => {
|
|
40
|
+
render(_jsx(ExpandAllButton, { operationPointer: "test", type: "request" }));
|
|
41
|
+
fireEvent.click(screen.getByRole('button'));
|
|
42
|
+
expect(mockSetOperationState).toHaveBeenCalledTimes(1);
|
|
43
|
+
expect(mockSetOperationState).toHaveBeenCalledWith(expect.any(Object));
|
|
44
|
+
const updateObject = mockSetOperationState.mock.calls[0][0];
|
|
45
|
+
expect(updateObject).toEqual({ request: { expandedAll: true } });
|
|
46
|
+
});
|
|
47
|
+
it('displays correct text based on expanded state', () => {
|
|
48
|
+
useAtom.mockReturnValue([
|
|
49
|
+
{ request: { expandedAll: true }, response: { expandedAll: false } },
|
|
50
|
+
mockSetOperationState,
|
|
51
|
+
]);
|
|
52
|
+
render(_jsx(ExpandAllButton, { operationPointer: "test", type: "request" }));
|
|
53
|
+
expect(screen.getByRole('button')).toHaveTextContent('Collapse all');
|
|
54
|
+
});
|
|
55
|
+
it('uses translate function for button text', () => {
|
|
56
|
+
render(_jsx(ExpandAllButton, { operationPointer: "test", type: "request" }));
|
|
57
|
+
expect(mockTranslate).toHaveBeenCalledWith('openapi.expandAll', 'Expand all');
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=ExpandAllButton.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { parseYaml } from '@redocly/openapi-core';
|
|
2
|
+
import { outdent } from 'outdent';
|
|
3
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
4
|
+
import { computeExpandAllDepth, MAX_EXPAND_ALL_DEPTH } from '../helpers.js';
|
|
5
|
+
const options = normalizeOptions({});
|
|
6
|
+
function makeParser(spec) {
|
|
7
|
+
return new OpenAPIParser(spec, undefined, options);
|
|
8
|
+
}
|
|
9
|
+
function asModel(rawSchema) {
|
|
10
|
+
return { schema: rawSchema, rawSchema };
|
|
11
|
+
}
|
|
12
|
+
describe('computeExpandAllDepth', () => {
|
|
13
|
+
test('returns the ceiling for small schemas', () => {
|
|
14
|
+
const spec = parseYaml(outdent `
|
|
15
|
+
openapi: 3.0.0
|
|
16
|
+
components:
|
|
17
|
+
schemas:
|
|
18
|
+
User:
|
|
19
|
+
type: object
|
|
20
|
+
properties:
|
|
21
|
+
name:
|
|
22
|
+
type: string
|
|
23
|
+
address:
|
|
24
|
+
type: object
|
|
25
|
+
properties:
|
|
26
|
+
city:
|
|
27
|
+
type: string
|
|
28
|
+
`);
|
|
29
|
+
const parser = makeParser(spec);
|
|
30
|
+
expect(computeExpandAllDepth(parser, [asModel(spec.components.schemas.User)])).toBe(MAX_EXPAND_ALL_DEPTH);
|
|
31
|
+
});
|
|
32
|
+
test('clamps the depth for schemas that unfold exponentially', () => {
|
|
33
|
+
// Each level references the same node 5 times -> 5^level rows.
|
|
34
|
+
const spec = parseYaml(outdent `
|
|
35
|
+
openapi: 3.0.0
|
|
36
|
+
components:
|
|
37
|
+
schemas:
|
|
38
|
+
Node:
|
|
39
|
+
type: object
|
|
40
|
+
properties:
|
|
41
|
+
a:
|
|
42
|
+
$ref: '#/components/schemas/Node'
|
|
43
|
+
b:
|
|
44
|
+
$ref: '#/components/schemas/Node'
|
|
45
|
+
c:
|
|
46
|
+
$ref: '#/components/schemas/Node'
|
|
47
|
+
d:
|
|
48
|
+
$ref: '#/components/schemas/Node'
|
|
49
|
+
e:
|
|
50
|
+
$ref: '#/components/schemas/Node'
|
|
51
|
+
`);
|
|
52
|
+
const parser = makeParser(spec);
|
|
53
|
+
const depth = computeExpandAllDepth(parser, [asModel(spec.components.schemas.Node)], 100);
|
|
54
|
+
// 5 + 25 + 125 = 155 > 100 -> depth 2
|
|
55
|
+
expect(depth).toBe(2);
|
|
56
|
+
});
|
|
57
|
+
test('expands at least one level even when the first level exceeds the budget', () => {
|
|
58
|
+
const properties = Object.fromEntries(Array.from({ length: 50 }, (_, i) => [`p${i}`, { type: 'object' }]));
|
|
59
|
+
const parser = makeParser({ openapi: '3.0.0', components: {} });
|
|
60
|
+
expect(computeExpandAllDepth(parser, [asModel({ type: 'object', properties })], 10)).toBe(1);
|
|
61
|
+
});
|
|
62
|
+
test('counts rows through allOf, oneOf active variant, and array items', () => {
|
|
63
|
+
const spec = parseYaml(outdent `
|
|
64
|
+
openapi: 3.0.0
|
|
65
|
+
components:
|
|
66
|
+
schemas:
|
|
67
|
+
Wrapped:
|
|
68
|
+
type: object
|
|
69
|
+
properties:
|
|
70
|
+
list:
|
|
71
|
+
type: array
|
|
72
|
+
items:
|
|
73
|
+
allOf:
|
|
74
|
+
- type: object
|
|
75
|
+
properties:
|
|
76
|
+
first:
|
|
77
|
+
type: string
|
|
78
|
+
- type: object
|
|
79
|
+
properties:
|
|
80
|
+
second:
|
|
81
|
+
oneOf:
|
|
82
|
+
- type: object
|
|
83
|
+
properties:
|
|
84
|
+
variantField:
|
|
85
|
+
type: string
|
|
86
|
+
- type: object
|
|
87
|
+
properties:
|
|
88
|
+
otherA:
|
|
89
|
+
type: string
|
|
90
|
+
otherB:
|
|
91
|
+
type: string
|
|
92
|
+
`);
|
|
93
|
+
const parser = makeParser(spec);
|
|
94
|
+
const root = asModel(spec.components.schemas.Wrapped);
|
|
95
|
+
// level 1: list (1 row); level 2: first + second (cum 3); level 3: variantField (oneOf[0] only, cum 4)
|
|
96
|
+
expect(computeExpandAllDepth(parser, [root], 4)).toBe(MAX_EXPAND_ALL_DEPTH);
|
|
97
|
+
expect(computeExpandAllDepth(parser, [root], 3)).toBe(2);
|
|
98
|
+
expect(computeExpandAllDepth(parser, [root], 2)).toBe(1);
|
|
99
|
+
});
|
|
100
|
+
test('counts additionalProperties and unevaluatedProperties as rows (mirrors buildFields)', () => {
|
|
101
|
+
const parser = makeParser({ openapi: '3.0.0', components: {} });
|
|
102
|
+
// 9 named properties + 1 `additionalProperties: true` row = 10 rows > budget 9
|
|
103
|
+
const properties = Object.fromEntries(Array.from({ length: 9 }, (_, i) => [`p${i}`, { type: 'string' }]));
|
|
104
|
+
expect(computeExpandAllDepth(parser, [asModel({ type: 'object', properties, additionalProperties: true })], 9)).toBe(1);
|
|
105
|
+
expect(computeExpandAllDepth(parser, [asModel({ type: 'object', properties, unevaluatedProperties: { type: 'string' } })], 9)).toBe(1);
|
|
106
|
+
// Without them the 9 properties fit the budget.
|
|
107
|
+
expect(computeExpandAllDepth(parser, [asModel({ type: 'object', properties })], 9)).toBe(MAX_EXPAND_ALL_DEPTH);
|
|
108
|
+
});
|
|
109
|
+
test('is resilient to missing parser or schemas', () => {
|
|
110
|
+
expect(computeExpandAllDepth(undefined, [])).toBe(MAX_EXPAND_ALL_DEPTH);
|
|
111
|
+
expect(computeExpandAllDepth({}, [])).toBe(MAX_EXPAND_ALL_DEPTH);
|
|
112
|
+
expect(computeExpandAllDepth(makeParser({ openapi: '3.0.0' }), [undefined])).toBe(MAX_EXPAND_ALL_DEPTH);
|
|
113
|
+
});
|
|
114
|
+
test('does not hang on self-referencing (cyclic) schemas', () => {
|
|
115
|
+
const spec = parseYaml(outdent `
|
|
116
|
+
openapi: 3.0.0
|
|
117
|
+
components:
|
|
118
|
+
schemas:
|
|
119
|
+
Cyclic:
|
|
120
|
+
type: object
|
|
121
|
+
properties:
|
|
122
|
+
self:
|
|
123
|
+
$ref: '#/components/schemas/Cyclic'
|
|
124
|
+
name:
|
|
125
|
+
type: string
|
|
126
|
+
`);
|
|
127
|
+
const parser = makeParser(spec);
|
|
128
|
+
const depth = computeExpandAllDepth(parser, [asModel(spec.components.schemas.Cyclic)]);
|
|
129
|
+
expect(depth).toBeGreaterThanOrEqual(1);
|
|
130
|
+
expect(depth).toBeLessThanOrEqual(MAX_EXPAND_ALL_DEPTH);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
//# sourceMappingURL=helpers.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, fireEvent, screen } from '@testing-library/react';
|
|
3
|
+
import { LanguageDropdown } from '../LanguageDropdown.js';
|
|
4
|
+
const mockSamples = [
|
|
5
|
+
{ key: 'js', title: 'JS', lang: 'js' },
|
|
6
|
+
{ key: 'node.js', title: 'Node.JS', lang: 'nodejs' },
|
|
7
|
+
];
|
|
8
|
+
const mockActiveTab = mockSamples[0].key;
|
|
9
|
+
const mockOnChange = vi.fn();
|
|
10
|
+
describe('LanguageDropdown', () => {
|
|
11
|
+
test('LanguageDropdown renders correctly', () => {
|
|
12
|
+
const { getAllByText } = render(_jsx(LanguageDropdown, { samples: mockSamples, activeTab: mockActiveTab, onChange: mockOnChange }));
|
|
13
|
+
expect(getAllByText(mockSamples[0].title)[0]).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
test('LanguageDropdown handles onChange correctly', () => {
|
|
16
|
+
const { getAllByText } = render(_jsx(LanguageDropdown, { samples: mockSamples, activeTab: mockActiveTab, onChange: mockOnChange }));
|
|
17
|
+
fireEvent.click(screen.getAllByText(mockSamples[0].title)[0]);
|
|
18
|
+
const otherLanguage = mockSamples[1];
|
|
19
|
+
fireEvent.click(getAllByText(otherLanguage.title)[0]);
|
|
20
|
+
expect(mockOnChange).toHaveBeenCalledWith(otherLanguage.key);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=LanguageDropdown.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import * as Jotai from 'jotai/index';
|
|
4
|
+
import { normalizeOptions } from '../../../services/index.js';
|
|
5
|
+
import { Markdown } from '../Markdown.js';
|
|
6
|
+
import { withTestProviders } from '../../../testProviders.js';
|
|
7
|
+
vi.mock('jotai', async () => ({
|
|
8
|
+
...(await vi.importActual('jotai')),
|
|
9
|
+
useAtomValue: vi.fn(),
|
|
10
|
+
}));
|
|
11
|
+
describe('Components', () => {
|
|
12
|
+
describe('Markdown', () => {
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
vi.clearAllMocks();
|
|
15
|
+
});
|
|
16
|
+
test('Markdown renders correctly', () => {
|
|
17
|
+
const { getByText } = render(withTestProviders(_jsx(Markdown, { source: `# Heading 1\n\n[link](https://google.com)` })));
|
|
18
|
+
expect(getByText('Heading 1')).toBeInTheDocument();
|
|
19
|
+
expect(getByText('link')).toBeInTheDocument();
|
|
20
|
+
expect(getByText('link').closest('a')).toHaveAttribute('href', 'https://google.com');
|
|
21
|
+
});
|
|
22
|
+
test('Markdown custom sanitize works', () => {
|
|
23
|
+
const options = normalizeOptions({
|
|
24
|
+
unstable_hooks: { sanitize: (str) => str.replace('bad word', '**') },
|
|
25
|
+
});
|
|
26
|
+
vi.spyOn(Jotai, 'useAtomValue').mockImplementation(() => {
|
|
27
|
+
return options;
|
|
28
|
+
});
|
|
29
|
+
const { getByText } = render(withTestProviders(_jsx(Markdown, { source: `# Heading 1\n\n[link](https://google.com)\nbad word` })));
|
|
30
|
+
expect(getByText(/\*\*/)).toBeInTheDocument();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=Markdown.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { act, fireEvent, render, screen } from '@testing-library/react';
|
|
3
|
+
import { vi } from 'vitest';
|
|
4
|
+
import { McpOverview } from '../McpOverview.js';
|
|
5
|
+
import { withTestProviders, TestMemoryRouter } from '../../../testProviders.js';
|
|
6
|
+
import mcpInfo from './fixtures/mcp-info.json';
|
|
7
|
+
describe('McpOverview', () => {
|
|
8
|
+
it('should render mcp overview', () => {
|
|
9
|
+
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpOverview, { mcpInfo: mcpInfo, mcpServers: [{ url: 'https://api.example.com/mcp' }] }) })));
|
|
10
|
+
expect(screen.getByText('Protocol version')).toBeInTheDocument();
|
|
11
|
+
expect(screen.getByText('1.0.0')).toBeInTheDocument();
|
|
12
|
+
expect(screen.getByText('Capabilities')).toBeInTheDocument();
|
|
13
|
+
expect(screen.queryByText('tool_code_interpreter')).not.toBeInTheDocument();
|
|
14
|
+
expect(screen.queryByText('tool_image_generation')).not.toBeInTheDocument();
|
|
15
|
+
expect(screen.getByText('Endpoint')).toBeInTheDocument();
|
|
16
|
+
expect(screen.getByText('https://api.example.com/mcp')).toBeInTheDocument();
|
|
17
|
+
});
|
|
18
|
+
it('should render experimental capabilities', () => {
|
|
19
|
+
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpOverview, { mcpInfo: mcpInfo, mcpServers: [{ url: 'https://api.example.com/mcp' }] }) })));
|
|
20
|
+
expect(screen.getByText('Experimental capabilities')).toBeInTheDocument();
|
|
21
|
+
expect(screen.getByText('a:')).toBeInTheDocument();
|
|
22
|
+
expect(screen.getByText('true')).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
it('should keep endpoint variables visible while resolving the Cursor deeplink url', async () => {
|
|
25
|
+
const openSpy = vi.spyOn(window, 'open').mockImplementation(() => null);
|
|
26
|
+
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpOverview, { mcpInfo: mcpInfo, mcpServers: [
|
|
27
|
+
{
|
|
28
|
+
url: 'https://{projectHost}/mcp',
|
|
29
|
+
variables: {
|
|
30
|
+
projectHost: {
|
|
31
|
+
default: 'redocly.com',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
] }) })));
|
|
36
|
+
expect(screen.getByText('https://{projectHost}/mcp')).toBeInTheDocument();
|
|
37
|
+
await act(async () => {
|
|
38
|
+
fireEvent.click(screen.getByRole('button', { name: 'Connect to Cursor' }));
|
|
39
|
+
});
|
|
40
|
+
expect(openSpy).toHaveBeenCalledWith(expect.any(String), '_blank');
|
|
41
|
+
const deeplink = String(openSpy.mock.calls[0][0]);
|
|
42
|
+
const cursorUrl = new URL(deeplink);
|
|
43
|
+
const encodedConfig = cursorUrl.searchParams.get('config');
|
|
44
|
+
const decodedConfig = JSON.parse(Buffer.from(encodedConfig || '', 'base64').toString('utf-8'));
|
|
45
|
+
expect(decodedConfig).toEqual({
|
|
46
|
+
url: 'https://redocly.com/mcp',
|
|
47
|
+
description: 'MCP Server',
|
|
48
|
+
});
|
|
49
|
+
openSpy.mockRestore();
|
|
50
|
+
});
|
|
51
|
+
it('should render capabilities with listChanged and subscribe', () => {
|
|
52
|
+
const mcpInfoWithExtras = {
|
|
53
|
+
...mcpInfo,
|
|
54
|
+
capabilities: {
|
|
55
|
+
...mcpInfo.capabilities,
|
|
56
|
+
tools: {
|
|
57
|
+
listChanged: true,
|
|
58
|
+
subscribe: true,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpOverview, { mcpInfo: mcpInfoWithExtras, mcpServers: [{ url: 'https://api.example.com/mcp' }] }) })));
|
|
63
|
+
expect(screen.getByText(/tools \(list changed\) \(subscribe\)/)).toBeInTheDocument();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=McpOverview.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { McpPrompt } from '../McpPrompt.js';
|
|
4
|
+
import { withTestProviders, TestMemoryRouter } from '../../../testProviders.js';
|
|
5
|
+
const spec = {
|
|
6
|
+
openapi: '3.0.0',
|
|
7
|
+
'x-mcp': {
|
|
8
|
+
prompts: [
|
|
9
|
+
{
|
|
10
|
+
name: 'test-prompt',
|
|
11
|
+
description: 'A test prompt',
|
|
12
|
+
arguments: [
|
|
13
|
+
{
|
|
14
|
+
name: 'arg1',
|
|
15
|
+
description: 'First argument',
|
|
16
|
+
required: true,
|
|
17
|
+
example: 'value1',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
security: [
|
|
21
|
+
{
|
|
22
|
+
apiKey: [],
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
components: {
|
|
29
|
+
securitySchemes: {
|
|
30
|
+
apiKey: {
|
|
31
|
+
type: 'apiKey',
|
|
32
|
+
in: 'header',
|
|
33
|
+
name: 'X-API-Key',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
describe('McpPrompt', () => {
|
|
39
|
+
it('should render mcp prompt with arguments', () => {
|
|
40
|
+
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpPrompt, { name: "test-prompt", id: "test-prompt" }) }), {
|
|
41
|
+
definition: spec,
|
|
42
|
+
options: {},
|
|
43
|
+
}));
|
|
44
|
+
expect(screen.getByText('Arguments')).toBeInTheDocument();
|
|
45
|
+
expect(screen.getByText('arg1')).toBeInTheDocument();
|
|
46
|
+
expect(screen.getByText('Security')).toBeInTheDocument();
|
|
47
|
+
expect(screen.getByText('apiKey')).toBeInTheDocument();
|
|
48
|
+
});
|
|
49
|
+
it('should return null if prompt not found', () => {
|
|
50
|
+
const { container } = render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpPrompt, { name: "not-found", id: "not-found" }) }), {
|
|
51
|
+
definition: spec,
|
|
52
|
+
options: {},
|
|
53
|
+
}));
|
|
54
|
+
expect(container.firstChild).toBeNull();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=McpPrompt.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
|
|
3
|
+
import { vi } from 'vitest';
|
|
4
|
+
import { McpResource } from '../McpResource.js';
|
|
5
|
+
import { withTestProviders, TestMemoryRouter } from '../../../testProviders.js';
|
|
6
|
+
const spec = {
|
|
7
|
+
openapi: '3.0.0',
|
|
8
|
+
'x-mcp': {
|
|
9
|
+
resources: [
|
|
10
|
+
{
|
|
11
|
+
name: 'test-resource',
|
|
12
|
+
uri: 'mcp://test-resource',
|
|
13
|
+
mimeType: 'application/json',
|
|
14
|
+
text: '{"key": "value"}',
|
|
15
|
+
security: [
|
|
16
|
+
{
|
|
17
|
+
apiKey: [],
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
components: {
|
|
24
|
+
securitySchemes: {
|
|
25
|
+
apiKey: {
|
|
26
|
+
type: 'apiKey',
|
|
27
|
+
in: 'header',
|
|
28
|
+
name: 'X-API-Key',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
// Mock navigator.clipboard
|
|
34
|
+
const mockClipboard = {
|
|
35
|
+
writeText: vi.fn(),
|
|
36
|
+
};
|
|
37
|
+
Object.assign(navigator, {
|
|
38
|
+
clipboard: mockClipboard,
|
|
39
|
+
});
|
|
40
|
+
describe('McpResource', () => {
|
|
41
|
+
beforeAll(() => {
|
|
42
|
+
mockClipboard.writeText.mockImplementation(() => Promise.resolve());
|
|
43
|
+
});
|
|
44
|
+
afterEach(() => {
|
|
45
|
+
vi.clearAllMocks();
|
|
46
|
+
});
|
|
47
|
+
it('should render mcp resource with content', () => {
|
|
48
|
+
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpResource, { name: "test-resource", id: "test-resource" }) }), {
|
|
49
|
+
definition: spec,
|
|
50
|
+
options: {},
|
|
51
|
+
}));
|
|
52
|
+
expect(screen.getByText('Resource URI:')).toBeInTheDocument();
|
|
53
|
+
expect(screen.getByText('mcp://test-resource')).toBeInTheDocument();
|
|
54
|
+
expect(screen.getByText('Resource MIME type:')).toBeInTheDocument();
|
|
55
|
+
expect(screen.getAllByText('application/json').length).toBeGreaterThanOrEqual(1);
|
|
56
|
+
expect(screen.getByText('Resource content')).toBeInTheDocument();
|
|
57
|
+
expect(screen.getByText(/"key": "value"/)).toBeInTheDocument();
|
|
58
|
+
expect(screen.getByText('Security')).toBeInTheDocument();
|
|
59
|
+
expect(screen.getByText('apiKey')).toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
it('should render a message if resource not found', () => {
|
|
62
|
+
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpResource, { name: "not-found", id: "not-found" }) }), {
|
|
63
|
+
definition: spec,
|
|
64
|
+
options: {},
|
|
65
|
+
}));
|
|
66
|
+
expect(screen.getByText('Resource not found: not-found')).toBeInTheDocument();
|
|
67
|
+
});
|
|
68
|
+
it('should copy URI to clipboard when clicked', async () => {
|
|
69
|
+
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpResource, { name: "test-resource", id: "test-resource" }) }), {
|
|
70
|
+
definition: spec,
|
|
71
|
+
options: {},
|
|
72
|
+
}));
|
|
73
|
+
const uriElement = screen.getByText('mcp://test-resource');
|
|
74
|
+
fireEvent.click(uriElement);
|
|
75
|
+
expect(mockClipboard.writeText).toHaveBeenCalledWith('mcp://test-resource');
|
|
76
|
+
await waitFor(() => {
|
|
77
|
+
expect(screen.getByText('✓ Copied!')).toBeInTheDocument();
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=McpResource.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { McpTool } from '../McpTool.js';
|
|
4
|
+
import { withTestProviders, TestMemoryRouter } from '../../../testProviders.js';
|
|
5
|
+
import mcpData from './fixtures/mcp-tools.json';
|
|
6
|
+
const spec = {
|
|
7
|
+
openapi: '3.0.0',
|
|
8
|
+
'x-mcp': mcpData,
|
|
9
|
+
components: {
|
|
10
|
+
securitySchemes: {
|
|
11
|
+
apiKey: {
|
|
12
|
+
type: 'apiKey',
|
|
13
|
+
in: 'header',
|
|
14
|
+
name: 'X-API-Key',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
describe('McpTool', () => {
|
|
20
|
+
it('should render mcp tool with input and output schema', () => {
|
|
21
|
+
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpTool, { name: "test-tool", id: "test-tool" }) }), {
|
|
22
|
+
definition: spec,
|
|
23
|
+
options: {},
|
|
24
|
+
}));
|
|
25
|
+
expect(screen.getByText('Input schema')).toBeInTheDocument();
|
|
26
|
+
expect(screen.getByText('inputProperty')).toBeInTheDocument();
|
|
27
|
+
expect(screen.getByText('Output schema')).toBeInTheDocument();
|
|
28
|
+
expect(screen.getByText('outputProperty')).toBeInTheDocument();
|
|
29
|
+
expect(screen.getByText('Security')).toBeInTheDocument();
|
|
30
|
+
expect(screen.getByText('apiKey')).toBeInTheDocument();
|
|
31
|
+
});
|
|
32
|
+
it('should render a message if tool not found', () => {
|
|
33
|
+
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpTool, { name: "not-found", id: "not-found" }) }), {
|
|
34
|
+
definition: spec,
|
|
35
|
+
options: {},
|
|
36
|
+
}));
|
|
37
|
+
expect(screen.getByText('Tool not found: not-found')).toBeInTheDocument();
|
|
38
|
+
});
|
|
39
|
+
it('should render without output schema', () => {
|
|
40
|
+
const specWithoutOutput = {
|
|
41
|
+
...spec,
|
|
42
|
+
'x-mcp': {
|
|
43
|
+
...spec['x-mcp'],
|
|
44
|
+
tools: [
|
|
45
|
+
{
|
|
46
|
+
name: 'test-tool-no-output',
|
|
47
|
+
description: 'A test tool without output schema',
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
properties: {
|
|
51
|
+
inputProperty: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpTool, { name: "test-tool-no-output", id: "test-tool-no-output" }) }), {
|
|
61
|
+
definition: specWithoutOutput,
|
|
62
|
+
options: {},
|
|
63
|
+
}));
|
|
64
|
+
expect(screen.getByText('Input schema')).toBeInTheDocument();
|
|
65
|
+
expect(screen.queryByText('Output schema')).not.toBeInTheDocument();
|
|
66
|
+
});
|
|
67
|
+
it('should apply middle panel horizontal padding overrides', () => {
|
|
68
|
+
const { container } = render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpTool, { name: "test-tool", id: "test-tool" }) }), {
|
|
69
|
+
definition: spec,
|
|
70
|
+
options: {},
|
|
71
|
+
}));
|
|
72
|
+
const middlePanel = container.querySelector('.mcp-tool > div > div');
|
|
73
|
+
expect(middlePanel).toBeTruthy();
|
|
74
|
+
expect(middlePanel).toHaveStyle({ paddingLeft: '0px' });
|
|
75
|
+
const styles = Array.from(document.querySelectorAll('style'))
|
|
76
|
+
.map((tag) => tag.textContent ?? '')
|
|
77
|
+
.join('\n');
|
|
78
|
+
expect(styles).toMatch(/padding-left:\s*0/);
|
|
79
|
+
expect(styles).toMatch(/padding-right:\s*var\(--panel-gap-horizontal\)/);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=McpTool.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|