@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,392 +0,0 @@
|
|
|
1
|
-
import { vi } from 'vitest';
|
|
2
|
-
import swagger2openapi from 'swagger2openapi';
|
|
3
|
-
import { convertSwagger2OpenAPI } from '../convertSwagger2OpenAPI.js';
|
|
4
|
-
// Mock the swagger2openapi module
|
|
5
|
-
vi.mock('swagger2openapi');
|
|
6
|
-
const mockSwagger2OpenAPI = swagger2openapi;
|
|
7
|
-
describe('convertSwagger2OpenAPI', () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
vi.clearAllMocks();
|
|
10
|
-
});
|
|
11
|
-
it('should convert a valid Swagger 2.0 spec to OpenAPI 3.0', async () => {
|
|
12
|
-
const swaggerSpec = {
|
|
13
|
-
swagger: '2.0',
|
|
14
|
-
info: {
|
|
15
|
-
title: 'Test API',
|
|
16
|
-
version: '1.0.0',
|
|
17
|
-
},
|
|
18
|
-
paths: {
|
|
19
|
-
'/test': {
|
|
20
|
-
get: {
|
|
21
|
-
responses: {
|
|
22
|
-
'200': {
|
|
23
|
-
description: 'OK',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
const expectedOpenAPISpec = {
|
|
31
|
-
openapi: '3.0.0',
|
|
32
|
-
info: {
|
|
33
|
-
title: 'Test API',
|
|
34
|
-
version: '1.0.0',
|
|
35
|
-
},
|
|
36
|
-
paths: {
|
|
37
|
-
'/test': {
|
|
38
|
-
get: {
|
|
39
|
-
responses: {
|
|
40
|
-
'200': {
|
|
41
|
-
description: 'OK',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
mockSwagger2OpenAPI.convertObj.mockImplementation((_spec, _options, callback) => {
|
|
49
|
-
callback(null, { openapi: expectedOpenAPISpec });
|
|
50
|
-
return undefined;
|
|
51
|
-
});
|
|
52
|
-
const result = await convertSwagger2OpenAPI(swaggerSpec);
|
|
53
|
-
expect(mockSwagger2OpenAPI.convertObj).toHaveBeenCalledWith(swaggerSpec, { patch: true, warnOnly: true, text: '{}', anchors: true }, expect.any(Function));
|
|
54
|
-
expect(result).toEqual(expectedOpenAPISpec);
|
|
55
|
-
});
|
|
56
|
-
it('should add empty paths object if paths is missing', async () => {
|
|
57
|
-
const swaggerSpec = {
|
|
58
|
-
swagger: '2.0',
|
|
59
|
-
info: {
|
|
60
|
-
title: 'Test API',
|
|
61
|
-
version: '1.0.0',
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
const expectedOpenAPISpec = {
|
|
65
|
-
openapi: '3.0.0',
|
|
66
|
-
info: {
|
|
67
|
-
title: 'Test API',
|
|
68
|
-
version: '1.0.0',
|
|
69
|
-
},
|
|
70
|
-
paths: {},
|
|
71
|
-
};
|
|
72
|
-
mockSwagger2OpenAPI.convertObj.mockImplementation((_spec, _options, callback) => {
|
|
73
|
-
callback(null, { openapi: expectedOpenAPISpec });
|
|
74
|
-
return undefined;
|
|
75
|
-
});
|
|
76
|
-
await convertSwagger2OpenAPI(swaggerSpec);
|
|
77
|
-
expect(mockSwagger2OpenAPI.convertObj).toHaveBeenCalledWith({ ...swaggerSpec, paths: {} }, { patch: true, warnOnly: true, text: '{}', anchors: true }, expect.any(Function));
|
|
78
|
-
});
|
|
79
|
-
it('should preserve existing paths if already present', async () => {
|
|
80
|
-
const swaggerSpec = {
|
|
81
|
-
swagger: '2.0',
|
|
82
|
-
info: {
|
|
83
|
-
title: 'Test API',
|
|
84
|
-
version: '1.0.0',
|
|
85
|
-
},
|
|
86
|
-
paths: {
|
|
87
|
-
'/existing': {
|
|
88
|
-
get: {
|
|
89
|
-
responses: {
|
|
90
|
-
'200': {
|
|
91
|
-
description: 'OK',
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
const expectedOpenAPISpec = {
|
|
99
|
-
openapi: '3.0.0',
|
|
100
|
-
info: {
|
|
101
|
-
title: 'Test API',
|
|
102
|
-
version: '1.0.0',
|
|
103
|
-
},
|
|
104
|
-
paths: {
|
|
105
|
-
'/existing': {
|
|
106
|
-
get: {
|
|
107
|
-
responses: {
|
|
108
|
-
'200': {
|
|
109
|
-
description: 'OK',
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
mockSwagger2OpenAPI.convertObj.mockImplementation((_spec, _options, callback) => {
|
|
117
|
-
callback(null, { openapi: expectedOpenAPISpec });
|
|
118
|
-
return undefined;
|
|
119
|
-
});
|
|
120
|
-
await convertSwagger2OpenAPI(swaggerSpec);
|
|
121
|
-
expect(mockSwagger2OpenAPI.convertObj).toHaveBeenCalledWith(swaggerSpec, // Should not modify the original spec
|
|
122
|
-
{ patch: true, warnOnly: true, text: '{}', anchors: true }, expect.any(Function));
|
|
123
|
-
});
|
|
124
|
-
it('should reject with error when swagger2openapi conversion fails', async () => {
|
|
125
|
-
const swaggerSpec = {
|
|
126
|
-
swagger: '2.0',
|
|
127
|
-
info: {
|
|
128
|
-
title: 'Test API',
|
|
129
|
-
version: '1.0.0',
|
|
130
|
-
},
|
|
131
|
-
paths: {},
|
|
132
|
-
};
|
|
133
|
-
const conversionError = new Error('Invalid Swagger specification');
|
|
134
|
-
mockSwagger2OpenAPI.convertObj.mockImplementation((_spec, _options, callback) => {
|
|
135
|
-
callback(conversionError, null);
|
|
136
|
-
return undefined;
|
|
137
|
-
});
|
|
138
|
-
await expect(convertSwagger2OpenAPI(swaggerSpec)).rejects.toThrow('Invalid Swagger specification');
|
|
139
|
-
expect(mockSwagger2OpenAPI.convertObj).toHaveBeenCalledWith(swaggerSpec, { patch: true, warnOnly: true, text: '{}', anchors: true }, expect.any(Function));
|
|
140
|
-
});
|
|
141
|
-
it('should handle swagger2openapi returning null result', async () => {
|
|
142
|
-
const swaggerSpec = {
|
|
143
|
-
swagger: '2.0',
|
|
144
|
-
info: {
|
|
145
|
-
title: 'Test API',
|
|
146
|
-
version: '1.0.0',
|
|
147
|
-
},
|
|
148
|
-
paths: {},
|
|
149
|
-
};
|
|
150
|
-
mockSwagger2OpenAPI.convertObj.mockImplementation((_spec, _options, callback) => {
|
|
151
|
-
callback(null, null);
|
|
152
|
-
return undefined;
|
|
153
|
-
});
|
|
154
|
-
const result = await convertSwagger2OpenAPI(swaggerSpec);
|
|
155
|
-
expect(result).toBeUndefined();
|
|
156
|
-
});
|
|
157
|
-
it('should handle swagger2openapi returning result without openapi property', async () => {
|
|
158
|
-
const swaggerSpec = {
|
|
159
|
-
swagger: '2.0',
|
|
160
|
-
info: {
|
|
161
|
-
title: 'Test API',
|
|
162
|
-
version: '1.0.0',
|
|
163
|
-
},
|
|
164
|
-
paths: {},
|
|
165
|
-
};
|
|
166
|
-
mockSwagger2OpenAPI.convertObj.mockImplementation((_spec, _options, callback) => {
|
|
167
|
-
callback(null, { someOtherProperty: 'value' });
|
|
168
|
-
return undefined;
|
|
169
|
-
});
|
|
170
|
-
const result = await convertSwagger2OpenAPI(swaggerSpec);
|
|
171
|
-
expect(result).toBeUndefined();
|
|
172
|
-
});
|
|
173
|
-
it('should handle complex Swagger specification with all properties', async () => {
|
|
174
|
-
const swaggerSpec = {
|
|
175
|
-
swagger: '2.0',
|
|
176
|
-
info: {
|
|
177
|
-
title: 'Complex API',
|
|
178
|
-
version: '2.0.0',
|
|
179
|
-
description: 'A complex API with many features',
|
|
180
|
-
contact: {
|
|
181
|
-
name: 'API Support',
|
|
182
|
-
email: 'support@example.com',
|
|
183
|
-
},
|
|
184
|
-
license: {
|
|
185
|
-
name: 'MIT',
|
|
186
|
-
url: 'https://opensource.org/licenses/MIT',
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
host: 'api.example.com',
|
|
190
|
-
basePath: '/v1',
|
|
191
|
-
schemes: ['https'],
|
|
192
|
-
consumes: ['application/json'],
|
|
193
|
-
produces: ['application/json'],
|
|
194
|
-
paths: {
|
|
195
|
-
'/users': {
|
|
196
|
-
get: {
|
|
197
|
-
tags: ['users'],
|
|
198
|
-
summary: 'Get all users',
|
|
199
|
-
description: 'Retrieve a list of all users',
|
|
200
|
-
operationId: 'getUsers',
|
|
201
|
-
parameters: [
|
|
202
|
-
{
|
|
203
|
-
name: 'limit',
|
|
204
|
-
in: 'query',
|
|
205
|
-
description: 'Number of users to return',
|
|
206
|
-
required: false,
|
|
207
|
-
type: 'integer',
|
|
208
|
-
default: 10,
|
|
209
|
-
},
|
|
210
|
-
],
|
|
211
|
-
responses: {
|
|
212
|
-
'200': {
|
|
213
|
-
description: 'Successful response',
|
|
214
|
-
schema: {
|
|
215
|
-
type: 'array',
|
|
216
|
-
items: {
|
|
217
|
-
$ref: '#/definitions/User',
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
},
|
|
221
|
-
'400': {
|
|
222
|
-
description: 'Bad request',
|
|
223
|
-
},
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
definitions: {
|
|
229
|
-
User: {
|
|
230
|
-
type: 'object',
|
|
231
|
-
properties: {
|
|
232
|
-
id: {
|
|
233
|
-
type: 'integer',
|
|
234
|
-
description: 'User ID',
|
|
235
|
-
},
|
|
236
|
-
name: {
|
|
237
|
-
type: 'string',
|
|
238
|
-
description: 'User name',
|
|
239
|
-
},
|
|
240
|
-
},
|
|
241
|
-
required: ['id', 'name'],
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
securityDefinitions: {
|
|
245
|
-
apiKey: {
|
|
246
|
-
type: 'apiKey',
|
|
247
|
-
name: 'X-API-Key',
|
|
248
|
-
in: 'header',
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
};
|
|
252
|
-
const expectedOpenAPISpec = {
|
|
253
|
-
openapi: '3.0.0',
|
|
254
|
-
info: {
|
|
255
|
-
title: 'Complex API',
|
|
256
|
-
version: '2.0.0',
|
|
257
|
-
description: 'A complex API with many features',
|
|
258
|
-
contact: {
|
|
259
|
-
name: 'API Support',
|
|
260
|
-
email: 'support@example.com',
|
|
261
|
-
},
|
|
262
|
-
license: {
|
|
263
|
-
name: 'MIT',
|
|
264
|
-
url: 'https://opensource.org/licenses/MIT',
|
|
265
|
-
},
|
|
266
|
-
},
|
|
267
|
-
servers: [
|
|
268
|
-
{
|
|
269
|
-
url: 'https://api.example.com/v1',
|
|
270
|
-
},
|
|
271
|
-
],
|
|
272
|
-
paths: {
|
|
273
|
-
'/users': {
|
|
274
|
-
get: {
|
|
275
|
-
tags: ['users'],
|
|
276
|
-
summary: 'Get all users',
|
|
277
|
-
description: 'Retrieve a list of all users',
|
|
278
|
-
operationId: 'getUsers',
|
|
279
|
-
parameters: [
|
|
280
|
-
{
|
|
281
|
-
name: 'limit',
|
|
282
|
-
in: 'query',
|
|
283
|
-
description: 'Number of users to return',
|
|
284
|
-
required: false,
|
|
285
|
-
schema: {
|
|
286
|
-
type: 'integer',
|
|
287
|
-
default: 10,
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
|
-
],
|
|
291
|
-
responses: {
|
|
292
|
-
'200': {
|
|
293
|
-
description: 'Successful response',
|
|
294
|
-
content: {
|
|
295
|
-
'application/json': {
|
|
296
|
-
schema: {
|
|
297
|
-
type: 'array',
|
|
298
|
-
items: {
|
|
299
|
-
$ref: '#/components/schemas/User',
|
|
300
|
-
},
|
|
301
|
-
},
|
|
302
|
-
},
|
|
303
|
-
},
|
|
304
|
-
},
|
|
305
|
-
'400': {
|
|
306
|
-
description: 'Bad request',
|
|
307
|
-
},
|
|
308
|
-
},
|
|
309
|
-
},
|
|
310
|
-
},
|
|
311
|
-
},
|
|
312
|
-
components: {
|
|
313
|
-
schemas: {
|
|
314
|
-
User: {
|
|
315
|
-
type: 'object',
|
|
316
|
-
properties: {
|
|
317
|
-
id: {
|
|
318
|
-
type: 'integer',
|
|
319
|
-
description: 'User ID',
|
|
320
|
-
},
|
|
321
|
-
name: {
|
|
322
|
-
type: 'string',
|
|
323
|
-
description: 'User name',
|
|
324
|
-
},
|
|
325
|
-
},
|
|
326
|
-
required: ['id', 'name'],
|
|
327
|
-
},
|
|
328
|
-
},
|
|
329
|
-
securitySchemes: {
|
|
330
|
-
apiKey: {
|
|
331
|
-
type: 'apiKey',
|
|
332
|
-
name: 'X-API-Key',
|
|
333
|
-
in: 'header',
|
|
334
|
-
bearerFormat: '',
|
|
335
|
-
flows: {},
|
|
336
|
-
},
|
|
337
|
-
},
|
|
338
|
-
},
|
|
339
|
-
};
|
|
340
|
-
mockSwagger2OpenAPI.convertObj.mockImplementation((_spec, _options, callback) => {
|
|
341
|
-
callback(null, { openapi: expectedOpenAPISpec });
|
|
342
|
-
return undefined;
|
|
343
|
-
});
|
|
344
|
-
const result = await convertSwagger2OpenAPI(swaggerSpec);
|
|
345
|
-
expect(mockSwagger2OpenAPI.convertObj).toHaveBeenCalledWith(swaggerSpec, { patch: true, warnOnly: true, text: '{}', anchors: true }, expect.any(Function));
|
|
346
|
-
expect(result).toEqual(expectedOpenAPISpec);
|
|
347
|
-
});
|
|
348
|
-
it('should handle empty specification object', async () => {
|
|
349
|
-
const swaggerSpec = {};
|
|
350
|
-
const expectedOpenAPISpec = {
|
|
351
|
-
openapi: '3.0.0',
|
|
352
|
-
info: {
|
|
353
|
-
title: 'API',
|
|
354
|
-
version: '1.0.0',
|
|
355
|
-
},
|
|
356
|
-
paths: {},
|
|
357
|
-
};
|
|
358
|
-
mockSwagger2OpenAPI.convertObj.mockImplementation((_spec, _options, callback) => {
|
|
359
|
-
callback(null, { openapi: expectedOpenAPISpec });
|
|
360
|
-
return undefined;
|
|
361
|
-
});
|
|
362
|
-
const result = await convertSwagger2OpenAPI(swaggerSpec);
|
|
363
|
-
expect(mockSwagger2OpenAPI.convertObj).toHaveBeenCalledWith({ paths: {} }, { patch: true, warnOnly: true, text: '{}', anchors: true }, expect.any(Function));
|
|
364
|
-
expect(result).toEqual(expectedOpenAPISpec);
|
|
365
|
-
});
|
|
366
|
-
it('should handle specification with null paths', async () => {
|
|
367
|
-
const swaggerSpec = {
|
|
368
|
-
swagger: '2.0',
|
|
369
|
-
info: {
|
|
370
|
-
title: 'Test API',
|
|
371
|
-
version: '1.0.0',
|
|
372
|
-
},
|
|
373
|
-
paths: null,
|
|
374
|
-
};
|
|
375
|
-
const expectedOpenAPISpec = {
|
|
376
|
-
openapi: '3.0.0',
|
|
377
|
-
info: {
|
|
378
|
-
title: 'Test API',
|
|
379
|
-
version: '1.0.0',
|
|
380
|
-
},
|
|
381
|
-
paths: {},
|
|
382
|
-
};
|
|
383
|
-
mockSwagger2OpenAPI.convertObj.mockImplementation((_spec, _options, callback) => {
|
|
384
|
-
callback(null, { openapi: expectedOpenAPISpec });
|
|
385
|
-
return undefined;
|
|
386
|
-
});
|
|
387
|
-
const result = await convertSwagger2OpenAPI(swaggerSpec);
|
|
388
|
-
expect(mockSwagger2OpenAPI.convertObj).toHaveBeenCalledWith({ ...swaggerSpec, paths: {} }, { patch: true, warnOnly: true, text: '{}', anchors: true }, expect.any(Function));
|
|
389
|
-
expect(result).toEqual(expectedOpenAPISpec);
|
|
390
|
-
});
|
|
391
|
-
});
|
|
392
|
-
//# sourceMappingURL=convertSwagger2OpenAPI.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { debounce } from '../debounce.js';
|
|
2
|
-
vi.useFakeTimers();
|
|
3
|
-
describe('debounce', () => {
|
|
4
|
-
it('should debounce function calls', () => {
|
|
5
|
-
const fn = vi.fn();
|
|
6
|
-
const debouncedFn = debounce(fn, 100);
|
|
7
|
-
// Call the debounced function multiple times within the threshold
|
|
8
|
-
debouncedFn('a');
|
|
9
|
-
debouncedFn('b');
|
|
10
|
-
debouncedFn('c');
|
|
11
|
-
// Advance time by 99ms
|
|
12
|
-
vi.advanceTimersByTime(99);
|
|
13
|
-
// The function should not have been called yet
|
|
14
|
-
expect(fn).not.toHaveBeenCalled();
|
|
15
|
-
// Call the function again
|
|
16
|
-
debouncedFn('d');
|
|
17
|
-
// Advance time by another 99ms
|
|
18
|
-
vi.advanceTimersByTime(99);
|
|
19
|
-
// The function should still not have been called yet
|
|
20
|
-
expect(fn).not.toHaveBeenCalled();
|
|
21
|
-
// Advance time by the remaining 1ms
|
|
22
|
-
vi.advanceTimersByTime(1);
|
|
23
|
-
// The function should have been called once with the last value passed to it
|
|
24
|
-
expect(fn).toHaveBeenCalledTimes(1);
|
|
25
|
-
expect(fn).toHaveBeenCalledWith('d');
|
|
26
|
-
});
|
|
27
|
-
it('should call the function immediately when the `leading` option is `true`', () => {
|
|
28
|
-
const fn = vi.fn();
|
|
29
|
-
const debouncedFn = debounce(fn, 100, true);
|
|
30
|
-
// Call the debounced function multiple times within the threshold
|
|
31
|
-
debouncedFn('a');
|
|
32
|
-
debouncedFn('b');
|
|
33
|
-
debouncedFn('c');
|
|
34
|
-
// The function should have been called immediately with the first value passed to it
|
|
35
|
-
expect(fn).toHaveBeenCalledTimes(1);
|
|
36
|
-
expect(fn).toHaveBeenCalledWith('a');
|
|
37
|
-
// Advance time by 99ms
|
|
38
|
-
vi.advanceTimersByTime(99);
|
|
39
|
-
// The function should not have been called again yet
|
|
40
|
-
expect(fn).toHaveBeenCalledTimes(1);
|
|
41
|
-
// Call the function again
|
|
42
|
-
debouncedFn('d');
|
|
43
|
-
// Advance time by another 99ms
|
|
44
|
-
vi.advanceTimersByTime(99);
|
|
45
|
-
// The function should still not have been called yet
|
|
46
|
-
expect(fn).toHaveBeenCalledTimes(1);
|
|
47
|
-
// Advance time by the remaining 1ms
|
|
48
|
-
vi.advanceTimersByTime(1);
|
|
49
|
-
// The function should have been called once more with the last value passed to it
|
|
50
|
-
expect(fn).toHaveBeenCalledTimes(2);
|
|
51
|
-
expect(fn).toHaveBeenCalledWith('d');
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
//# sourceMappingURL=debounce.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { debugTime } from '../debug.js';
|
|
2
|
-
describe('debug', () => {
|
|
3
|
-
let spy;
|
|
4
|
-
beforeEach(() => {
|
|
5
|
-
spy = vi.spyOn(console, 'time');
|
|
6
|
-
});
|
|
7
|
-
afterEach(() => {
|
|
8
|
-
spy.mockRestore();
|
|
9
|
-
});
|
|
10
|
-
describe('debugTime', () => {
|
|
11
|
-
it('should call console.time with the given label in non-production environment', () => {
|
|
12
|
-
process.env.NODE_ENV = 'development';
|
|
13
|
-
debugTime('test');
|
|
14
|
-
expect(spy).toHaveBeenCalledWith('test');
|
|
15
|
-
});
|
|
16
|
-
it('should not call console.time in production environment', () => {
|
|
17
|
-
process.env.NODE_ENV = 'production';
|
|
18
|
-
debugTime('test');
|
|
19
|
-
expect(spy).not.toHaveBeenCalled();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
//# sourceMappingURL=debug.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { querySelector, html2Str, IS_BROWSER } from '../dom.js';
|
|
2
|
-
describe('DOM utils', () => {
|
|
3
|
-
describe('querySelector', () => {
|
|
4
|
-
afterEach(() => {
|
|
5
|
-
document.body.innerHTML = '';
|
|
6
|
-
});
|
|
7
|
-
it('should return element when document is defined', () => {
|
|
8
|
-
document.body.innerHTML = '<div></div>';
|
|
9
|
-
const div = querySelector('div');
|
|
10
|
-
expect(div).not.toBeNull();
|
|
11
|
-
expect(div?.tagName).toBe('DIV');
|
|
12
|
-
});
|
|
13
|
-
it('should return null for non-existent element', () => {
|
|
14
|
-
document.body.innerHTML = '<div></div>';
|
|
15
|
-
const span = querySelector('span');
|
|
16
|
-
expect(span).toBeNull();
|
|
17
|
-
});
|
|
18
|
-
it('should return null when document is undefined', () => {
|
|
19
|
-
expect(querySelector('div')).toBeNull();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
describe('html2Str', () => {
|
|
23
|
-
it('should remove tags and keep text', () => {
|
|
24
|
-
expect(html2Str('<div><p>Hello</p> <span>World</span></div>')).toBe('Hello World');
|
|
25
|
-
});
|
|
26
|
-
it('should handle multiple spaces between chunks', () => {
|
|
27
|
-
expect(html2Str('<div> chunk1 </div> <div> chunk2 </div>')).toBe('chunk1 chunk2');
|
|
28
|
-
});
|
|
29
|
-
it('should return an empty string for empty input', () => {
|
|
30
|
-
expect(html2Str('')).toBe('');
|
|
31
|
-
});
|
|
32
|
-
it('should remove tags and newlines from HTML', () => {
|
|
33
|
-
expect(html2Str('<div>Hello\n<span>world</span></div>')).toBe('Hello world');
|
|
34
|
-
});
|
|
35
|
-
it('should return an empty string if input is empty', () => {
|
|
36
|
-
expect(html2Str('')).toBe('');
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
describe('IS_BROWSER', () => {
|
|
40
|
-
it('should be true in a browser-like environment', () => {
|
|
41
|
-
expect(IS_BROWSER).toBe(true);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
describe('scrollIntoViewIfNeeded polyfill', () => {
|
|
45
|
-
let parent;
|
|
46
|
-
let child;
|
|
47
|
-
beforeEach(async () => {
|
|
48
|
-
parent = document.createElement('div');
|
|
49
|
-
child = document.createElement('div');
|
|
50
|
-
parent.appendChild(child);
|
|
51
|
-
document.body.appendChild(parent);
|
|
52
|
-
vi.spyOn(window, 'getComputedStyle').mockReturnValue({
|
|
53
|
-
getPropertyValue: (prop) => {
|
|
54
|
-
if (prop === 'border-top-width')
|
|
55
|
-
return '10';
|
|
56
|
-
if (prop === 'border-left-width')
|
|
57
|
-
return '10';
|
|
58
|
-
return '0';
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperties(parent, {
|
|
62
|
-
offsetTop: { value: 100, configurable: true },
|
|
63
|
-
offsetLeft: { value: 100, configurable: true },
|
|
64
|
-
scrollTop: { value: 100, configurable: true, writable: true },
|
|
65
|
-
scrollLeft: { value: 100, configurable: true, writable: true },
|
|
66
|
-
clientHeight: { value: 200, configurable: true },
|
|
67
|
-
clientWidth: { value: 200, configurable: true },
|
|
68
|
-
});
|
|
69
|
-
Object.defineProperties(child, {
|
|
70
|
-
offsetTop: { value: 150, configurable: true },
|
|
71
|
-
offsetLeft: { value: 150, configurable: true },
|
|
72
|
-
clientHeight: { value: 50, configurable: true },
|
|
73
|
-
clientWidth: { value: 50, configurable: true },
|
|
74
|
-
scrollIntoView: { value: vi.fn(), configurable: true },
|
|
75
|
-
});
|
|
76
|
-
if (typeof Element.prototype.scrollIntoViewIfNeeded !== 'function') {
|
|
77
|
-
await import('../dom');
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
afterEach(() => {
|
|
81
|
-
if (parent.parentNode) {
|
|
82
|
-
parent.parentNode.removeChild(parent);
|
|
83
|
-
}
|
|
84
|
-
vi.restoreAllMocks();
|
|
85
|
-
});
|
|
86
|
-
it('should center the element when over top and centerIfNeeded is true', () => {
|
|
87
|
-
Object.defineProperty(child, 'offsetTop', { value: 50 });
|
|
88
|
-
child.scrollIntoViewIfNeeded(true);
|
|
89
|
-
expect(parent.scrollTop).toBe(-135);
|
|
90
|
-
});
|
|
91
|
-
it('should center the element when over bottom and centerIfNeeded is true', () => {
|
|
92
|
-
Object.defineProperty(child, 'offsetTop', { value: 350 });
|
|
93
|
-
child.scrollIntoViewIfNeeded(true);
|
|
94
|
-
expect(parent.scrollTop).toBe(100);
|
|
95
|
-
});
|
|
96
|
-
it('should scroll into view when over left and centerIfNeeded is false', () => {
|
|
97
|
-
Object.defineProperty(child, 'offsetLeft', { value: 50 });
|
|
98
|
-
child.scrollIntoViewIfNeeded(false);
|
|
99
|
-
expect(child.scrollIntoView).toHaveBeenCalled();
|
|
100
|
-
});
|
|
101
|
-
it('should scroll into view when over right and centerIfNeeded is false', () => {
|
|
102
|
-
Object.defineProperty(child, 'offsetLeft', { value: 350 });
|
|
103
|
-
child.scrollIntoViewIfNeeded(false);
|
|
104
|
-
expect(child.scrollIntoView).toHaveBeenCalled();
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
//# sourceMappingURL=dom.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { getBreadcrumbs } from '../getBreadcrumbs.js';
|
|
3
|
-
describe('getBreadcrumbs', () => {
|
|
4
|
-
it('should return empty array when tag has no parent', () => {
|
|
5
|
-
const tag = {
|
|
6
|
-
id: 'users-tag',
|
|
7
|
-
href: '/tags/users',
|
|
8
|
-
name: 'Users',
|
|
9
|
-
type: 'tag',
|
|
10
|
-
items: [],
|
|
11
|
-
depth: 0,
|
|
12
|
-
level: 1,
|
|
13
|
-
};
|
|
14
|
-
expect(getBreadcrumbs(tag)).toEqual([]);
|
|
15
|
-
});
|
|
16
|
-
it('should return single breadcrumb when tag has one parent', () => {
|
|
17
|
-
const parent = {
|
|
18
|
-
id: 'api-tag',
|
|
19
|
-
href: '/tag/api',
|
|
20
|
-
name: 'API',
|
|
21
|
-
type: 'tag',
|
|
22
|
-
items: [],
|
|
23
|
-
depth: 0,
|
|
24
|
-
level: 1,
|
|
25
|
-
};
|
|
26
|
-
const tag = {
|
|
27
|
-
id: 'users-tag',
|
|
28
|
-
href: '/tags/users',
|
|
29
|
-
name: 'Users',
|
|
30
|
-
type: 'tag',
|
|
31
|
-
items: [],
|
|
32
|
-
depth: 0,
|
|
33
|
-
level: 1,
|
|
34
|
-
parent,
|
|
35
|
-
};
|
|
36
|
-
expect(getBreadcrumbs(tag)).toEqual([
|
|
37
|
-
{
|
|
38
|
-
name: 'API',
|
|
39
|
-
href: '/tag/api',
|
|
40
|
-
},
|
|
41
|
-
]);
|
|
42
|
-
});
|
|
43
|
-
it('should return empty array when provided element is not type "tag"', () => {
|
|
44
|
-
const tag = {
|
|
45
|
-
id: 'users-category',
|
|
46
|
-
href: '/category/users',
|
|
47
|
-
name: 'Users',
|
|
48
|
-
//@ts-ignore
|
|
49
|
-
type: 'category',
|
|
50
|
-
items: [],
|
|
51
|
-
depth: 0,
|
|
52
|
-
level: 1,
|
|
53
|
-
};
|
|
54
|
-
expect(getBreadcrumbs(tag)).toEqual([]);
|
|
55
|
-
});
|
|
56
|
-
it('should return breadcrumbs in correct order for multiple parents', () => {
|
|
57
|
-
const rootParent = {
|
|
58
|
-
id: 'root-tag',
|
|
59
|
-
href: '/tag/root',
|
|
60
|
-
name: 'Root',
|
|
61
|
-
type: 'tag',
|
|
62
|
-
items: [],
|
|
63
|
-
depth: 0,
|
|
64
|
-
level: 1,
|
|
65
|
-
};
|
|
66
|
-
const middleParent = {
|
|
67
|
-
id: 'api-tag',
|
|
68
|
-
href: '/tag/api',
|
|
69
|
-
name: 'API',
|
|
70
|
-
type: 'tag',
|
|
71
|
-
items: [],
|
|
72
|
-
depth: 0,
|
|
73
|
-
level: 2,
|
|
74
|
-
parent: rootParent,
|
|
75
|
-
};
|
|
76
|
-
const tag = {
|
|
77
|
-
id: 'users-tag',
|
|
78
|
-
href: '/tags/users',
|
|
79
|
-
name: 'Users',
|
|
80
|
-
type: 'tag',
|
|
81
|
-
items: [],
|
|
82
|
-
depth: 0,
|
|
83
|
-
level: 3,
|
|
84
|
-
parent: middleParent,
|
|
85
|
-
};
|
|
86
|
-
expect(getBreadcrumbs(tag)).toEqual([
|
|
87
|
-
{
|
|
88
|
-
name: 'Root',
|
|
89
|
-
href: '/tag/root',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
name: 'API',
|
|
93
|
-
href: '/tag/api',
|
|
94
|
-
},
|
|
95
|
-
]);
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
//# sourceMappingURL=getBreadcrumbs.test.js.map
|