@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 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { act, render } from '@testing-library/react';
|
|
3
|
+
import { MediaTypesSwitch } from '../MediaTypesSwitch.js';
|
|
4
|
+
import { getOperation } from '../../../models/index.js';
|
|
5
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
6
|
+
import testDefinition from './fixtures/test-definition.json';
|
|
7
|
+
import { withTestProviders } from '../../../testProviders.js';
|
|
8
|
+
describe('Components', () => {
|
|
9
|
+
describe('MediaTypesSwitch', () => {
|
|
10
|
+
const options = normalizeOptions({});
|
|
11
|
+
const parser = new OpenAPIParser(testDefinition, undefined, options);
|
|
12
|
+
let operation;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
operation = getOperation(parser, {
|
|
15
|
+
pointer: '#/paths/~1test/get',
|
|
16
|
+
pathName: '/test',
|
|
17
|
+
httpVerb: 'GET',
|
|
18
|
+
pathParameters: [],
|
|
19
|
+
pathServers: [],
|
|
20
|
+
isWebhook: false,
|
|
21
|
+
isAdditionalOperation: false,
|
|
22
|
+
...testDefinition.paths['/test'].get,
|
|
23
|
+
}, undefined, options, '');
|
|
24
|
+
});
|
|
25
|
+
test('renders with default media type by default', () => {
|
|
26
|
+
const childrenFn = vi.fn((mimeType) => _jsxs(_Fragment, { children: ["children: ", mimeType.name] }));
|
|
27
|
+
const renderSelectFn = vi.fn(() => null);
|
|
28
|
+
const { getByText } = render(withTestProviders(_jsx(MediaTypesSwitch, { renderSelect: renderSelectFn, content: operation.requestBody?.content, children: childrenFn }), { definition: parser.definition }));
|
|
29
|
+
expect(renderSelectFn.mock.calls[0][0].options).toEqual([
|
|
30
|
+
{ idx: 0, value: 'application/json' },
|
|
31
|
+
{ idx: 1, value: 'application/xml' },
|
|
32
|
+
]);
|
|
33
|
+
expect(getByText('children: application/json')).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
test('withLabel renders label', () => {
|
|
36
|
+
const childrenFn = vi.fn((mimeType) => _jsxs(_Fragment, { children: ["children: ", mimeType.name] }));
|
|
37
|
+
const renderSelectFn = vi.fn(() => _jsx(_Fragment, { children: "dropdown" }));
|
|
38
|
+
const { getByText } = render(withTestProviders(_jsx(MediaTypesSwitch, { withLabel: true, renderSelect: renderSelectFn, content: operation.requestBody?.content, children: childrenFn }), { definition: parser.definition }));
|
|
39
|
+
expect(getByText('Content type')).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
test('should try to restore scroll on switch', async () => {
|
|
42
|
+
const childrenFn = vi.fn((mimeType) => _jsxs(_Fragment, { children: ["children: ", mimeType.name] }));
|
|
43
|
+
const renderSelectFn = vi.fn(() => (_jsx(_Fragment, { children: "dropdown" })));
|
|
44
|
+
const { findByText, container } = render(withTestProviders(_jsx(MediaTypesSwitch, { withLabel: true, renderSelect: renderSelectFn, content: operation.requestBody?.content, children: childrenFn }), { definition: parser.definition }));
|
|
45
|
+
// Create a mock implementation of window.scrollBy
|
|
46
|
+
const scrollByMock = vi.fn();
|
|
47
|
+
Object.defineProperty(window, 'scrollBy', { value: scrollByMock });
|
|
48
|
+
const rectMock = vi.fn(() => {
|
|
49
|
+
return (rectMock.mock.calls.length > 1 ? { y: 150 } : { y: 100 });
|
|
50
|
+
});
|
|
51
|
+
vi.spyOn(container?.firstElementChild, 'getBoundingClientRect').mockImplementation(rectMock);
|
|
52
|
+
act(() => {
|
|
53
|
+
const selectProps = renderSelectFn.mock.calls[0][0];
|
|
54
|
+
selectProps.onChange(selectProps.options[1]);
|
|
55
|
+
});
|
|
56
|
+
await findByText('children: application/xml');
|
|
57
|
+
await new Promise((resolve) => setTimeout(resolve, 500)); // sleep
|
|
58
|
+
expect(rectMock).toHaveBeenCalledTimes(2);
|
|
59
|
+
expect(scrollByMock).toHaveBeenCalledWith(0, 50);
|
|
60
|
+
});
|
|
61
|
+
test('should not throw and render null for empty media types', () => {
|
|
62
|
+
const childrenFn = vi.fn((mimeType) => _jsxs(_Fragment, { children: ["children: ", mimeType.name] }));
|
|
63
|
+
const renderSelectFn = vi.fn(() => null);
|
|
64
|
+
const { container } = render(withTestProviders(_jsx(MediaTypesSwitch, { renderSelect: renderSelectFn,
|
|
65
|
+
// @ts-ignore invalid content shape
|
|
66
|
+
content: null, children: childrenFn }), { definition: parser.definition }));
|
|
67
|
+
expect(container.firstChild).toBeNull();
|
|
68
|
+
const { container: container2 } = render(withTestProviders(_jsx(MediaTypesSwitch, { renderSelect: renderSelectFn,
|
|
69
|
+
// @ts-expect-error invalid content shape
|
|
70
|
+
content: { mediaTypes: null }, children: childrenFn }), { definition: parser.definition }));
|
|
71
|
+
expect(container2.firstChild).toBeNull();
|
|
72
|
+
const { container: container3 } = render(withTestProviders(_jsx(MediaTypesSwitch, { renderSelect: renderSelectFn,
|
|
73
|
+
// @ts-expect-error invalid content shape
|
|
74
|
+
content: { mediaTypes: [] }, children: childrenFn }), { definition: parser.definition }));
|
|
75
|
+
expect(container3.firstChild).toBeNull();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=MediaTypesSwitch.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { OperationItem } from '../OperationItem.js';
|
|
4
|
+
import { normalizeOptions } from '../../../services/index.js';
|
|
5
|
+
import spec from './fixtures/petstore.json';
|
|
6
|
+
import definition from './fixtures/operationDefinition.json';
|
|
7
|
+
import { environmentAtom } from '../../../jotai/app.js';
|
|
8
|
+
import { globalStoreAtom } from '../../../jotai/store.js';
|
|
9
|
+
import { allOperationsAtom } from '../../../jotai/replay.js';
|
|
10
|
+
import { MockIntersectionObserver } from './__mocks__/mock-intersection-observer.js';
|
|
11
|
+
import { TestBrowserRouter } from '../../../testProviders.js';
|
|
12
|
+
vi.mock('jotai', async () => ({
|
|
13
|
+
...(await vi.importActual('jotai')),
|
|
14
|
+
useAtomValue: vi.fn((a) => {
|
|
15
|
+
if (a === globalStoreAtom) {
|
|
16
|
+
return {
|
|
17
|
+
parser: {
|
|
18
|
+
definition: spec,
|
|
19
|
+
},
|
|
20
|
+
options: normalizeOptions({
|
|
21
|
+
codeSamples: {
|
|
22
|
+
languages: [{ lang: 'curl', label: 'curl' }],
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (a === environmentAtom) {
|
|
28
|
+
return [{}, ''];
|
|
29
|
+
}
|
|
30
|
+
if (a === allOperationsAtom) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
return {};
|
|
34
|
+
}),
|
|
35
|
+
useAtom: vi.fn((a) => {
|
|
36
|
+
if (a === environmentAtom) {
|
|
37
|
+
return [[{ server: {} }], vi.fn()];
|
|
38
|
+
}
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
activeOneOf: { '/paths/~1pet/post': 0 },
|
|
42
|
+
requestValues: {},
|
|
43
|
+
request: { expandedFields: {} },
|
|
44
|
+
response: { expandedFields: {} },
|
|
45
|
+
activeLanguage: 'curl',
|
|
46
|
+
},
|
|
47
|
+
vi.fn(),
|
|
48
|
+
];
|
|
49
|
+
}),
|
|
50
|
+
}));
|
|
51
|
+
describe('OperationItem', () => {
|
|
52
|
+
beforeAll(() => {
|
|
53
|
+
window.IntersectionObserver = MockIntersectionObserver;
|
|
54
|
+
});
|
|
55
|
+
it('should render badges with correct position', () => {
|
|
56
|
+
const { getByTestId } = render(_jsx(OperationItem, { item: {
|
|
57
|
+
operationDefinition: definition,
|
|
58
|
+
parent: undefined,
|
|
59
|
+
href: 'test',
|
|
60
|
+
} }), {
|
|
61
|
+
wrapper: TestBrowserRouter,
|
|
62
|
+
});
|
|
63
|
+
const parentElement = getByTestId('operation-item-header');
|
|
64
|
+
const childNodes = parentElement.childNodes;
|
|
65
|
+
expect(childNodes[1].textContent).toBe('Alpha');
|
|
66
|
+
expect(childNodes[3].textContent).toBe('Beta');
|
|
67
|
+
expect(childNodes[4].textContent).toBe('Gamma');
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=OperationItem.test.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class MockIntersectionObserver {
|
|
2
|
+
readonly root: Element | Document | null;
|
|
3
|
+
readonly rootMargin: string;
|
|
4
|
+
readonly scrollMargin: string;
|
|
5
|
+
readonly thresholds: ReadonlyArray<number>;
|
|
6
|
+
private viewPort;
|
|
7
|
+
private entries;
|
|
8
|
+
private readonly callback;
|
|
9
|
+
constructor(callback: IntersectionObserverCallback, options?: IntersectionObserverInit);
|
|
10
|
+
private intersect;
|
|
11
|
+
isInViewPort(target: HTMLElement): boolean;
|
|
12
|
+
observe(target: HTMLElement): void;
|
|
13
|
+
unobserve(target: HTMLElement): void;
|
|
14
|
+
disconnect(): void;
|
|
15
|
+
takeRecords(): any[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export class MockIntersectionObserver {
|
|
2
|
+
root;
|
|
3
|
+
rootMargin;
|
|
4
|
+
scrollMargin;
|
|
5
|
+
thresholds;
|
|
6
|
+
viewPort;
|
|
7
|
+
entries;
|
|
8
|
+
callback;
|
|
9
|
+
constructor(callback, options) {
|
|
10
|
+
this.viewPort = options?.root ? options.root : window;
|
|
11
|
+
this.entries = [];
|
|
12
|
+
this.root = null;
|
|
13
|
+
this.rootMargin = '0px';
|
|
14
|
+
this.scrollMargin = '';
|
|
15
|
+
this.thresholds = [1];
|
|
16
|
+
this.callback = callback;
|
|
17
|
+
this.viewPort.addEventListener('scroll', this.intersect);
|
|
18
|
+
}
|
|
19
|
+
intersect = () => {
|
|
20
|
+
this.entries.map((entry) => {
|
|
21
|
+
entry.isIntersecting = this.isInViewPort(entry.target);
|
|
22
|
+
});
|
|
23
|
+
this.callback(this.entries, this);
|
|
24
|
+
};
|
|
25
|
+
isInViewPort(target) {
|
|
26
|
+
return target.id !== 'toc-0';
|
|
27
|
+
}
|
|
28
|
+
observe(target) {
|
|
29
|
+
this.entries.push({ isIntersecting: false, target });
|
|
30
|
+
}
|
|
31
|
+
unobserve(target) {
|
|
32
|
+
this.entries = this.entries.filter((ob) => ob.target !== target);
|
|
33
|
+
}
|
|
34
|
+
disconnect() {
|
|
35
|
+
this.viewPort.removeEventListener('scroll', this.intersect);
|
|
36
|
+
this.entries = [];
|
|
37
|
+
}
|
|
38
|
+
takeRecords() {
|
|
39
|
+
return this.entries;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=mock-intersection-observer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { Overview } from '../Overview.js';
|
|
4
|
+
const mockTranslate = (key, defaultValue) => defaultValue || key;
|
|
5
|
+
describe('Overview', () => {
|
|
6
|
+
it('should render correctly with full data', () => {
|
|
7
|
+
const info = {
|
|
8
|
+
title: 'Test API',
|
|
9
|
+
version: '1.0.0',
|
|
10
|
+
description: 'Test description',
|
|
11
|
+
contact: {
|
|
12
|
+
name: 'Test Contact',
|
|
13
|
+
url: 'https://example.com',
|
|
14
|
+
email: 'test@example.com',
|
|
15
|
+
},
|
|
16
|
+
license: {
|
|
17
|
+
name: 'MIT',
|
|
18
|
+
url: 'https://opensource.org/licenses/MIT',
|
|
19
|
+
identifier: 'MIT',
|
|
20
|
+
},
|
|
21
|
+
termsOfService: 'https://example.com/terms',
|
|
22
|
+
};
|
|
23
|
+
const { container } = render(_jsx(Overview, { info: info, translate: mockTranslate }));
|
|
24
|
+
expect(container).toMatchSnapshot();
|
|
25
|
+
});
|
|
26
|
+
it('should render correctly with partial data', () => {
|
|
27
|
+
const info = {
|
|
28
|
+
title: 'Test API',
|
|
29
|
+
version: '1.0.0',
|
|
30
|
+
};
|
|
31
|
+
const { container } = render(_jsx(Overview, { info: info, translate: mockTranslate }));
|
|
32
|
+
expect(container).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
it('should render correctly with contact data but without a name', () => {
|
|
35
|
+
const info = {
|
|
36
|
+
title: 'Test API',
|
|
37
|
+
version: '1.0.0',
|
|
38
|
+
contact: {
|
|
39
|
+
url: 'https://example.com',
|
|
40
|
+
email: 'test@example.com',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
const { container } = render(_jsx(Overview, { info: info, translate: mockTranslate }));
|
|
44
|
+
expect(container).toMatchSnapshot();
|
|
45
|
+
});
|
|
46
|
+
it('should render license with name and url when identifier is not present', () => {
|
|
47
|
+
const info = {
|
|
48
|
+
title: 'Test API',
|
|
49
|
+
version: '1.0.0',
|
|
50
|
+
license: {
|
|
51
|
+
name: 'Apache 2.0',
|
|
52
|
+
url: 'https://www.apache.org/licenses/LICENSE-2.0.html',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
const { container } = render(_jsx(Overview, { info: info, translate: mockTranslate }));
|
|
56
|
+
expect(container).toMatchSnapshot();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=Overview.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import * as Jotai from 'jotai';
|
|
4
|
+
import { Example } from '../Example.js';
|
|
5
|
+
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
6
|
+
import { getExamples } from '../../../models/index.js';
|
|
7
|
+
import testDefinition from './fixtures/mediaTypeUrlencoded.json';
|
|
8
|
+
describe('Example component', () => {
|
|
9
|
+
const opts = normalizeOptions({});
|
|
10
|
+
const parser = new OpenAPIParser(testDefinition, undefined, opts);
|
|
11
|
+
it('render component without error when `externalValue` is pdf file', () => {
|
|
12
|
+
const example = getExamples({
|
|
13
|
+
parser,
|
|
14
|
+
infoOrRef: {
|
|
15
|
+
summary: 'A sample file',
|
|
16
|
+
externalValue: 'https://assets.identi.tech/dummy.pdf',
|
|
17
|
+
},
|
|
18
|
+
mime: 'application/pdf',
|
|
19
|
+
});
|
|
20
|
+
const { container } = render(_jsx(Jotai.Provider, { children: _jsx(Example, { example: example, mimeType: example.mime, onCopyClick: vi.fn() }) }));
|
|
21
|
+
expect(container).toMatchSnapshot();
|
|
22
|
+
});
|
|
23
|
+
it('render component with `externalValue`', () => {
|
|
24
|
+
const example = getExamples({
|
|
25
|
+
parser,
|
|
26
|
+
infoOrRef: {
|
|
27
|
+
summary: 'A sample json',
|
|
28
|
+
externalValue: 'https://jsonplaceholder.typicode.com/todos/1',
|
|
29
|
+
},
|
|
30
|
+
mime: 'application/json',
|
|
31
|
+
});
|
|
32
|
+
const { container } = render(_jsx(Jotai.Provider, { children: _jsx(Example, { example: example, mimeType: example.mime, onCopyClick: vi.fn() }) }));
|
|
33
|
+
expect(container).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=Example.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|