@redocly/openapi-docs 3.24.0 → 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-CIrPFbvX.js → redocly-openapi-docs.min.AiChatProvider-j-VDfFJ9.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-eAy3scC4.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-BBRBmffc.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiPanel-C6CGDyzy.js → redocly-openapi-docs.min.AiPanel-DTzHqAiI.js} +1 -1
- package/dist/{redocly-openapi-docs.min.FileWatcher-dIKl80Ec.js → redocly-openapi-docs.min.FileWatcher-DDoyaS7A.js} +1 -1
- package/dist/{redocly-openapi-docs.min.SemanticSearchService-D4V6-td8.js → redocly-openapi-docs.min.SemanticSearchService-DNFOPBZK.js} +1 -1
- package/dist/{redocly-openapi-docs.min.SqliteDBStorage-D9-Rb-N7.js → redocly-openapi-docs.min.SqliteDBStorage-Dy40Vq04.js} +1 -1
- package/dist/{redocly-openapi-docs.min.TauriFileSystemAdapter-CHW6hO3z.js → redocly-openapi-docs.min.TauriFileSystemAdapter-CpViFqJQ.js} +1 -1
- package/dist/{redocly-openapi-docs.min.TauriRootStorage-CHiKNUn2.js → redocly-openapi-docs.min.TauriRootStorage-TCUrp2uB.js} +1 -1
- package/dist/{redocly-openapi-docs.min.ai-chat-mappers-C19k85fj.js → redocly-openapi-docs.min.ai-chat-mappers-CmX-8902.js} +1 -1
- package/dist/{redocly-openapi-docs.min.external-resolver-BH7DBWU-.js → redocly-openapi-docs.min.external-resolver-BkceRyB4.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-BQp5pipW.js → redocly-openapi-docs.min.index-BCcol5vU.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-dirYvuKs.js → redocly-openapi-docs.min.index-C6uU_v-b.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-BuFUmOUm.js → redocly-openapi-docs.min.index-CmXZfuiZ.js} +11 -11
- package/dist/{redocly-openapi-docs.min.index-DLlCa16R.js → redocly-openapi-docs.min.index-DVWw0ICA.js} +1 -1
- package/dist/redocly-openapi-docs.min.js +1 -1
- package/dist/{redocly-openapi-docs.min.lint-Xu623Q1T.js → redocly-openapi-docs.min.lint-2YpbCz3r.js} +2 -2
- package/dist/{redocly-openapi-docs.min.lint-graphql-D-Nm5P1M.js → redocly-openapi-docs.min.lint-graphql-Bgfcu2tP.js} +1 -1
- package/dist/{redocly-openapi-docs.min.respect-run-CWNqYysq.js → redocly-openapi-docs.min.respect-run-Ct8taisL.js} +1 -1
- package/dist/{redocly-openapi-docs.min.standalone-CRo0Sa5b.js → redocly-openapi-docs.min.standalone-BPCdJgtH.js} +3 -3
- package/dist/{redocly-openapi-docs.min.tauri-path-BUSVirPk.js → redocly-openapi-docs.min.tauri-path-CmqBCxGb.js} +1 -1
- package/dist/{redocly-openapi-docs.min.useAiChatQueries-CXyQzME7.js → redocly-openapi-docs.min.useAiChatQueries-t8oy8jik.js} +2 -2
- 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/__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/ContentItem/__tests__/useIsExpanded.test.d.ts +1 -0
- package/lib/components/ContentItem/__tests__/useIsExpanded.test.js +123 -0
- 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/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/__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/__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/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/Tabs/__tests__/Tabs.test.d.ts +1 -0
- package/lib/components/Tabs/__tests__/Tabs.test.js +27 -0
- 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/__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/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/package.json +4 -4
|
@@ -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 {};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, fireEvent, act } from '@testing-library/react';
|
|
3
|
+
import { SecurityModal } from '../SecurityModal.js';
|
|
4
|
+
describe('SecurityModal Component', () => {
|
|
5
|
+
const securities = [
|
|
6
|
+
{
|
|
7
|
+
schemes: [
|
|
8
|
+
{
|
|
9
|
+
id: 'B',
|
|
10
|
+
description: 'Test description scheme B',
|
|
11
|
+
type: 'http',
|
|
12
|
+
bearerFormat: 'password',
|
|
13
|
+
scopes: [],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: 'C',
|
|
17
|
+
description: 'Test description scheme C',
|
|
18
|
+
type: 'http',
|
|
19
|
+
bearerFormat: 'password',
|
|
20
|
+
scopes: [],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
schemes: [
|
|
26
|
+
{
|
|
27
|
+
id: 'A',
|
|
28
|
+
description: 'Test description scheme A',
|
|
29
|
+
type: 'apiKey',
|
|
30
|
+
in: 'header',
|
|
31
|
+
name: 'api_key',
|
|
32
|
+
scopes: [],
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
schemes: [
|
|
38
|
+
{
|
|
39
|
+
id: 'D',
|
|
40
|
+
description: 'Test description scheme D',
|
|
41
|
+
type: 'oauth2',
|
|
42
|
+
flows: {
|
|
43
|
+
authorizationCode: {
|
|
44
|
+
authorizationUrl: 'https://example.com/authorization',
|
|
45
|
+
tokenUrl: 'https://example.com/token',
|
|
46
|
+
scopes: {
|
|
47
|
+
'read:pets': 'read your pets',
|
|
48
|
+
'write:pets': 'modify pets in your account',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
scopes: ['read:pets'],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
it('renders the SecurityModal with the correct number of SegmentedItems', () => {
|
|
58
|
+
const { getByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
59
|
+
expect(getByText('A')).toBeInTheDocument();
|
|
60
|
+
expect(getByText('B and C')).toBeInTheDocument();
|
|
61
|
+
});
|
|
62
|
+
it('renders the SecurityModal with the correct number of SecurityFlows and Dividers', () => {
|
|
63
|
+
const { getByText, getAllByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
64
|
+
expect(getByText('Test description scheme B')).toBeInTheDocument();
|
|
65
|
+
expect(getByText('Test description scheme C')).toBeInTheDocument();
|
|
66
|
+
expect(getByText('and')).toBeInTheDocument();
|
|
67
|
+
expect(getAllByText('HTTP Authorization Scheme').length).toEqual(2);
|
|
68
|
+
expect(getAllByText('http').length).toEqual(2);
|
|
69
|
+
});
|
|
70
|
+
it('should update active security scheme on click and display relevant information', async () => {
|
|
71
|
+
const { getByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
72
|
+
fireEvent.click(getByText('A'));
|
|
73
|
+
await act(async () => { });
|
|
74
|
+
expect(getByText('Test description scheme A')).toBeInTheDocument();
|
|
75
|
+
expect(getByText('Header parameter name:')).toBeInTheDocument();
|
|
76
|
+
expect(getByText('api_key')).toBeInTheDocument();
|
|
77
|
+
});
|
|
78
|
+
it('should display details for OAuth2 scheme D including initial optional scopes toggle', async () => {
|
|
79
|
+
const { getByText, getAllByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
80
|
+
fireEvent.click(getByText('D'));
|
|
81
|
+
await act(async () => { });
|
|
82
|
+
expect(getByText('Test description scheme D')).toBeInTheDocument();
|
|
83
|
+
expect(getByText('Required scopes')).toBeInTheDocument();
|
|
84
|
+
expect(getByText('Show optional scopes')).toBeInTheDocument();
|
|
85
|
+
const readPetsScopes = getAllByText('read:pets');
|
|
86
|
+
expect(readPetsScopes.length).toBe(1);
|
|
87
|
+
const writePetsScopes = getAllByText('write:pets');
|
|
88
|
+
expect(writePetsScopes.length).toBe(1);
|
|
89
|
+
});
|
|
90
|
+
it('should toggle optional scopes visibility for OAuth2 scheme D', async () => {
|
|
91
|
+
const { getByText, queryByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
92
|
+
fireEvent.click(getByText('D'));
|
|
93
|
+
await act(async () => { });
|
|
94
|
+
fireEvent.click(getByText('Show optional scopes'));
|
|
95
|
+
await act(async () => { });
|
|
96
|
+
expect(getByText('Hide optional scopes')).toBeInTheDocument();
|
|
97
|
+
expect(queryByText('Show optional scopes')).toBeNull();
|
|
98
|
+
});
|
|
99
|
+
it('calls onClose callback when the Close button is clicked', () => {
|
|
100
|
+
const onCloseMock = vi.fn();
|
|
101
|
+
const { getByTestId } = render(_jsx(SecurityModal, { securities: securities, onClose: onCloseMock }));
|
|
102
|
+
fireEvent.click(getByTestId('close'));
|
|
103
|
+
expect(onCloseMock).toHaveBeenCalled();
|
|
104
|
+
});
|
|
105
|
+
it('should display required scopes from scopes array if there are no flows', () => {
|
|
106
|
+
const securities = [
|
|
107
|
+
{
|
|
108
|
+
schemes: [
|
|
109
|
+
{
|
|
110
|
+
id: 'D',
|
|
111
|
+
description: 'Test description scheme D',
|
|
112
|
+
type: 'oauth2',
|
|
113
|
+
flows: {},
|
|
114
|
+
scopes: ['read:pets'],
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
const { getByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
120
|
+
expect(getByText('read:pets')).toBeInTheDocument();
|
|
121
|
+
});
|
|
122
|
+
it('should exlcude required scopes from optional scopes', async () => {
|
|
123
|
+
const { getByText, getAllByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
124
|
+
fireEvent.click(getByText('D'));
|
|
125
|
+
await act(async () => { });
|
|
126
|
+
fireEvent.click(getByText('Show optional scopes'));
|
|
127
|
+
await act(async () => { });
|
|
128
|
+
expect(getAllByText('read:pets').length).toBe(1);
|
|
129
|
+
expect(getAllByText('write:pets').length).toBe(1);
|
|
130
|
+
});
|
|
131
|
+
it('should render required scopes once per scheme and optional scopes per flow when there are multiple flows', async () => {
|
|
132
|
+
const securities = [
|
|
133
|
+
{
|
|
134
|
+
schemes: [
|
|
135
|
+
{
|
|
136
|
+
id: 'D',
|
|
137
|
+
description: 'Test description scheme D',
|
|
138
|
+
type: 'oauth2',
|
|
139
|
+
flows: {
|
|
140
|
+
authorizationCode: {
|
|
141
|
+
authorizationUrl: 'https://example.com/authorization',
|
|
142
|
+
tokenUrl: 'https://example.com/token',
|
|
143
|
+
scopes: {
|
|
144
|
+
'read:pets': 'read your pets',
|
|
145
|
+
'write:pets': 'modify pets in your account',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
clientCredentials: {
|
|
149
|
+
tokenUrl: 'https://example.com/token',
|
|
150
|
+
scopes: {
|
|
151
|
+
'read:pets': 'read your pets',
|
|
152
|
+
'write:pets': 'modify pets in your account',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
scopes: ['read:pets'],
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
const { getByText, getAllByText } = render(_jsx(SecurityModal, { securities: securities, onClose: () => { } }));
|
|
162
|
+
// Required is per scheme
|
|
163
|
+
expect(getAllByText('Required scopes').length).toBe(1);
|
|
164
|
+
expect(getAllByText('read:pets').length).toBe(1);
|
|
165
|
+
// Each flow gets its own optional scopes block
|
|
166
|
+
expect(getByText('authorizationCode')).toBeInTheDocument();
|
|
167
|
+
expect(getByText('clientCredentials')).toBeInTheDocument();
|
|
168
|
+
expect(getAllByText('Show optional scopes').length).toBe(2);
|
|
169
|
+
expect(getAllByText('write:pets').length).toBe(2);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
//# sourceMappingURL=SecurityModal.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import * as Jotai from 'jotai';
|
|
4
|
+
import { vi } from 'vitest';
|
|
5
|
+
import { ServerList } from '../ServerList.js';
|
|
6
|
+
import { normalizeOptions } from '../../../services/index.js';
|
|
7
|
+
vi.mock('jotai', async () => ({
|
|
8
|
+
...(await vi.importActual('jotai')),
|
|
9
|
+
useAtomValue: vi.fn(),
|
|
10
|
+
}));
|
|
11
|
+
describe('ServerList component', () => {
|
|
12
|
+
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(normalizeOptions({}));
|
|
13
|
+
const servers = [
|
|
14
|
+
{
|
|
15
|
+
url: 'http://petstore.swagger.io/v2',
|
|
16
|
+
description: 'Default server',
|
|
17
|
+
name: 'Default',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
url: 'http://petstore.swagger.io/sandbox',
|
|
21
|
+
description: 'Sandbox server',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
url: 'http://petstore.swagger.io/stage',
|
|
25
|
+
name: 'Stage server',
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
const translateMock = vi.fn().mockImplementation((_, defaultValue) => defaultValue);
|
|
29
|
+
it('should render copy button', () => {
|
|
30
|
+
render(_jsx(ServerList, { servers: servers, path: "/pet", translate: translateMock }));
|
|
31
|
+
expect(screen.getAllByTestId('copy-button').length).toBe(3);
|
|
32
|
+
});
|
|
33
|
+
it('should render server description tooltip', () => {
|
|
34
|
+
render(_jsx(ServerList, { servers: servers, path: "/pet", translate: translateMock }));
|
|
35
|
+
expect(screen.getAllByTestId('server-item-description-tooltip').length).toBe(1);
|
|
36
|
+
});
|
|
37
|
+
it('should render server name', () => {
|
|
38
|
+
render(_jsx(ServerList, { servers: servers, path: "/pet", translate: translateMock }));
|
|
39
|
+
expect(screen.getAllByTestId('server-panel-item-name')[0]).toHaveTextContent('Default');
|
|
40
|
+
expect(screen.getAllByTestId('server-panel-item-name')[1]).toHaveTextContent('Sandbox server');
|
|
41
|
+
expect(screen.getAllByTestId('server-panel-item-name')[2]).toHaveTextContent('Stage server');
|
|
42
|
+
});
|
|
43
|
+
describe('Server variables', () => {
|
|
44
|
+
const serversWithVariables = [
|
|
45
|
+
{
|
|
46
|
+
url: 'http://petstore.swagger.io/{version}',
|
|
47
|
+
description: 'Default server with variables',
|
|
48
|
+
name: 'Default',
|
|
49
|
+
variables: {
|
|
50
|
+
version: {
|
|
51
|
+
default: 'v2',
|
|
52
|
+
description: 'API version',
|
|
53
|
+
enum: ['v1', 'v2'],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
url: 'http://petstore.swagger.io/{sandbox}/{version}',
|
|
59
|
+
description: 'Sandbox server with variables',
|
|
60
|
+
variables: {
|
|
61
|
+
sandbox: {
|
|
62
|
+
default: 'dev',
|
|
63
|
+
description: 'Sandbox name',
|
|
64
|
+
},
|
|
65
|
+
version: {
|
|
66
|
+
default: 'v2',
|
|
67
|
+
description: 'API version',
|
|
68
|
+
enum: ['v1', 'v2'],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
it('should render view nested with one variable', () => {
|
|
74
|
+
render(_jsx(ServerList, { servers: [serversWithVariables[0]], path: "/pet", translate: translateMock }));
|
|
75
|
+
expect(screen.getByText('Show 1 variable')).toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
it('should render view nested with multiple variables', () => {
|
|
78
|
+
render(_jsx(ServerList, { servers: [serversWithVariables[1]], path: "/pet", translate: translateMock }));
|
|
79
|
+
expect(screen.getByText('Show 2 variables')).toBeInTheDocument();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=ServerList.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { render, fireEvent } from '@testing-library/react';
|
|
3
|
+
import { Tabs } from '../Tabs.js';
|
|
4
|
+
import { useTabsState } from '../useTabsState.js';
|
|
5
|
+
describe('Tabs', () => {
|
|
6
|
+
const TestComponent = () => {
|
|
7
|
+
const tabs = [
|
|
8
|
+
{ key: 'tab1', title: 'Tab 1' },
|
|
9
|
+
{ key: 'tab2', title: 'Tab 2' },
|
|
10
|
+
];
|
|
11
|
+
const { activeTab, handleTabChange } = useTabsState({ tabs });
|
|
12
|
+
return (_jsxs("div", { children: [_jsx(Tabs, { tabs: tabs, activeTab: tabs[0], onChange: handleTabChange }), _jsx("div", { children: activeTab === tabs[0].key ? 'Content 1' : 'Content 2' })] }));
|
|
13
|
+
};
|
|
14
|
+
test('should render tab list and content components', () => {
|
|
15
|
+
const { getByText } = render(_jsx(TestComponent, {}));
|
|
16
|
+
expect(getByText('Tab 1')).toBeInTheDocument();
|
|
17
|
+
expect(getByText('Tab 2')).toBeInTheDocument();
|
|
18
|
+
expect(getByText(/Content 1/)).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
test('should switch active tab when clicking on a Tab', () => {
|
|
21
|
+
const { getByText } = render(_jsx(TestComponent, {}));
|
|
22
|
+
const tab2 = getByText('Tab 2');
|
|
23
|
+
fireEvent.click(tab2);
|
|
24
|
+
expect(getByText(/Content 2/)).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=Tabs.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { ViewNested } from '../ViewNested.js';
|
|
4
|
+
describe('ViewNested', () => {
|
|
5
|
+
it('should render nested array content directly without show properties button', () => {
|
|
6
|
+
render(_jsx(ViewNested, { expandByDefault: false, isNestedArray: true, children: _jsx("div", { children: "Nested Array Content" }) }));
|
|
7
|
+
expect(screen.getByText('Nested Array Content')).toBeInTheDocument();
|
|
8
|
+
expect(screen.queryByText(/Show \d+ properties/)).toBeNull();
|
|
9
|
+
});
|
|
10
|
+
it('should auto-expand nested arrays', () => {
|
|
11
|
+
render(_jsx(ViewNested, { expandByDefault: false, isNestedArray: true, children: _jsx("div", { children: "Nested Content" }) }));
|
|
12
|
+
const nestedContent = screen.getByText('Nested Content');
|
|
13
|
+
expect(nestedContent).toBeVisible();
|
|
14
|
+
});
|
|
15
|
+
it('should expand via "Expand all" within the depth limit', () => {
|
|
16
|
+
render(_jsx(ViewNested, { expandByDefault: false, expandable: true, expandText: "Show 1 property", level: 5, expandedAll: true, children: _jsx("div", { children: "Deep Content" }) }));
|
|
17
|
+
expect(screen.getByText('Deep Content')).toBeInTheDocument();
|
|
18
|
+
expect(screen.queryByText('Show 1 property')).toBeNull();
|
|
19
|
+
});
|
|
20
|
+
it('should NOT auto-expand beyond the depth limit on "Expand all" (prevents freeze on DAG-shaped schemas)', () => {
|
|
21
|
+
render(_jsx(ViewNested, { expandByDefault: false, expandable: true, expandText: "Show 1 property", level: 50, expandedAll: true, children: _jsx("div", { children: "Very Deep Content" }) }));
|
|
22
|
+
// Stays collapsed: the node is still manually expandable, just not force-expanded.
|
|
23
|
+
expect(screen.queryByText('Very Deep Content')).toBeNull();
|
|
24
|
+
expect(screen.getByText('Show 1 property')).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
it('should respect the adaptive expandAllDepth over the default ceiling', () => {
|
|
27
|
+
render(_jsx(ViewNested, { expandByDefault: false, expandable: true, expandText: "Show 1 property", level: 6, expandedAll: true, expandAllDepth: 5, children: _jsx("div", { children: "Adaptive Deep Content" }) }));
|
|
28
|
+
expect(screen.queryByText('Adaptive Deep Content')).toBeNull();
|
|
29
|
+
expect(screen.getByText('Show 1 property')).toBeInTheDocument();
|
|
30
|
+
});
|
|
31
|
+
it('should cap expandAllDepth by the ceiling even when the budget allows more', () => {
|
|
32
|
+
render(_jsx(ViewNested, { expandByDefault: false, expandable: true, expandText: "Show 1 property", level: 12, expandedAll: true, expandAllDepth: 15, children: _jsx("div", { children: "Beyond Ceiling Content" }) }));
|
|
33
|
+
expect(screen.queryByText('Beyond Ceiling Content')).toBeNull();
|
|
34
|
+
expect(screen.getByText('Show 1 property')).toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
it('should always collapse on "Collapse all" regardless of depth', () => {
|
|
37
|
+
render(_jsx(ViewNested, { expandByDefault: true, expandable: true, expandText: "Show 1 property", level: 50, expandedAll: false, children: _jsx("div", { children: "Deep Content To Collapse" }) }));
|
|
38
|
+
expect(screen.queryByText('Deep Content To Collapse')).toBeNull();
|
|
39
|
+
expect(screen.getByText('Show 1 property')).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=ViewNested.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, fireEvent } from '@testing-library/react';
|
|
3
|
+
import { ExampleSwitch } from '../../Samples/index.js';
|
|
4
|
+
import { exampleXML, examples } from '../mocks/examples.js';
|
|
5
|
+
describe('ExampleSwitch', () => {
|
|
6
|
+
const exampleKey = 'cat';
|
|
7
|
+
it('should correctly render ExampleSwitch', () => {
|
|
8
|
+
const { getByTestId, getAllByRole } = render(_jsx(ExampleSwitch, { exampleKey: exampleKey, examples: examples, onChange: () => { } }));
|
|
9
|
+
expect(getByTestId('dropdown')).toBeInTheDocument();
|
|
10
|
+
const triggerButton = getByTestId('dropdown').querySelector('button');
|
|
11
|
+
if (triggerButton) {
|
|
12
|
+
fireEvent.click(triggerButton);
|
|
13
|
+
}
|
|
14
|
+
const menuItems = getAllByRole('menuitem');
|
|
15
|
+
expect(menuItems.length).toBe(3);
|
|
16
|
+
});
|
|
17
|
+
it('should correctly display ExampleSwitch with a different number of examples in the media type', () => {
|
|
18
|
+
let examplesObj = {
|
|
19
|
+
exampleKey: 'bee',
|
|
20
|
+
examples: examples,
|
|
21
|
+
};
|
|
22
|
+
const { getByTestId, getAllByRole, rerender } = render(_jsx(ExampleSwitch, { exampleKey: examplesObj.exampleKey, examples: examplesObj.examples, onChange: () => { } }));
|
|
23
|
+
expect(getByTestId('dropdown')).toBeInTheDocument();
|
|
24
|
+
let triggerButton = getByTestId('dropdown').querySelector('button');
|
|
25
|
+
if (triggerButton) {
|
|
26
|
+
fireEvent.click(triggerButton);
|
|
27
|
+
}
|
|
28
|
+
expect(getAllByRole('menuitem').length).toBe(3);
|
|
29
|
+
if (triggerButton) {
|
|
30
|
+
fireEvent.click(triggerButton);
|
|
31
|
+
}
|
|
32
|
+
examplesObj = {
|
|
33
|
+
exampleKey: 'foo',
|
|
34
|
+
examples: exampleXML,
|
|
35
|
+
};
|
|
36
|
+
rerender(_jsx(ExampleSwitch, { exampleKey: examplesObj.exampleKey, examples: examplesObj.examples, onChange: () => { } }));
|
|
37
|
+
expect(getByTestId('dropdown')).toBeInTheDocument();
|
|
38
|
+
triggerButton = getByTestId('dropdown').querySelector('button');
|
|
39
|
+
if (triggerButton) {
|
|
40
|
+
fireEvent.click(triggerButton);
|
|
41
|
+
}
|
|
42
|
+
expect(getAllByRole('menuitem').length).toBe(2);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=ExampleSwitch.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
|
+
import { normalizeOptions, OpenAPIParser, } from '../../../services/index.js';
|
|
3
|
+
import { getOperation } from '../../../models/index.js';
|
|
4
|
+
import testDefinition from '../../MediaTypeSwitch/__tests__/fixtures/test-definition.json';
|
|
5
|
+
import { useExampleKey } from '../../Samples/use-example-key.js';
|
|
6
|
+
describe('useExampleKey method', () => {
|
|
7
|
+
const options = normalizeOptions({});
|
|
8
|
+
const parser = new OpenAPIParser(testDefinition, undefined, options);
|
|
9
|
+
test('should take firstKey as exampleKey if activeExampleName and defaultExampleName are missing', () => {
|
|
10
|
+
const operation = getOperation(parser, {
|
|
11
|
+
pointer: '#/paths/~1test/get',
|
|
12
|
+
pathName: '/test',
|
|
13
|
+
httpVerb: 'GET',
|
|
14
|
+
pathParameters: [],
|
|
15
|
+
pathServers: [],
|
|
16
|
+
isWebhook: false,
|
|
17
|
+
operationId: 'getPet',
|
|
18
|
+
...testDefinition.paths['/test'].get,
|
|
19
|
+
}, undefined, options, '');
|
|
20
|
+
const { result } = renderHook(() => useExampleKey(operation, { key: 'test' }));
|
|
21
|
+
expect(result.current.exampleKey).toBe('key');
|
|
22
|
+
});
|
|
23
|
+
test('should not brake if no operation passed and should take firstKey as exampleKey', () => {
|
|
24
|
+
const { result } = renderHook(() => useExampleKey(undefined, { key: 'test' }));
|
|
25
|
+
expect(result.current.exampleKey).toBe('key');
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=use-example-key.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|