@redocly/openapi-docs 3.24.1 → 3.24.2
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/lib/telemetry/RedocTelemetry.js +1 -31
- package/package.json +4 -4
- 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,53 +0,0 @@
|
|
|
1
|
-
import { act, renderHook } from '@testing-library/react';
|
|
2
|
-
import { useAtomValue, useSetAtom } from 'jotai';
|
|
3
|
-
import {
|
|
4
|
-
// @community-ignore
|
|
5
|
-
environmentAtom,
|
|
6
|
-
// @community-ignore-end
|
|
7
|
-
appStore, appStoreOverrideAtom, } from '../app.js';
|
|
8
|
-
describe('jotai atoms', () => {
|
|
9
|
-
describe('environmentAtom', () => {
|
|
10
|
-
test('should return default values with empty state', () => {
|
|
11
|
-
const { result: { current: [env, envName], }, } = renderHook(() => useAtomValue(environmentAtom));
|
|
12
|
-
expect(envName).toEqual('');
|
|
13
|
-
expect(env).toEqual({});
|
|
14
|
-
});
|
|
15
|
-
test('should return first environment if non-existing is selected', () => {
|
|
16
|
-
const { result: { current: setApp }, } = renderHook(() => useSetAtom(appStore));
|
|
17
|
-
act(() => {
|
|
18
|
-
setApp({
|
|
19
|
-
environments: {
|
|
20
|
-
Default: { foo: 'bar', baz: 'qux' },
|
|
21
|
-
},
|
|
22
|
-
environment: 'non-existing',
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
const { result: { current: [env, envName], }, } = renderHook(() => useAtomValue(environmentAtom));
|
|
26
|
-
expect(envName).toEqual('Default');
|
|
27
|
-
expect(env).toEqual({ foo: 'bar', baz: 'qux' });
|
|
28
|
-
});
|
|
29
|
-
test('should work with override data', () => {
|
|
30
|
-
const { result: { current: setApp }, } = renderHook(() => useSetAtom(appStore));
|
|
31
|
-
const { result: { current: setOverride }, } = renderHook(() => useSetAtom(appStoreOverrideAtom));
|
|
32
|
-
act(() => {
|
|
33
|
-
setApp({
|
|
34
|
-
environments: {
|
|
35
|
-
Mock: {},
|
|
36
|
-
Default: { foo: 'bar', baz: 'qux' },
|
|
37
|
-
},
|
|
38
|
-
environment: 'non-existing',
|
|
39
|
-
});
|
|
40
|
-
setOverride({
|
|
41
|
-
environments: {
|
|
42
|
-
Default: { foo: '123', secret: 'password' },
|
|
43
|
-
},
|
|
44
|
-
environment: 'Default',
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
const { result: { current: [env, envName], }, } = renderHook(() => useAtomValue(environmentAtom));
|
|
48
|
-
expect(envName).toEqual('Default');
|
|
49
|
-
expect(env).toEqual({ foo: '123', baz: 'qux', secret: 'password' });
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=app.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { getCallback } from '../callback.js';
|
|
2
|
-
import { normalizeOptions, OpenAPIParser } from '../../services/index.js';
|
|
3
|
-
import spec from './fixtures/callback.json';
|
|
4
|
-
const opts = normalizeOptions({});
|
|
5
|
-
describe('Models', () => {
|
|
6
|
-
describe('CallbackModel', () => {
|
|
7
|
-
const parser = new OpenAPIParser(spec, undefined, opts);
|
|
8
|
-
test('basic callback details', () => {
|
|
9
|
-
const callback = getCallback(parser, 'Test.Callback', { $ref: '#/components/callbacks/Test' }, '', opts, '');
|
|
10
|
-
expect(callback.name).toEqual('Test.Callback');
|
|
11
|
-
expect(callback.operations.length).toEqual(0);
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
//# sourceMappingURL=Callback.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { getField } from '../field.js';
|
|
2
|
-
import { normalizeOptions, OpenAPIParser } from '../../services/index.js';
|
|
3
|
-
import spec from './fixtures/fields.json';
|
|
4
|
-
const opts = normalizeOptions({});
|
|
5
|
-
const deps = { operation: { pointer: 'testFieldModel' } };
|
|
6
|
-
describe('Models', () => {
|
|
7
|
-
describe('FieldModel', () => {
|
|
8
|
-
const parser = new OpenAPIParser(spec, undefined, opts);
|
|
9
|
-
test('basic field details', () => {
|
|
10
|
-
const field = getField(parser, {
|
|
11
|
-
$ref: '#/components/parameters/testParam',
|
|
12
|
-
}, '#/components/parameters/testParam', opts, deps);
|
|
13
|
-
expect(field.name).toEqual('test_name');
|
|
14
|
-
expect(field.in).toEqual('path');
|
|
15
|
-
expect(field.required).toEqual(false);
|
|
16
|
-
expect(field.schema.type).toEqual('string');
|
|
17
|
-
});
|
|
18
|
-
test('field details relevant for parameter serialization', () => {
|
|
19
|
-
const field = getField(parser, {
|
|
20
|
-
$ref: '#/components/parameters/serializationParam',
|
|
21
|
-
}, '#/components/parameters/serializationParam', opts, deps);
|
|
22
|
-
expect(field.name).toEqual('serialization_test_name');
|
|
23
|
-
expect(field.in).toEqual('query');
|
|
24
|
-
expect(field.schema.type).toEqual('array');
|
|
25
|
-
expect(field.style).toEqual('form');
|
|
26
|
-
expect(field.explode).toEqual(true);
|
|
27
|
-
});
|
|
28
|
-
test('field details relevant for default path param serialization', () => {
|
|
29
|
-
const field = getField(parser, {
|
|
30
|
-
$ref: '#/components/parameters/pathParamWithNoStyle',
|
|
31
|
-
}, '#/components/parameters/pathParamWithNoStyle', opts, deps);
|
|
32
|
-
expect(field.name).toEqual('serialization_test_name');
|
|
33
|
-
expect(field.in).toEqual('path');
|
|
34
|
-
expect(field.schema.type).toEqual('array');
|
|
35
|
-
expect(field.style).toEqual('simple');
|
|
36
|
-
expect(field.explode).toEqual(false);
|
|
37
|
-
});
|
|
38
|
-
test('field details relevant for default query parameter serialization', () => {
|
|
39
|
-
const field = getField(parser, {
|
|
40
|
-
$ref: '#/components/parameters/queryParamWithNoStyle',
|
|
41
|
-
}, '#/components/parameters/queryParamWithNoStyle', opts, deps);
|
|
42
|
-
expect(field.name).toEqual('serialization_test_name');
|
|
43
|
-
expect(field.in).toEqual('query');
|
|
44
|
-
expect(field.schema.type).toEqual('array');
|
|
45
|
-
expect(field.style).toEqual('form');
|
|
46
|
-
expect(field.explode).toEqual(true);
|
|
47
|
-
});
|
|
48
|
-
test('field details relevant for default cookie parameter serialization', () => {
|
|
49
|
-
const field = getField(parser, {
|
|
50
|
-
$ref: '#/components/parameters/queryParamWithNoStyle',
|
|
51
|
-
}, '#/components/parameters/queryParamWithNoStyle', opts, deps);
|
|
52
|
-
expect(field.name).toEqual('serialization_test_name');
|
|
53
|
-
expect(field.in).toEqual('query');
|
|
54
|
-
expect(field.schema.type).toEqual('array');
|
|
55
|
-
expect(field.style).toEqual('form');
|
|
56
|
-
expect(field.explode).toEqual(true);
|
|
57
|
-
});
|
|
58
|
-
test('field name should populated from name even if $ref (headers)', () => {
|
|
59
|
-
const field = getField(parser, {
|
|
60
|
-
$ref: '#/components/headers/testHeader',
|
|
61
|
-
name: 'Test-Header',
|
|
62
|
-
}, '#/components/headers/testHeader', opts, deps);
|
|
63
|
-
expect(field.name).toEqual('Test-Header');
|
|
64
|
-
});
|
|
65
|
-
test('param example should be override the example provided by the schema', () => {
|
|
66
|
-
const field = getField(parser, {
|
|
67
|
-
$ref: '#/components/parameters/queryParamExample',
|
|
68
|
-
}, '', opts, deps);
|
|
69
|
-
expect(field.example).toEqual({ id: 'main example' });
|
|
70
|
-
expect(field.schema.example).toEqual({ id: 'main example' });
|
|
71
|
-
expect(field.schema.schema.example).toEqual({ id: 'main example' });
|
|
72
|
-
});
|
|
73
|
-
test('content example should be override the example provided by the schema', () => {
|
|
74
|
-
const field = getField(parser, {
|
|
75
|
-
$ref: '#/components/parameters/queryParamWithContentExample',
|
|
76
|
-
}, '', opts, deps);
|
|
77
|
-
expect(field.example).toEqual({ id: 'content example' });
|
|
78
|
-
expect(field.schema.example).toEqual({ id: 'content example' });
|
|
79
|
-
expect(field.schema.schema.example).toEqual({ id: 'content example' });
|
|
80
|
-
});
|
|
81
|
-
test('field includes allowReserved when parameter has allowReserved', () => {
|
|
82
|
-
const field = getField(parser, {
|
|
83
|
-
$ref: '#/components/parameters/allowReservedParam',
|
|
84
|
-
}, '#/components/parameters/allowReservedParam', opts, deps);
|
|
85
|
-
expect(field.name).toEqual('filter');
|
|
86
|
-
expect(field.in).toEqual('query');
|
|
87
|
-
expect(field.allowReserved).toEqual(true);
|
|
88
|
-
});
|
|
89
|
-
test('should include badges from x-badges on parameter', () => {
|
|
90
|
-
const field = getField(parser, { $ref: '#/components/parameters/paramWithBadges' }, '#/components/parameters/paramWithBadges', opts, deps);
|
|
91
|
-
expect(field.name).toEqual('experimentalFlag');
|
|
92
|
-
expect(field.badges).toEqual([
|
|
93
|
-
{ name: 'Experimental', position: 'after' },
|
|
94
|
-
{ name: 'Beta', position: 'before', color: 'blue' },
|
|
95
|
-
]);
|
|
96
|
-
});
|
|
97
|
-
test('should include badges from x-badges on schema property', () => {
|
|
98
|
-
const field = getField(parser, {
|
|
99
|
-
name: 'quantityFilled',
|
|
100
|
-
required: false,
|
|
101
|
-
schema: {
|
|
102
|
-
type: 'integer',
|
|
103
|
-
description: 'Filled quantity (experimental).',
|
|
104
|
-
'x-badges': [{ name: 'Experimental' }],
|
|
105
|
-
},
|
|
106
|
-
}, '#/components/schemas/schemaWithBadgeProperty/properties/quantityFilled', opts, deps);
|
|
107
|
-
expect(field.name).toEqual('quantityFilled');
|
|
108
|
-
expect(field.badges).toEqual([{ name: 'Experimental' }]);
|
|
109
|
-
});
|
|
110
|
-
test('should include badges from x-badges on schema when parameter schema is a $ref', () => {
|
|
111
|
-
const field = getField(parser, { $ref: '#/components/parameters/paramWithSchemaRefBadges' }, '#/components/parameters/paramWithSchemaRefBadges', opts, deps);
|
|
112
|
-
expect(field.name).toEqual('statusFilter');
|
|
113
|
-
expect(field.badges).toEqual([{ name: 'From ref schema', position: 'after' }]);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
//# sourceMappingURL=FieldModel.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { getMediaContent } from '../mediaContent.js';
|
|
2
|
-
import { normalizeOptions, OpenAPIParser } from '../../services/index.js';
|
|
3
|
-
import { MediaTypes } from '../../constants.js';
|
|
4
|
-
const options = normalizeOptions({});
|
|
5
|
-
const data = { operation: { pointer: 'testMediaContent' } };
|
|
6
|
-
describe('Models', () => {
|
|
7
|
-
describe('mediaContent', () => {
|
|
8
|
-
let parser;
|
|
9
|
-
const info = {
|
|
10
|
-
[MediaTypes.JSON]: {
|
|
11
|
-
schema: {
|
|
12
|
-
additionalProperties: {
|
|
13
|
-
format: 'int32',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
beforeEach(() => {
|
|
19
|
-
parser = new OpenAPIParser({ openapi: '3.0.0' }, undefined, options);
|
|
20
|
-
});
|
|
21
|
-
test('should work with default arguments', () => {
|
|
22
|
-
const consoleError = vi.spyOn(global.console, 'error');
|
|
23
|
-
const mediaContentModel = getMediaContent({
|
|
24
|
-
parser,
|
|
25
|
-
info: {},
|
|
26
|
-
isRequestType: true,
|
|
27
|
-
options,
|
|
28
|
-
data,
|
|
29
|
-
});
|
|
30
|
-
expect(consoleError).not.toHaveBeenCalled();
|
|
31
|
-
expect(mediaContentModel).toEqual({
|
|
32
|
-
hasSample: false,
|
|
33
|
-
isRequestType: true,
|
|
34
|
-
mediaTypes: [],
|
|
35
|
-
...data,
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
test('should handle isRequestType argument', () => {
|
|
39
|
-
const mediaContentModelWithRequestTypeTrue = getMediaContent({
|
|
40
|
-
parser,
|
|
41
|
-
info: {},
|
|
42
|
-
isRequestType: true,
|
|
43
|
-
options,
|
|
44
|
-
data,
|
|
45
|
-
});
|
|
46
|
-
const mediaContentModelWithRequestTypeFalse = getMediaContent({
|
|
47
|
-
parser,
|
|
48
|
-
info: {},
|
|
49
|
-
isRequestType: false,
|
|
50
|
-
options,
|
|
51
|
-
data,
|
|
52
|
-
});
|
|
53
|
-
expect(mediaContentModelWithRequestTypeTrue.isRequestType).toEqual(true);
|
|
54
|
-
expect(mediaContentModelWithRequestTypeFalse.isRequestType).toEqual(false);
|
|
55
|
-
});
|
|
56
|
-
test('should return mediaType', () => {
|
|
57
|
-
const mediaContentModel = getMediaContent({
|
|
58
|
-
parser,
|
|
59
|
-
info,
|
|
60
|
-
isRequestType: true,
|
|
61
|
-
options,
|
|
62
|
-
data,
|
|
63
|
-
});
|
|
64
|
-
const firstMediaType = mediaContentModel.mediaTypes[0];
|
|
65
|
-
expect(mediaContentModel.mediaTypes.length).toEqual(1);
|
|
66
|
-
expect(firstMediaType.name).toEqual(MediaTypes.JSON);
|
|
67
|
-
});
|
|
68
|
-
test('should preserve summary for each example when media type uses examples object', () => {
|
|
69
|
-
const infoWithExamples = {
|
|
70
|
-
[MediaTypes.JSON]: {
|
|
71
|
-
schema: {
|
|
72
|
-
type: 'object',
|
|
73
|
-
properties: { publisherId: { type: 'string' } },
|
|
74
|
-
},
|
|
75
|
-
examples: {
|
|
76
|
-
'example-0': {
|
|
77
|
-
summary: 'First Example',
|
|
78
|
-
value: { publisherId: '1' },
|
|
79
|
-
},
|
|
80
|
-
'example-1': {
|
|
81
|
-
summary: 'Second Example',
|
|
82
|
-
value: { publisherId: '2' },
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
const mediaContentModel = getMediaContent({
|
|
88
|
-
parser,
|
|
89
|
-
info: infoWithExamples,
|
|
90
|
-
isRequestType: true,
|
|
91
|
-
options,
|
|
92
|
-
data,
|
|
93
|
-
});
|
|
94
|
-
const examples = mediaContentModel.mediaTypes[0]?.examples;
|
|
95
|
-
expect(examples).toBeDefined();
|
|
96
|
-
expect(examples?.['example-0']).toBeDefined();
|
|
97
|
-
expect(examples?.['example-0']?.summary).toBe('First Example');
|
|
98
|
-
expect(examples?.['example-0']?.value).toEqual({ publisherId: '1' });
|
|
99
|
-
expect(examples?.['example-1']).toBeDefined();
|
|
100
|
-
expect(examples?.['example-1']?.summary).toBe('Second Example');
|
|
101
|
-
expect(examples?.['example-1']?.value).toEqual({ publisherId: '2' });
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
//# sourceMappingURL=MediaContent.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|