@redocly/openapi-docs 3.24.1 → 3.25.0-next.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-j-VDfFJ9.js → redocly-openapi-docs.min.AiChatProvider-CDMc3dS6.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-BBRBmffc.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-BopXqcPv.js} +1 -1
- package/dist/{redocly-openapi-docs.min.AiPanel-DTzHqAiI.js → redocly-openapi-docs.min.AiPanel-DkXOeLs5.js} +1 -1
- package/dist/redocly-openapi-docs.min.FileWatcher-DMjNW66W.js +1 -0
- package/dist/{redocly-openapi-docs.min.SemanticSearchService-DNFOPBZK.js → redocly-openapi-docs.min.SemanticSearchService-DbpnWseN.js} +1 -1
- package/dist/{redocly-openapi-docs.min.SqliteDBStorage-Dy40Vq04.js → redocly-openapi-docs.min.SqliteDBStorage-ak3Zqgtw.js} +1 -1
- package/dist/{redocly-openapi-docs.min.TauriFileSystemAdapter-CpViFqJQ.js → redocly-openapi-docs.min.TauriFileSystemAdapter-Dl2fY3am.js} +1 -1
- package/dist/{redocly-openapi-docs.min.TauriRootStorage-TCUrp2uB.js → redocly-openapi-docs.min.TauriRootStorage-m4plsfqx.js} +1 -1
- package/dist/{redocly-openapi-docs.min.ai-chat-mappers-CmX-8902.js → redocly-openapi-docs.min.ai-chat-mappers-Dg8U8w8r.js} +1 -1
- package/dist/{redocly-openapi-docs.min.external-resolver-BkceRyB4.js → redocly-openapi-docs.min.external-resolver-Db7hewsm.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-BCcol5vU.js → redocly-openapi-docs.min.index-B5-R6EGY.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-CmXZfuiZ.js → redocly-openapi-docs.min.index-D9U4Tk7n.js} +1320 -1213
- package/dist/{redocly-openapi-docs.min.index-DVWw0ICA.js → redocly-openapi-docs.min.index-DeHk4n2z.js} +1 -1
- package/dist/{redocly-openapi-docs.min.index-C6uU_v-b.js → redocly-openapi-docs.min.index-EVRmC_IQ.js} +1 -1
- package/dist/redocly-openapi-docs.min.js +1 -1
- package/dist/{redocly-openapi-docs.min.lint-2YpbCz3r.js → redocly-openapi-docs.min.lint-PvmGrAK3.js} +2 -2
- package/dist/{redocly-openapi-docs.min.lint-graphql-Bgfcu2tP.js → redocly-openapi-docs.min.lint-graphql-CMMhYVr_.js} +1 -1
- package/dist/{redocly-openapi-docs.min.respect-run-Ct8taisL.js → redocly-openapi-docs.min.respect-run-DgsYdmxw.js} +1 -1
- package/dist/{redocly-openapi-docs.min.standalone-BPCdJgtH.js → redocly-openapi-docs.min.standalone-D9becCWS.js} +708 -673
- package/dist/redocly-openapi-docs.min.tauri-path-Bv9A5DVf.js +1 -0
- package/dist/{redocly-openapi-docs.min.useAiChatQueries-t8oy8jik.js → redocly-openapi-docs.min.useAiChatQueries-Cb-1pa0w.js} +2 -2
- package/lib/telemetry/RedocTelemetry.js +1 -31
- package/package.json +5 -5
- package/dist/redocly-openapi-docs.min.FileWatcher-DDoyaS7A.js +0 -1
- package/dist/redocly-openapi-docs.min.tauri-path-CmqBCxGb.js +0 -1
- package/lib/components/ApiInfo/__tests__/ApiInfo.test.d.ts +0 -1
- package/lib/components/ApiInfo/__tests__/ApiInfo.test.js +0 -46
- package/lib/components/Callbacks/__tests__/Callbacks.test.d.ts +0 -1
- package/lib/components/Callbacks/__tests__/Callbacks.test.js +0 -46
- package/lib/components/Content/__tests__/useAutoScroll.test.d.ts +0 -1
- package/lib/components/Content/__tests__/useAutoScroll.test.js +0 -88
- package/lib/components/ContentItem/__tests__/useIsExpanded.test.d.ts +0 -1
- package/lib/components/ContentItem/__tests__/useIsExpanded.test.js +0 -123
- package/lib/components/ContentItems/__tests__/Items.test.d.ts +0 -1
- package/lib/components/ContentItems/__tests__/Items.test.js +0 -66
- package/lib/components/ContentItems/__tests__/VirtualList.test.d.ts +0 -1
- package/lib/components/ContentItems/__tests__/VirtualList.test.js +0 -135
- package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.d.ts +0 -1
- package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.js +0 -63
- package/lib/components/Download/__tests__/DownloadSpecification.test.d.ts +0 -1
- package/lib/components/Download/__tests__/DownloadSpecification.test.js +0 -52
- package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.d.ts +0 -1
- package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.js +0 -60
- package/lib/components/ExpandAllButton/__tests__/helpers.test.d.ts +0 -1
- package/lib/components/ExpandAllButton/__tests__/helpers.test.js +0 -133
- package/lib/components/Language/__tests__/LanguageDropdown.test.d.ts +0 -1
- package/lib/components/Language/__tests__/LanguageDropdown.test.js +0 -23
- package/lib/components/Markdown/__tests__/Markdown.test.d.ts +0 -1
- package/lib/components/Markdown/__tests__/Markdown.test.js +0 -34
- package/lib/components/McpOverview/__tests__/McpOverview.test.d.ts +0 -1
- package/lib/components/McpOverview/__tests__/McpOverview.test.js +0 -66
- package/lib/components/McpTool/__tests__/McpPrompt.test.d.ts +0 -1
- package/lib/components/McpTool/__tests__/McpPrompt.test.js +0 -57
- package/lib/components/McpTool/__tests__/McpResource.test.d.ts +0 -1
- package/lib/components/McpTool/__tests__/McpResource.test.js +0 -81
- package/lib/components/McpTool/__tests__/McpTool.test.d.ts +0 -1
- package/lib/components/McpTool/__tests__/McpTool.test.js +0 -82
- package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.d.ts +0 -1
- package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.js +0 -79
- package/lib/components/OperationItem/__tests__/OperationItem.test.d.ts +0 -1
- package/lib/components/OperationItem/__tests__/OperationItem.test.js +0 -70
- package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.d.ts +0 -16
- package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.js +0 -42
- package/lib/components/Overview/__tests__/Overview.test.d.ts +0 -1
- package/lib/components/Overview/__tests__/Overview.test.js +0 -59
- package/lib/components/PayloadSamples/__tests__/Example.test.d.ts +0 -1
- package/lib/components/PayloadSamples/__tests__/Example.test.js +0 -36
- package/lib/components/PayloadSamples/__tests__/ExampleValue.test.d.ts +0 -1
- package/lib/components/PayloadSamples/__tests__/ExampleValue.test.js +0 -197
- package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.d.ts +0 -1
- package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.js +0 -38
- package/lib/components/PropertyDetails/__tests__/Extensions.test.d.ts +0 -1
- package/lib/components/PropertyDetails/__tests__/Extensions.test.js +0 -21
- package/lib/components/PropertyDetails/__tests__/FieldDetail.test.d.ts +0 -1
- package/lib/components/PropertyDetails/__tests__/FieldDetail.test.js +0 -52
- package/lib/components/PropertyDetails/__tests__/FieldDetails.test.d.ts +0 -1
- package/lib/components/PropertyDetails/__tests__/FieldDetails.test.js +0 -191
- package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.d.ts +0 -1
- package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.js +0 -365
- package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.d.ts +0 -1
- package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.js +0 -23
- package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.d.ts +0 -1
- package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.js +0 -16
- package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.d.ts +0 -1
- package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.js +0 -104
- package/lib/components/RenderHook/__tests__/RenderHook.test.d.ts +0 -1
- package/lib/components/RenderHook/__tests__/RenderHook.test.js +0 -15
- package/lib/components/Replay/__tests__/utils.test.d.ts +0 -1
- package/lib/components/Replay/__tests__/utils.test.js +0 -526
- package/lib/components/Request/__tests__/RequestDetails.test.d.ts +0 -1
- package/lib/components/Request/__tests__/RequestDetails.test.js +0 -98
- package/lib/components/RequestSamples/__tests__/Example.test.d.ts +0 -1
- package/lib/components/RequestSamples/__tests__/Example.test.js +0 -384
- package/lib/components/RequestSamples/__tests__/RequestSamples.test.d.ts +0 -1
- package/lib/components/RequestSamples/__tests__/RequestSamples.test.js +0 -226
- package/lib/components/RequestSamples/__tests__/useCodeSamples.test.d.ts +0 -1
- package/lib/components/RequestSamples/__tests__/useCodeSamples.test.js +0 -64
- package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.d.ts +0 -1
- package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.js +0 -29
- package/lib/components/Responses/__tests__/OperationResponseList.test.d.ts +0 -1
- package/lib/components/Responses/__tests__/OperationResponseList.test.js +0 -89
- package/lib/components/Responses/__tests__/ResponseDetails.test.d.ts +0 -1
- package/lib/components/Responses/__tests__/ResponseDetails.test.js +0 -111
- package/lib/components/Responses/__tests__/ResponsesHeaders.test.d.ts +0 -1
- package/lib/components/Responses/__tests__/ResponsesHeaders.test.js +0 -26
- package/lib/components/Schema/__tests__/ArraySchema.test.d.ts +0 -1
- package/lib/components/Schema/__tests__/ArraySchema.test.js +0 -93
- package/lib/components/Schema/__tests__/ObjectSchema.test.d.ts +0 -1
- package/lib/components/Schema/__tests__/ObjectSchema.test.js +0 -115
- package/lib/components/Schema/__tests__/OneOfSchema.test.d.ts +0 -1
- package/lib/components/Schema/__tests__/OneOfSchema.test.js +0 -33
- package/lib/components/Schema/__tests__/Schema.test.d.ts +0 -1
- package/lib/components/Schema/__tests__/Schema.test.js +0 -67
- package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.d.ts +0 -1
- package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.js +0 -22
- package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.d.ts +0 -1
- package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.js +0 -95
- package/lib/components/Security/__tests__/Security.test.d.ts +0 -1
- package/lib/components/Security/__tests__/Security.test.js +0 -38
- package/lib/components/Security/__tests__/SecurityButton.test.d.ts +0 -1
- package/lib/components/Security/__tests__/SecurityButton.test.js +0 -92
- package/lib/components/Security/__tests__/SecurityModal.test.d.ts +0 -1
- package/lib/components/Security/__tests__/SecurityModal.test.js +0 -172
- package/lib/components/ServerList/__tests__/ServerList.test.d.ts +0 -1
- package/lib/components/ServerList/__tests__/ServerList.test.js +0 -83
- package/lib/components/Tabs/__tests__/Tabs.test.d.ts +0 -1
- package/lib/components/Tabs/__tests__/Tabs.test.js +0 -27
- package/lib/components/ViewNested/__tests__/ViewNested.test.d.ts +0 -1
- package/lib/components/ViewNested/__tests__/ViewNested.test.js +0 -42
- package/lib/components/__tests__/Samples/ExampleSwitch.test.d.ts +0 -1
- package/lib/components/__tests__/Samples/ExampleSwitch.test.js +0 -45
- package/lib/components/__tests__/Samples/use-example-key.test.d.ts +0 -1
- package/lib/components/__tests__/Samples/use-example-key.test.js +0 -28
- package/lib/components/__tests__/common/ClearButton.test.d.ts +0 -1
- package/lib/components/__tests__/common/ClearButton.test.js +0 -18
- package/lib/components/__tests__/common/Dropdown.test.d.ts +0 -1
- package/lib/components/__tests__/common/Dropdown.test.js +0 -52
- package/lib/components/__tests__/mocks/examples.d.ts +0 -4
- package/lib/components/__tests__/mocks/examples.js +0 -115
- package/lib/components/common/__tests__/Dropdown.test.d.ts +0 -1
- package/lib/components/common/__tests__/Dropdown.test.js +0 -129
- package/lib/components/common/__tests__/LinkToField.test.d.ts +0 -1
- package/lib/components/common/__tests__/LinkToField.test.js +0 -39
- package/lib/jotai/__tests__/app.test.d.ts +0 -1
- package/lib/jotai/__tests__/app.test.js +0 -53
- package/lib/models/__tests__/Callback.test.d.ts +0 -1
- package/lib/models/__tests__/Callback.test.js +0 -15
- package/lib/models/__tests__/FieldModel.test.d.ts +0 -1
- package/lib/models/__tests__/FieldModel.test.js +0 -117
- package/lib/models/__tests__/MediaContent.test.d.ts +0 -1
- package/lib/models/__tests__/MediaContent.test.js +0 -105
- package/lib/models/__tests__/Operation.test.d.ts +0 -1
- package/lib/models/__tests__/Operation.test.js +0 -459
- package/lib/models/__tests__/Response.test.d.ts +0 -1
- package/lib/models/__tests__/Response.test.js +0 -221
- package/lib/models/__tests__/Schema.circular.test.d.ts +0 -1
- package/lib/models/__tests__/Schema.circular.test.js +0 -694
- package/lib/models/__tests__/Schema.test.d.ts +0 -1
- package/lib/models/__tests__/Schema.test.js +0 -1395
- package/lib/models/__tests__/example.test.d.ts +0 -1
- package/lib/models/__tests__/example.test.js +0 -90
- package/lib/models/__tests__/group.test.d.ts +0 -1
- package/lib/models/__tests__/group.test.js +0 -52
- package/lib/models/__tests__/helpers.d.ts +0 -5
- package/lib/models/__tests__/helpers.js +0 -62
- package/lib/models/__tests__/request.test.d.ts +0 -1
- package/lib/models/__tests__/request.test.js +0 -119
- package/lib/services/__tests__/OpenAPIParser.test.d.ts +0 -1
- package/lib/services/__tests__/OpenAPIParser.test.js +0 -80
- package/lib/services/__tests__/check.test.d.ts +0 -1
- package/lib/services/__tests__/check.test.js +0 -22
- package/lib/services/__tests__/utils.test.d.ts +0 -1
- package/lib/services/__tests__/utils.test.js +0 -42
- package/lib/services/code-samples/__tests__/apply-environments.test.d.ts +0 -1
- package/lib/services/code-samples/__tests__/apply-environments.test.js +0 -64
- package/lib/services/code-samples/__tests__/build-code-samples.test.d.ts +0 -1
- package/lib/services/code-samples/__tests__/build-code-samples.test.js +0 -70
- package/lib/services/code-samples/__tests__/convertSampleToString.test.d.ts +0 -1
- package/lib/services/code-samples/__tests__/convertSampleToString.test.js +0 -116
- package/lib/services/code-samples/__tests__/generator-data-value.test.d.ts +0 -1
- package/lib/services/code-samples/__tests__/generator-data-value.test.js +0 -277
- package/lib/services/code-samples/__tests__/generator-serialized-value.test.d.ts +0 -1
- package/lib/services/code-samples/__tests__/generator-serialized-value.test.js +0 -258
- package/lib/services/code-samples/__tests__/generator-value.test.d.ts +0 -1
- package/lib/services/code-samples/__tests__/generator-value.test.js +0 -273
- package/lib/services/code-samples/__tests__/generator.test.d.ts +0 -249
- package/lib/services/code-samples/__tests__/generator.test.js +0 -1201
- package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.d.ts +0 -1
- package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.js +0 -31
- package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.js +0 -222
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.js +0 -129
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.js +0 -49
- package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.js +0 -172
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.js +0 -172
- package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.js +0 -130
- package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.js +0 -191
- package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.js +0 -172
- package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.js +0 -85
- package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.js +0 -85
- package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.js +0 -126
- package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.js +0 -105
- package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.js +0 -126
- package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.js +0 -129
- package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.d.ts +0 -1
- package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.js +0 -129
- package/lib/services/config-options/__tests__/helpers.test.d.ts +0 -1
- package/lib/services/config-options/__tests__/helpers.test.js +0 -234
- package/lib/services/history/__tests__/helpers.test.d.ts +0 -1
- package/lib/services/history/__tests__/helpers.test.js +0 -19
- package/lib/services/menu/__tests__/buildNestedTagsItems.test.d.ts +0 -1
- package/lib/services/menu/__tests__/buildNestedTagsItems.test.js +0 -109
- package/lib/services/menu/__tests__/builder.test.d.ts +0 -1
- package/lib/services/menu/__tests__/builder.test.js +0 -307
- package/lib/services/menu/__tests__/operation.test.d.ts +0 -1
- package/lib/services/menu/__tests__/operation.test.js +0 -240
- package/lib/services/menu/__tests__/tags.test.d.ts +0 -1
- package/lib/services/menu/__tests__/tags.test.js +0 -71
- package/lib/telemetry/__tests__/RedocTelemetry.test.d.ts +0 -1
- package/lib/telemetry/__tests__/RedocTelemetry.test.js +0 -107
- package/lib/testProviders.d.ts +0 -6
- package/lib/testProviders.js +0 -14
- package/lib/utils/__tests__/areArraysEqual.test.d.ts +0 -1
- package/lib/utils/__tests__/areArraysEqual.test.js +0 -33
- package/lib/utils/__tests__/argValuesHelpers.d.ts +0 -1
- package/lib/utils/__tests__/argValuesHelpers.js +0 -56
- package/lib/utils/__tests__/calculateMaxLength.test.d.ts +0 -1
- package/lib/utils/__tests__/calculateMaxLength.test.js +0 -119
- package/lib/utils/__tests__/configure-helpers.test.d.ts +0 -1
- package/lib/utils/__tests__/configure-helpers.test.js +0 -356
- package/lib/utils/__tests__/convertSwagger2OpenAPI.test.d.ts +0 -1
- package/lib/utils/__tests__/convertSwagger2OpenAPI.test.js +0 -392
- package/lib/utils/__tests__/debounce.test.d.ts +0 -1
- package/lib/utils/__tests__/debounce.test.js +0 -54
- package/lib/utils/__tests__/debug.test.d.ts +0 -1
- package/lib/utils/__tests__/debug.test.js +0 -23
- package/lib/utils/__tests__/dom.test.d.ts +0 -1
- package/lib/utils/__tests__/dom.test.js +0 -108
- package/lib/utils/__tests__/getBreadcrumbs.test.d.ts +0 -1
- package/lib/utils/__tests__/getBreadcrumbs.test.js +0 -98
- package/lib/utils/__tests__/hasNestedFields.test.d.ts +0 -1
- package/lib/utils/__tests__/hasNestedFields.test.js +0 -147
- package/lib/utils/__tests__/helpers.test.d.ts +0 -1
- package/lib/utils/__tests__/helpers.test.js +0 -174
- package/lib/utils/__tests__/isMobile.test.d.ts +0 -1
- package/lib/utils/__tests__/isMobile.test.js +0 -28
- package/lib/utils/__tests__/loadAndBundleSpec.test.d.ts +0 -1
- package/lib/utils/__tests__/loadAndBundleSpec.test.js +0 -22
- package/lib/utils/__tests__/local-storage.test.d.ts +0 -1
- package/lib/utils/__tests__/local-storage.test.js +0 -48
- package/lib/utils/__tests__/object.test.d.ts +0 -1
- package/lib/utils/__tests__/object.test.js +0 -45
- package/lib/utils/__tests__/openapi.test.d.ts +0 -1
- package/lib/utils/__tests__/openapi.test.js +0 -1378
- package/lib/utils/__tests__/path.test.d.ts +0 -1
- package/lib/utils/__tests__/path.test.js +0 -16
- package/lib/utils/__tests__/queryString.test.d.ts +0 -1
- package/lib/utils/__tests__/queryString.test.js +0 -60
- package/lib/utils/__tests__/replaceVariables.test.d.ts +0 -1
- package/lib/utils/__tests__/replaceVariables.test.js +0 -46
- package/lib/utils/__tests__/simplifyAstStructure.test.d.ts +0 -1
- package/lib/utils/__tests__/simplifyAstStructure.test.js +0 -26
- package/lib/utils/__tests__/sort.test.d.ts +0 -1
- package/lib/utils/__tests__/sort.test.js +0 -16
- package/lib/utils/__tests__/string.test.d.ts +0 -1
- package/lib/utils/__tests__/string.test.js +0 -16
- package/lib/utils/__tests__/theme-helpers.test.d.ts +0 -1
- package/lib/utils/__tests__/theme-helpers.test.js +0 -24
- package/lib/utils/__tests__/url.test.d.ts +0 -1
- package/lib/utils/__tests__/url.test.js +0 -134
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { render, fireEvent, screen } from '@testing-library/react';
|
|
3
|
-
import { LanguageDropdown } from '../LanguageDropdown.js';
|
|
4
|
-
const mockSamples = [
|
|
5
|
-
{ key: 'js', title: 'JS', lang: 'js' },
|
|
6
|
-
{ key: 'node.js', title: 'Node.JS', lang: 'nodejs' },
|
|
7
|
-
];
|
|
8
|
-
const mockActiveTab = mockSamples[0].key;
|
|
9
|
-
const mockOnChange = vi.fn();
|
|
10
|
-
describe('LanguageDropdown', () => {
|
|
11
|
-
test('LanguageDropdown renders correctly', () => {
|
|
12
|
-
const { getAllByText } = render(_jsx(LanguageDropdown, { samples: mockSamples, activeTab: mockActiveTab, onChange: mockOnChange }));
|
|
13
|
-
expect(getAllByText(mockSamples[0].title)[0]).toBeInTheDocument();
|
|
14
|
-
});
|
|
15
|
-
test('LanguageDropdown handles onChange correctly', () => {
|
|
16
|
-
const { getAllByText } = render(_jsx(LanguageDropdown, { samples: mockSamples, activeTab: mockActiveTab, onChange: mockOnChange }));
|
|
17
|
-
fireEvent.click(screen.getAllByText(mockSamples[0].title)[0]);
|
|
18
|
-
const otherLanguage = mockSamples[1];
|
|
19
|
-
fireEvent.click(getAllByText(otherLanguage.title)[0]);
|
|
20
|
-
expect(mockOnChange).toHaveBeenCalledWith(otherLanguage.key);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
//# sourceMappingURL=LanguageDropdown.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import * as Jotai from 'jotai/index';
|
|
4
|
-
import { normalizeOptions } from '../../../services/index.js';
|
|
5
|
-
import { Markdown } from '../Markdown.js';
|
|
6
|
-
import { withTestProviders } from '../../../testProviders.js';
|
|
7
|
-
vi.mock('jotai', async () => ({
|
|
8
|
-
...(await vi.importActual('jotai')),
|
|
9
|
-
useAtomValue: vi.fn(),
|
|
10
|
-
}));
|
|
11
|
-
describe('Components', () => {
|
|
12
|
-
describe('Markdown', () => {
|
|
13
|
-
beforeEach(() => {
|
|
14
|
-
vi.clearAllMocks();
|
|
15
|
-
});
|
|
16
|
-
test('Markdown renders correctly', () => {
|
|
17
|
-
const { getByText } = render(withTestProviders(_jsx(Markdown, { source: `# Heading 1\n\n[link](https://google.com)` })));
|
|
18
|
-
expect(getByText('Heading 1')).toBeInTheDocument();
|
|
19
|
-
expect(getByText('link')).toBeInTheDocument();
|
|
20
|
-
expect(getByText('link').closest('a')).toHaveAttribute('href', 'https://google.com');
|
|
21
|
-
});
|
|
22
|
-
test('Markdown custom sanitize works', () => {
|
|
23
|
-
const options = normalizeOptions({
|
|
24
|
-
unstable_hooks: { sanitize: (str) => str.replace('bad word', '**') },
|
|
25
|
-
});
|
|
26
|
-
vi.spyOn(Jotai, 'useAtomValue').mockImplementation(() => {
|
|
27
|
-
return options;
|
|
28
|
-
});
|
|
29
|
-
const { getByText } = render(withTestProviders(_jsx(Markdown, { source: `# Heading 1\n\n[link](https://google.com)\nbad word` })));
|
|
30
|
-
expect(getByText(/\*\*/)).toBeInTheDocument();
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
//# sourceMappingURL=Markdown.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { act, fireEvent, render, screen } from '@testing-library/react';
|
|
3
|
-
import { vi } from 'vitest';
|
|
4
|
-
import { McpOverview } from '../McpOverview.js';
|
|
5
|
-
import { withTestProviders, TestMemoryRouter } from '../../../testProviders.js';
|
|
6
|
-
import mcpInfo from './fixtures/mcp-info.json';
|
|
7
|
-
describe('McpOverview', () => {
|
|
8
|
-
it('should render mcp overview', () => {
|
|
9
|
-
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpOverview, { mcpInfo: mcpInfo, mcpServers: [{ url: 'https://api.example.com/mcp' }] }) })));
|
|
10
|
-
expect(screen.getByText('Protocol version')).toBeInTheDocument();
|
|
11
|
-
expect(screen.getByText('1.0.0')).toBeInTheDocument();
|
|
12
|
-
expect(screen.getByText('Capabilities')).toBeInTheDocument();
|
|
13
|
-
expect(screen.queryByText('tool_code_interpreter')).not.toBeInTheDocument();
|
|
14
|
-
expect(screen.queryByText('tool_image_generation')).not.toBeInTheDocument();
|
|
15
|
-
expect(screen.getByText('Endpoint')).toBeInTheDocument();
|
|
16
|
-
expect(screen.getByText('https://api.example.com/mcp')).toBeInTheDocument();
|
|
17
|
-
});
|
|
18
|
-
it('should render experimental capabilities', () => {
|
|
19
|
-
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpOverview, { mcpInfo: mcpInfo, mcpServers: [{ url: 'https://api.example.com/mcp' }] }) })));
|
|
20
|
-
expect(screen.getByText('Experimental capabilities')).toBeInTheDocument();
|
|
21
|
-
expect(screen.getByText('a:')).toBeInTheDocument();
|
|
22
|
-
expect(screen.getByText('true')).toBeInTheDocument();
|
|
23
|
-
});
|
|
24
|
-
it('should keep endpoint variables visible while resolving the Cursor deeplink url', async () => {
|
|
25
|
-
const openSpy = vi.spyOn(window, 'open').mockImplementation(() => null);
|
|
26
|
-
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpOverview, { mcpInfo: mcpInfo, mcpServers: [
|
|
27
|
-
{
|
|
28
|
-
url: 'https://{projectHost}/mcp',
|
|
29
|
-
variables: {
|
|
30
|
-
projectHost: {
|
|
31
|
-
default: 'redocly.com',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
] }) })));
|
|
36
|
-
expect(screen.getByText('https://{projectHost}/mcp')).toBeInTheDocument();
|
|
37
|
-
await act(async () => {
|
|
38
|
-
fireEvent.click(screen.getByRole('button', { name: 'Connect to Cursor' }));
|
|
39
|
-
});
|
|
40
|
-
expect(openSpy).toHaveBeenCalledWith(expect.any(String), '_blank');
|
|
41
|
-
const deeplink = String(openSpy.mock.calls[0][0]);
|
|
42
|
-
const cursorUrl = new URL(deeplink);
|
|
43
|
-
const encodedConfig = cursorUrl.searchParams.get('config');
|
|
44
|
-
const decodedConfig = JSON.parse(Buffer.from(encodedConfig || '', 'base64').toString('utf-8'));
|
|
45
|
-
expect(decodedConfig).toEqual({
|
|
46
|
-
url: 'https://redocly.com/mcp',
|
|
47
|
-
description: 'MCP Server',
|
|
48
|
-
});
|
|
49
|
-
openSpy.mockRestore();
|
|
50
|
-
});
|
|
51
|
-
it('should render capabilities with listChanged and subscribe', () => {
|
|
52
|
-
const mcpInfoWithExtras = {
|
|
53
|
-
...mcpInfo,
|
|
54
|
-
capabilities: {
|
|
55
|
-
...mcpInfo.capabilities,
|
|
56
|
-
tools: {
|
|
57
|
-
listChanged: true,
|
|
58
|
-
subscribe: true,
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
render(withTestProviders(_jsx(TestMemoryRouter, { children: _jsx(McpOverview, { mcpInfo: mcpInfoWithExtras, mcpServers: [{ url: 'https://api.example.com/mcp' }] }) })));
|
|
63
|
-
expect(screen.getByText(/tools \(list changed\) \(subscribe\)/)).toBeInTheDocument();
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
//# sourceMappingURL=McpOverview.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,57 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,81 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,82 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,79 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,70 +0,0 @@
|
|
|
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
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|