@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,123 +0,0 @@
|
|
|
1
|
-
import { renderHook } from '@testing-library/react';
|
|
2
|
-
import { useLocation } from 'react-router';
|
|
3
|
-
import { useIsExpanded } from '../useIsExpanded.js';
|
|
4
|
-
// Mock react-router
|
|
5
|
-
vi.mock('react-router', () => ({
|
|
6
|
-
useLocation: vi.fn(),
|
|
7
|
-
}));
|
|
8
|
-
const mockUseLocation = useLocation;
|
|
9
|
-
describe('useIsExpanded', () => {
|
|
10
|
-
const mockRoutingBasePath = '/docs';
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
mockUseLocation.mockReset();
|
|
13
|
-
});
|
|
14
|
-
it('should return false for non-tag items', () => {
|
|
15
|
-
mockUseLocation.mockReturnValue({
|
|
16
|
-
pathname: '/docs/pets',
|
|
17
|
-
hash: '',
|
|
18
|
-
state: undefined,
|
|
19
|
-
key: '',
|
|
20
|
-
search: '',
|
|
21
|
-
});
|
|
22
|
-
const item = {
|
|
23
|
-
type: 'operation',
|
|
24
|
-
href: '/pets',
|
|
25
|
-
items: [],
|
|
26
|
-
};
|
|
27
|
-
const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
|
|
28
|
-
expect(result.current).toBe(false);
|
|
29
|
-
});
|
|
30
|
-
it('should return true when current path matches item href', () => {
|
|
31
|
-
mockUseLocation.mockReturnValue({
|
|
32
|
-
pathname: '/docs/pets',
|
|
33
|
-
hash: '',
|
|
34
|
-
state: undefined,
|
|
35
|
-
key: '',
|
|
36
|
-
search: '',
|
|
37
|
-
});
|
|
38
|
-
const item = {
|
|
39
|
-
type: 'tag',
|
|
40
|
-
href: '/pets',
|
|
41
|
-
items: [{ type: 'operation', href: '/pets/get', items: [] }],
|
|
42
|
-
};
|
|
43
|
-
const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
|
|
44
|
-
expect(result.current).toBe(true);
|
|
45
|
-
});
|
|
46
|
-
it('should return true when legacy hash matches item href', () => {
|
|
47
|
-
mockUseLocation.mockReturnValue({
|
|
48
|
-
pathname: '/docs',
|
|
49
|
-
hash: '#tag/pets',
|
|
50
|
-
state: undefined,
|
|
51
|
-
key: '',
|
|
52
|
-
search: '',
|
|
53
|
-
});
|
|
54
|
-
const item = {
|
|
55
|
-
type: 'tag',
|
|
56
|
-
href: '/pets',
|
|
57
|
-
items: [],
|
|
58
|
-
};
|
|
59
|
-
const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
|
|
60
|
-
expect(result.current).toBe(true);
|
|
61
|
-
});
|
|
62
|
-
it('should handle nested items', () => {
|
|
63
|
-
mockUseLocation.mockReturnValue({
|
|
64
|
-
pathname: '/docs/pets/create',
|
|
65
|
-
hash: '',
|
|
66
|
-
state: undefined,
|
|
67
|
-
key: '',
|
|
68
|
-
search: '',
|
|
69
|
-
});
|
|
70
|
-
const item = {
|
|
71
|
-
type: 'tag',
|
|
72
|
-
href: '/pets',
|
|
73
|
-
items: [
|
|
74
|
-
{
|
|
75
|
-
type: 'section',
|
|
76
|
-
href: '/pets',
|
|
77
|
-
items: [
|
|
78
|
-
{
|
|
79
|
-
type: 'section',
|
|
80
|
-
href: '/pets/create',
|
|
81
|
-
items: [],
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
};
|
|
87
|
-
const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
|
|
88
|
-
expect(result.current).toBe(true);
|
|
89
|
-
});
|
|
90
|
-
it('should handle encoded URLs', () => {
|
|
91
|
-
mockUseLocation.mockReturnValue({
|
|
92
|
-
pathname: '/docs/user%20profile',
|
|
93
|
-
hash: '',
|
|
94
|
-
state: undefined,
|
|
95
|
-
key: '',
|
|
96
|
-
search: '',
|
|
97
|
-
});
|
|
98
|
-
const item = {
|
|
99
|
-
type: 'tag',
|
|
100
|
-
href: '/user profile',
|
|
101
|
-
items: [],
|
|
102
|
-
};
|
|
103
|
-
const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
|
|
104
|
-
expect(result.current).toBe(true);
|
|
105
|
-
});
|
|
106
|
-
it('should return false when no matches found', () => {
|
|
107
|
-
mockUseLocation.mockReturnValue({
|
|
108
|
-
pathname: '/docs/users',
|
|
109
|
-
hash: '',
|
|
110
|
-
state: undefined,
|
|
111
|
-
key: '',
|
|
112
|
-
search: '',
|
|
113
|
-
});
|
|
114
|
-
const item = {
|
|
115
|
-
type: 'tag',
|
|
116
|
-
href: '/pets',
|
|
117
|
-
items: [{ type: 'operation', href: '/pets/list', items: [] }],
|
|
118
|
-
};
|
|
119
|
-
const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
|
|
120
|
-
expect(result.current).toBe(false);
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
//# sourceMappingURL=useIsExpanded.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import { Items } from '../Items.js';
|
|
4
|
-
import { TestMemoryRouter } from '../../../testProviders.js';
|
|
5
|
-
vi.mock('../../ContentItem', () => ({
|
|
6
|
-
ContentItem: ({ children, item }) => (_jsxs("div", { "data-testid": `content-item-${item.id}`, children: [item.title, children] })),
|
|
7
|
-
}));
|
|
8
|
-
vi.mock('../VirtualList', () => ({
|
|
9
|
-
VirtualList: ({ items }) => (_jsx("div", { "data-testid": "virtual-list", children: items.map((item) => (_jsx("div", { children: item.title }, item.id))) })),
|
|
10
|
-
}));
|
|
11
|
-
const mockItems = [
|
|
12
|
-
{ id: '1', title: 'Item 1', type: 'group', items: [] },
|
|
13
|
-
{ id: '2', title: 'Item 2', type: 'group', items: [] },
|
|
14
|
-
];
|
|
15
|
-
const mockMixedTypeItems = Array.from({ length: 16 }, (_, i) => ({
|
|
16
|
-
id: `mixed-${i}`,
|
|
17
|
-
title: `Item ${i}`,
|
|
18
|
-
type: i % 2 === 0 ? 'operation' : 'schema',
|
|
19
|
-
items: [],
|
|
20
|
-
}));
|
|
21
|
-
const mockOperationItems = Array.from({ length: 16 }, (_, i) => ({
|
|
22
|
-
id: `op-${i}`,
|
|
23
|
-
title: `Operation ${i}`,
|
|
24
|
-
type: 'operation',
|
|
25
|
-
items: [],
|
|
26
|
-
}));
|
|
27
|
-
describe('Items', () => {
|
|
28
|
-
const renderWithRouter = (component) => {
|
|
29
|
-
return render(_jsx(TestMemoryRouter, { children: component }));
|
|
30
|
-
};
|
|
31
|
-
it('renders null when items array is empty', () => {
|
|
32
|
-
const { container } = renderWithRouter(_jsx(Items, { items: [], routingBasePath: "/docs" }));
|
|
33
|
-
expect(container.firstChild).toBeNull();
|
|
34
|
-
});
|
|
35
|
-
it('renders regular list for less than 10 items', () => {
|
|
36
|
-
renderWithRouter(_jsx(Items, { items: mockItems, routingBasePath: "/docs" }));
|
|
37
|
-
expect(screen.getByTestId('content-item-1')).toBeInTheDocument();
|
|
38
|
-
expect(screen.getByTestId('content-item-2')).toBeInTheDocument();
|
|
39
|
-
expect(screen.queryByTestId('virtual-list')).not.toBeInTheDocument();
|
|
40
|
-
});
|
|
41
|
-
it('renders VirtualList for more than 15 operation items', () => {
|
|
42
|
-
renderWithRouter(_jsx(Items, { items: mockOperationItems, routingBasePath: "/docs" }));
|
|
43
|
-
expect(screen.getByTestId('virtual-list')).toBeInTheDocument();
|
|
44
|
-
expect(screen.queryByTestId('content-item-1')).not.toBeInTheDocument();
|
|
45
|
-
});
|
|
46
|
-
it('renders VirtualList for more than 15 mixed operation and schema items', () => {
|
|
47
|
-
renderWithRouter(_jsx(Items, { items: mockMixedTypeItems, routingBasePath: "/docs" }));
|
|
48
|
-
expect(screen.getByTestId('virtual-list')).toBeInTheDocument();
|
|
49
|
-
expect(screen.queryByTestId('content-item-mixed-0')).not.toBeInTheDocument();
|
|
50
|
-
});
|
|
51
|
-
it('renders nested items correctly', () => {
|
|
52
|
-
const nestedItems = [
|
|
53
|
-
{
|
|
54
|
-
id: '1',
|
|
55
|
-
title: 'Parent',
|
|
56
|
-
type: 'group',
|
|
57
|
-
items: [{ id: '1-1', title: 'Child', type: 'group', items: [] }],
|
|
58
|
-
},
|
|
59
|
-
];
|
|
60
|
-
renderWithRouter(_jsx(Items, { items: nestedItems, routingBasePath: "/docs" }));
|
|
61
|
-
expect(screen.getByTestId('content-item-1')).toBeInTheDocument();
|
|
62
|
-
expect(screen.getByText('Parent')).toBeInTheDocument();
|
|
63
|
-
expect(screen.getByText('Child')).toBeInTheDocument();
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
//# sourceMappingURL=Items.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import { Routes, Route } from 'react-router';
|
|
4
|
-
import { act } from 'react';
|
|
5
|
-
import { VirtualList } from '../VirtualList.js';
|
|
6
|
-
import { TestMemoryRouter } from '../../../testProviders.js';
|
|
7
|
-
const mockItems = [
|
|
8
|
-
{ href: '/item1', title: 'Item 1' },
|
|
9
|
-
{ href: '/item2', title: 'Item 2' },
|
|
10
|
-
{ href: '/item3', title: 'Item 3' },
|
|
11
|
-
{ href: '/item4', title: 'Item 4' },
|
|
12
|
-
{ href: '/item5', title: 'Item 5' },
|
|
13
|
-
];
|
|
14
|
-
const renderItem = (item) => (_jsx("div", { "data-testid": item.href.replace('/', ''), children: typeof item.title === 'string'
|
|
15
|
-
? String(item.title)
|
|
16
|
-
: String(item.name) }, item.href));
|
|
17
|
-
const renderWithRouter = (initialPath, props) => {
|
|
18
|
-
return render(_jsx(TestMemoryRouter, { initialEntries: [initialPath], children: _jsx(Routes, { children: _jsx(Route, { path: "*", element: _jsx(VirtualList, { ...props }) }) }) }));
|
|
19
|
-
};
|
|
20
|
-
describe('VirtualList', () => {
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
vi.useFakeTimers();
|
|
23
|
-
});
|
|
24
|
-
afterEach(() => {
|
|
25
|
-
vi.clearAllTimers();
|
|
26
|
-
vi.useRealTimers();
|
|
27
|
-
});
|
|
28
|
-
it('should render empty list when no items provided', () => {
|
|
29
|
-
renderWithRouter('/', {
|
|
30
|
-
items: [],
|
|
31
|
-
renderItem,
|
|
32
|
-
routingBasePath: '/',
|
|
33
|
-
});
|
|
34
|
-
expect(screen.queryByTestId(/item/)).not.toBeInTheDocument();
|
|
35
|
-
});
|
|
36
|
-
it('should initially render first three items when no active item', () => {
|
|
37
|
-
renderWithRouter('/non-existing', {
|
|
38
|
-
items: mockItems,
|
|
39
|
-
renderItem,
|
|
40
|
-
routingBasePath: '/',
|
|
41
|
-
});
|
|
42
|
-
expect(screen.getByTestId('item1')).toBeInTheDocument();
|
|
43
|
-
expect(screen.getByTestId('item2')).toBeInTheDocument();
|
|
44
|
-
expect(screen.getByTestId('item3')).toBeInTheDocument();
|
|
45
|
-
expect(screen.queryByTestId('item4')).not.toBeInTheDocument();
|
|
46
|
-
expect(screen.queryByTestId('item5')).not.toBeInTheDocument();
|
|
47
|
-
});
|
|
48
|
-
it('should render items around active item', () => {
|
|
49
|
-
renderWithRouter('/item3', {
|
|
50
|
-
items: mockItems,
|
|
51
|
-
renderItem,
|
|
52
|
-
routingBasePath: '/',
|
|
53
|
-
});
|
|
54
|
-
expect(screen.getByTestId('item2')).toBeInTheDocument();
|
|
55
|
-
expect(screen.getByTestId('item3')).toBeInTheDocument();
|
|
56
|
-
expect(screen.getByTestId('item4')).toBeInTheDocument();
|
|
57
|
-
});
|
|
58
|
-
it('should handle first item selection', () => {
|
|
59
|
-
renderWithRouter('/item1', {
|
|
60
|
-
items: mockItems,
|
|
61
|
-
renderItem,
|
|
62
|
-
routingBasePath: '/',
|
|
63
|
-
});
|
|
64
|
-
expect(screen.getByTestId('item1')).toBeInTheDocument();
|
|
65
|
-
expect(screen.getByTestId('item2')).toBeInTheDocument();
|
|
66
|
-
expect(screen.queryByTestId('item3')).toBeInTheDocument();
|
|
67
|
-
});
|
|
68
|
-
it('should handle last item selection', () => {
|
|
69
|
-
renderWithRouter('/item5', {
|
|
70
|
-
items: mockItems,
|
|
71
|
-
renderItem,
|
|
72
|
-
routingBasePath: '/',
|
|
73
|
-
});
|
|
74
|
-
expect(screen.queryByTestId('item1')).not.toBeInTheDocument();
|
|
75
|
-
expect(screen.queryByTestId('item2')).not.toBeInTheDocument();
|
|
76
|
-
expect(screen.queryByTestId('item3')).not.toBeInTheDocument();
|
|
77
|
-
expect(screen.getByTestId('item4')).toBeInTheDocument();
|
|
78
|
-
expect(screen.getByTestId('item5')).toBeInTheDocument();
|
|
79
|
-
});
|
|
80
|
-
it('should eventually render all items after timeout', () => {
|
|
81
|
-
renderWithRouter('/item3', {
|
|
82
|
-
items: mockItems,
|
|
83
|
-
renderItem,
|
|
84
|
-
routingBasePath: '/',
|
|
85
|
-
});
|
|
86
|
-
expect(screen.getByTestId('item2')).toBeInTheDocument();
|
|
87
|
-
expect(screen.getByTestId('item3')).toBeInTheDocument();
|
|
88
|
-
expect(screen.getByTestId('item4')).toBeInTheDocument();
|
|
89
|
-
act(() => {
|
|
90
|
-
vi.advanceTimersByTime(1000);
|
|
91
|
-
});
|
|
92
|
-
expect(screen.getByTestId('item1')).toBeInTheDocument();
|
|
93
|
-
expect(screen.getByTestId('item2')).toBeInTheDocument();
|
|
94
|
-
expect(screen.getByTestId('item3')).toBeInTheDocument();
|
|
95
|
-
expect(screen.getByTestId('item4')).toBeInTheDocument();
|
|
96
|
-
expect(screen.getByTestId('item5')).toBeInTheDocument();
|
|
97
|
-
});
|
|
98
|
-
it('should handle custom routing base path', () => {
|
|
99
|
-
renderWithRouter('/docs/item1', {
|
|
100
|
-
items: mockItems,
|
|
101
|
-
renderItem,
|
|
102
|
-
routingBasePath: '/docs',
|
|
103
|
-
});
|
|
104
|
-
expect(screen.getByTestId('item1')).toBeInTheDocument();
|
|
105
|
-
expect(screen.getByTestId('item2')).toBeInTheDocument();
|
|
106
|
-
expect(screen.queryByTestId('item3')).toBeInTheDocument();
|
|
107
|
-
});
|
|
108
|
-
it('should not re-render if all items are already visible', () => {
|
|
109
|
-
const { rerender } = renderWithRouter('/item1', {
|
|
110
|
-
items: mockItems,
|
|
111
|
-
renderItem,
|
|
112
|
-
routingBasePath: '/',
|
|
113
|
-
});
|
|
114
|
-
act(() => {
|
|
115
|
-
vi.advanceTimersByTime(1000);
|
|
116
|
-
});
|
|
117
|
-
const initialRenderCount = screen.getAllByTestId(/item/).length;
|
|
118
|
-
rerender(_jsx(TestMemoryRouter, { initialEntries: ['/item3'], children: _jsx(Routes, { children: _jsx(Route, { path: "*", element: _jsx(VirtualList, { items: mockItems, renderItem: renderItem, routingBasePath: "/" }) }) }) }));
|
|
119
|
-
expect(screen.getAllByTestId(/item/).length).toBe(initialRenderCount);
|
|
120
|
-
});
|
|
121
|
-
it('should cleanup on unmount', () => {
|
|
122
|
-
const { unmount } = renderWithRouter('/item1', {
|
|
123
|
-
items: mockItems,
|
|
124
|
-
renderItem,
|
|
125
|
-
routingBasePath: '/',
|
|
126
|
-
});
|
|
127
|
-
unmount();
|
|
128
|
-
expect(() => {
|
|
129
|
-
act(() => {
|
|
130
|
-
vi.runAllTimers();
|
|
131
|
-
});
|
|
132
|
-
}).not.toThrow();
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
//# sourceMappingURL=VirtualList.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import * as Jotai from 'jotai';
|
|
4
|
-
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
5
|
-
import { getSchema } from '../../../models/index.js';
|
|
6
|
-
import { Schema } from '../../Schema/index.js';
|
|
7
|
-
import * as simpleDiscriminatorFixture from './fixtures/simple-discriminator.json';
|
|
8
|
-
import * as discriminatorWithDefaultFixture from '../../../models/__tests__/fixtures/discriminator-with-default-mapping.json';
|
|
9
|
-
import { TestBrowserRouter } from '../../../testProviders.js';
|
|
10
|
-
const options = normalizeOptions({});
|
|
11
|
-
vi.mock('jotai', async () => ({
|
|
12
|
-
...(await vi.importActual('jotai')),
|
|
13
|
-
useAtomValue: vi.fn(),
|
|
14
|
-
}));
|
|
15
|
-
describe('DiscriminatorDropdown', () => {
|
|
16
|
-
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(options);
|
|
17
|
-
const parser = new OpenAPIParser(simpleDiscriminatorFixture, undefined, options);
|
|
18
|
-
const schema = getSchema({
|
|
19
|
-
parser,
|
|
20
|
-
schemaOrRef: { $ref: '#/components/schemas/Pet' },
|
|
21
|
-
pointer: '#/components/schemas/Pet',
|
|
22
|
-
options,
|
|
23
|
-
deps: { operation: { pointer: 'defaultPointer' } },
|
|
24
|
-
});
|
|
25
|
-
describe('discriminator', () => {
|
|
26
|
-
vi.spyOn(Jotai, 'useAtomValue').mockReturnValue({
|
|
27
|
-
activeOneOf: {
|
|
28
|
-
'#/components/schemas/Pet': 0,
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
it('should correctly render SchemaView', () => {
|
|
32
|
-
const { getByText } = render(_jsx(Schema, { schema: schema }), {
|
|
33
|
-
wrapper: TestBrowserRouter,
|
|
34
|
-
});
|
|
35
|
-
expect(getByText('type')).toBeInTheDocument();
|
|
36
|
-
expect(getByText('C̵a̵t̵ (deprecated)')).toBeInTheDocument();
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
describe('discriminator with defaultMapping', () => {
|
|
40
|
-
const parserWithDefault = new OpenAPIParser(discriminatorWithDefaultFixture, undefined, options);
|
|
41
|
-
const schemaWithDefault = getSchema({
|
|
42
|
-
parser: parserWithDefault,
|
|
43
|
-
schemaOrRef: { $ref: '#/components/schemas/Pet' },
|
|
44
|
-
pointer: '#/components/schemas/Pet',
|
|
45
|
-
options,
|
|
46
|
-
deps: { operation: { pointer: 'defaultPointer' } },
|
|
47
|
-
});
|
|
48
|
-
it('schema has correct oneOf structure with defaultMapping', () => {
|
|
49
|
-
expect(schemaWithDefault.oneOf).toHaveLength(3);
|
|
50
|
-
expect(schemaWithDefault.oneOf?.[0].title).toBe('cat');
|
|
51
|
-
expect(schemaWithDefault.oneOf?.[0].isDefaultMapping).toBe(false);
|
|
52
|
-
expect(schemaWithDefault.oneOf?.[1].title).toBe('dog');
|
|
53
|
-
expect(schemaWithDefault.oneOf?.[1].isDefaultMapping).toBe(false);
|
|
54
|
-
expect(schemaWithDefault.oneOf?.[2].title).toBe('Default mapping');
|
|
55
|
-
expect(schemaWithDefault.oneOf?.[2].isDefaultMapping).toBe(true);
|
|
56
|
-
});
|
|
57
|
-
it('finds correct defaultMappingIdx', () => {
|
|
58
|
-
const defaultMappingIdx = schemaWithDefault.oneOf?.findIndex((subSchema) => subSchema.isDefaultMapping);
|
|
59
|
-
expect(defaultMappingIdx).toBe(2);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
//# sourceMappingURL=DiscriminatorDropdown.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { render, renderHook } from '@testing-library/react';
|
|
3
|
-
import util from 'util';
|
|
4
|
-
import { DownloadSpecification } from '../DownloadSpecification.js';
|
|
5
|
-
import { useDownloadInfo } from '../useDownloadInfo.js';
|
|
6
|
-
Object.defineProperty(global, 'TextEncoder', {
|
|
7
|
-
value: util.TextEncoder,
|
|
8
|
-
});
|
|
9
|
-
describe('DownloadSpecification', () => {
|
|
10
|
-
it('DownloadButton renders correctly without title', () => {
|
|
11
|
-
const downloadUrls = [
|
|
12
|
-
{
|
|
13
|
-
url: 'downloadDefinitionUrlValue.json',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
url: 'downloadDefinitionUrlValue.yaml',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
url: 'downloadDefinitionUrlValue.txt',
|
|
20
|
-
},
|
|
21
|
-
];
|
|
22
|
-
const { result } = renderHook(() => useDownloadInfo({
|
|
23
|
-
downloadUrls,
|
|
24
|
-
}));
|
|
25
|
-
const downloadObjects = result?.current ?? [];
|
|
26
|
-
const { container } = render(_jsx(DownloadSpecification, { downloadObjects: downloadObjects }));
|
|
27
|
-
expect(container).toMatchSnapshot();
|
|
28
|
-
});
|
|
29
|
-
it('DownloadButton renders correctly with title', () => {
|
|
30
|
-
const downloadUrls = [
|
|
31
|
-
{
|
|
32
|
-
title: 'OpenAPI Description json format',
|
|
33
|
-
url: 'downloadDefinitionUrlValue.json',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
title: 'OpenAPI Description yaml format',
|
|
37
|
-
url: 'downloadDefinitionUrlValue.yaml',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
title: 'OpenAPI Description text format',
|
|
41
|
-
url: 'downloadDefinitionUrlValue.txt',
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
|
-
const { result } = renderHook(() => useDownloadInfo({
|
|
45
|
-
downloadUrls,
|
|
46
|
-
}));
|
|
47
|
-
const downloadObjects = result?.current ?? [];
|
|
48
|
-
const { container } = render(_jsx(DownloadSpecification, { downloadObjects: downloadObjects }));
|
|
49
|
-
expect(container).toMatchSnapshot();
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
//# sourceMappingURL=DownloadSpecification.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useAtom } from 'jotai/index';
|
|
3
|
-
import { render, screen, fireEvent } from '@testing-library/react';
|
|
4
|
-
import { ExpandAllButton } from '../ExpandAllButton.js';
|
|
5
|
-
import { useTranslate, useTelemetry } from '../../../hooks/index.js';
|
|
6
|
-
// Mock the dependencies
|
|
7
|
-
vi.mock('jotai/index', () => ({
|
|
8
|
-
useAtom: vi.fn(),
|
|
9
|
-
useAtomValue: vi.fn(),
|
|
10
|
-
atom: vi.fn(),
|
|
11
|
-
}));
|
|
12
|
-
vi.mock('../../../hooks', () => ({
|
|
13
|
-
useTranslate: vi.fn(),
|
|
14
|
-
useTelemetry: vi.fn(), // Add mock for useTelemetry
|
|
15
|
-
}));
|
|
16
|
-
vi.mock('@redocly/theme', () => ({
|
|
17
|
-
Button: ({ children, ...props }) => _jsx("button", { ...props, children: children }),
|
|
18
|
-
MaximizeIcon: () => _jsx("span", { "data-testid": "maximize-icon" }),
|
|
19
|
-
}));
|
|
20
|
-
describe('ExpandAllButton', () => {
|
|
21
|
-
const mockSetOperationState = vi.fn();
|
|
22
|
-
const mockTranslate = vi.fn((_key, defaultValue) => defaultValue);
|
|
23
|
-
const mockTelemetrySend = vi.fn();
|
|
24
|
-
beforeEach(() => {
|
|
25
|
-
vi.clearAllMocks();
|
|
26
|
-
useAtom.mockReturnValue([
|
|
27
|
-
{ request: { expandedAll: false }, response: { expandedAll: false } },
|
|
28
|
-
mockSetOperationState,
|
|
29
|
-
]);
|
|
30
|
-
useTranslate.mockReturnValue(mockTranslate);
|
|
31
|
-
useTelemetry.mockReturnValue({
|
|
32
|
-
sendExpandCollapseAllClickedMessage: mockTelemetrySend,
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
it('renders correctly with initial state', () => {
|
|
36
|
-
render(_jsx(ExpandAllButton, { operationPointer: "test", type: "request" }));
|
|
37
|
-
expect(screen.getByRole('button')).toHaveTextContent('Expand all');
|
|
38
|
-
});
|
|
39
|
-
it('toggles state when clicked', () => {
|
|
40
|
-
render(_jsx(ExpandAllButton, { operationPointer: "test", type: "request" }));
|
|
41
|
-
fireEvent.click(screen.getByRole('button'));
|
|
42
|
-
expect(mockSetOperationState).toHaveBeenCalledTimes(1);
|
|
43
|
-
expect(mockSetOperationState).toHaveBeenCalledWith(expect.any(Object));
|
|
44
|
-
const updateObject = mockSetOperationState.mock.calls[0][0];
|
|
45
|
-
expect(updateObject).toEqual({ request: { expandedAll: true } });
|
|
46
|
-
});
|
|
47
|
-
it('displays correct text based on expanded state', () => {
|
|
48
|
-
useAtom.mockReturnValue([
|
|
49
|
-
{ request: { expandedAll: true }, response: { expandedAll: false } },
|
|
50
|
-
mockSetOperationState,
|
|
51
|
-
]);
|
|
52
|
-
render(_jsx(ExpandAllButton, { operationPointer: "test", type: "request" }));
|
|
53
|
-
expect(screen.getByRole('button')).toHaveTextContent('Collapse all');
|
|
54
|
-
});
|
|
55
|
-
it('uses translate function for button text', () => {
|
|
56
|
-
render(_jsx(ExpandAllButton, { operationPointer: "test", type: "request" }));
|
|
57
|
-
expect(mockTranslate).toHaveBeenCalledWith('openapi.expandAll', 'Expand all');
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
//# sourceMappingURL=ExpandAllButton.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { parseYaml } from '@redocly/openapi-core';
|
|
2
|
-
import { outdent } from 'outdent';
|
|
3
|
-
import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
|
|
4
|
-
import { computeExpandAllDepth, MAX_EXPAND_ALL_DEPTH } from '../helpers.js';
|
|
5
|
-
const options = normalizeOptions({});
|
|
6
|
-
function makeParser(spec) {
|
|
7
|
-
return new OpenAPIParser(spec, undefined, options);
|
|
8
|
-
}
|
|
9
|
-
function asModel(rawSchema) {
|
|
10
|
-
return { schema: rawSchema, rawSchema };
|
|
11
|
-
}
|
|
12
|
-
describe('computeExpandAllDepth', () => {
|
|
13
|
-
test('returns the ceiling for small schemas', () => {
|
|
14
|
-
const spec = parseYaml(outdent `
|
|
15
|
-
openapi: 3.0.0
|
|
16
|
-
components:
|
|
17
|
-
schemas:
|
|
18
|
-
User:
|
|
19
|
-
type: object
|
|
20
|
-
properties:
|
|
21
|
-
name:
|
|
22
|
-
type: string
|
|
23
|
-
address:
|
|
24
|
-
type: object
|
|
25
|
-
properties:
|
|
26
|
-
city:
|
|
27
|
-
type: string
|
|
28
|
-
`);
|
|
29
|
-
const parser = makeParser(spec);
|
|
30
|
-
expect(computeExpandAllDepth(parser, [asModel(spec.components.schemas.User)])).toBe(MAX_EXPAND_ALL_DEPTH);
|
|
31
|
-
});
|
|
32
|
-
test('clamps the depth for schemas that unfold exponentially', () => {
|
|
33
|
-
// Each level references the same node 5 times -> 5^level rows.
|
|
34
|
-
const spec = parseYaml(outdent `
|
|
35
|
-
openapi: 3.0.0
|
|
36
|
-
components:
|
|
37
|
-
schemas:
|
|
38
|
-
Node:
|
|
39
|
-
type: object
|
|
40
|
-
properties:
|
|
41
|
-
a:
|
|
42
|
-
$ref: '#/components/schemas/Node'
|
|
43
|
-
b:
|
|
44
|
-
$ref: '#/components/schemas/Node'
|
|
45
|
-
c:
|
|
46
|
-
$ref: '#/components/schemas/Node'
|
|
47
|
-
d:
|
|
48
|
-
$ref: '#/components/schemas/Node'
|
|
49
|
-
e:
|
|
50
|
-
$ref: '#/components/schemas/Node'
|
|
51
|
-
`);
|
|
52
|
-
const parser = makeParser(spec);
|
|
53
|
-
const depth = computeExpandAllDepth(parser, [asModel(spec.components.schemas.Node)], 100);
|
|
54
|
-
// 5 + 25 + 125 = 155 > 100 -> depth 2
|
|
55
|
-
expect(depth).toBe(2);
|
|
56
|
-
});
|
|
57
|
-
test('expands at least one level even when the first level exceeds the budget', () => {
|
|
58
|
-
const properties = Object.fromEntries(Array.from({ length: 50 }, (_, i) => [`p${i}`, { type: 'object' }]));
|
|
59
|
-
const parser = makeParser({ openapi: '3.0.0', components: {} });
|
|
60
|
-
expect(computeExpandAllDepth(parser, [asModel({ type: 'object', properties })], 10)).toBe(1);
|
|
61
|
-
});
|
|
62
|
-
test('counts rows through allOf, oneOf active variant, and array items', () => {
|
|
63
|
-
const spec = parseYaml(outdent `
|
|
64
|
-
openapi: 3.0.0
|
|
65
|
-
components:
|
|
66
|
-
schemas:
|
|
67
|
-
Wrapped:
|
|
68
|
-
type: object
|
|
69
|
-
properties:
|
|
70
|
-
list:
|
|
71
|
-
type: array
|
|
72
|
-
items:
|
|
73
|
-
allOf:
|
|
74
|
-
- type: object
|
|
75
|
-
properties:
|
|
76
|
-
first:
|
|
77
|
-
type: string
|
|
78
|
-
- type: object
|
|
79
|
-
properties:
|
|
80
|
-
second:
|
|
81
|
-
oneOf:
|
|
82
|
-
- type: object
|
|
83
|
-
properties:
|
|
84
|
-
variantField:
|
|
85
|
-
type: string
|
|
86
|
-
- type: object
|
|
87
|
-
properties:
|
|
88
|
-
otherA:
|
|
89
|
-
type: string
|
|
90
|
-
otherB:
|
|
91
|
-
type: string
|
|
92
|
-
`);
|
|
93
|
-
const parser = makeParser(spec);
|
|
94
|
-
const root = asModel(spec.components.schemas.Wrapped);
|
|
95
|
-
// level 1: list (1 row); level 2: first + second (cum 3); level 3: variantField (oneOf[0] only, cum 4)
|
|
96
|
-
expect(computeExpandAllDepth(parser, [root], 4)).toBe(MAX_EXPAND_ALL_DEPTH);
|
|
97
|
-
expect(computeExpandAllDepth(parser, [root], 3)).toBe(2);
|
|
98
|
-
expect(computeExpandAllDepth(parser, [root], 2)).toBe(1);
|
|
99
|
-
});
|
|
100
|
-
test('counts additionalProperties and unevaluatedProperties as rows (mirrors buildFields)', () => {
|
|
101
|
-
const parser = makeParser({ openapi: '3.0.0', components: {} });
|
|
102
|
-
// 9 named properties + 1 `additionalProperties: true` row = 10 rows > budget 9
|
|
103
|
-
const properties = Object.fromEntries(Array.from({ length: 9 }, (_, i) => [`p${i}`, { type: 'string' }]));
|
|
104
|
-
expect(computeExpandAllDepth(parser, [asModel({ type: 'object', properties, additionalProperties: true })], 9)).toBe(1);
|
|
105
|
-
expect(computeExpandAllDepth(parser, [asModel({ type: 'object', properties, unevaluatedProperties: { type: 'string' } })], 9)).toBe(1);
|
|
106
|
-
// Without them the 9 properties fit the budget.
|
|
107
|
-
expect(computeExpandAllDepth(parser, [asModel({ type: 'object', properties })], 9)).toBe(MAX_EXPAND_ALL_DEPTH);
|
|
108
|
-
});
|
|
109
|
-
test('is resilient to missing parser or schemas', () => {
|
|
110
|
-
expect(computeExpandAllDepth(undefined, [])).toBe(MAX_EXPAND_ALL_DEPTH);
|
|
111
|
-
expect(computeExpandAllDepth({}, [])).toBe(MAX_EXPAND_ALL_DEPTH);
|
|
112
|
-
expect(computeExpandAllDepth(makeParser({ openapi: '3.0.0' }), [undefined])).toBe(MAX_EXPAND_ALL_DEPTH);
|
|
113
|
-
});
|
|
114
|
-
test('does not hang on self-referencing (cyclic) schemas', () => {
|
|
115
|
-
const spec = parseYaml(outdent `
|
|
116
|
-
openapi: 3.0.0
|
|
117
|
-
components:
|
|
118
|
-
schemas:
|
|
119
|
-
Cyclic:
|
|
120
|
-
type: object
|
|
121
|
-
properties:
|
|
122
|
-
self:
|
|
123
|
-
$ref: '#/components/schemas/Cyclic'
|
|
124
|
-
name:
|
|
125
|
-
type: string
|
|
126
|
-
`);
|
|
127
|
-
const parser = makeParser(spec);
|
|
128
|
-
const depth = computeExpandAllDepth(parser, [asModel(spec.components.schemas.Cyclic)]);
|
|
129
|
-
expect(depth).toBeGreaterThanOrEqual(1);
|
|
130
|
-
expect(depth).toBeLessThanOrEqual(MAX_EXPAND_ALL_DEPTH);
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
//# sourceMappingURL=helpers.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|