@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.
Files changed (260) hide show
  1. package/lib/telemetry/RedocTelemetry.js +1 -31
  2. package/package.json +4 -4
  3. package/lib/components/ApiInfo/__tests__/ApiInfo.test.d.ts +0 -1
  4. package/lib/components/ApiInfo/__tests__/ApiInfo.test.js +0 -46
  5. package/lib/components/Callbacks/__tests__/Callbacks.test.d.ts +0 -1
  6. package/lib/components/Callbacks/__tests__/Callbacks.test.js +0 -46
  7. package/lib/components/Content/__tests__/useAutoScroll.test.d.ts +0 -1
  8. package/lib/components/Content/__tests__/useAutoScroll.test.js +0 -88
  9. package/lib/components/ContentItem/__tests__/useIsExpanded.test.d.ts +0 -1
  10. package/lib/components/ContentItem/__tests__/useIsExpanded.test.js +0 -123
  11. package/lib/components/ContentItems/__tests__/Items.test.d.ts +0 -1
  12. package/lib/components/ContentItems/__tests__/Items.test.js +0 -66
  13. package/lib/components/ContentItems/__tests__/VirtualList.test.d.ts +0 -1
  14. package/lib/components/ContentItems/__tests__/VirtualList.test.js +0 -135
  15. package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.d.ts +0 -1
  16. package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.js +0 -63
  17. package/lib/components/Download/__tests__/DownloadSpecification.test.d.ts +0 -1
  18. package/lib/components/Download/__tests__/DownloadSpecification.test.js +0 -52
  19. package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.d.ts +0 -1
  20. package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.js +0 -60
  21. package/lib/components/ExpandAllButton/__tests__/helpers.test.d.ts +0 -1
  22. package/lib/components/ExpandAllButton/__tests__/helpers.test.js +0 -133
  23. package/lib/components/Language/__tests__/LanguageDropdown.test.d.ts +0 -1
  24. package/lib/components/Language/__tests__/LanguageDropdown.test.js +0 -23
  25. package/lib/components/Markdown/__tests__/Markdown.test.d.ts +0 -1
  26. package/lib/components/Markdown/__tests__/Markdown.test.js +0 -34
  27. package/lib/components/McpOverview/__tests__/McpOverview.test.d.ts +0 -1
  28. package/lib/components/McpOverview/__tests__/McpOverview.test.js +0 -66
  29. package/lib/components/McpTool/__tests__/McpPrompt.test.d.ts +0 -1
  30. package/lib/components/McpTool/__tests__/McpPrompt.test.js +0 -57
  31. package/lib/components/McpTool/__tests__/McpResource.test.d.ts +0 -1
  32. package/lib/components/McpTool/__tests__/McpResource.test.js +0 -81
  33. package/lib/components/McpTool/__tests__/McpTool.test.d.ts +0 -1
  34. package/lib/components/McpTool/__tests__/McpTool.test.js +0 -82
  35. package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.d.ts +0 -1
  36. package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.js +0 -79
  37. package/lib/components/OperationItem/__tests__/OperationItem.test.d.ts +0 -1
  38. package/lib/components/OperationItem/__tests__/OperationItem.test.js +0 -70
  39. package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.d.ts +0 -16
  40. package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.js +0 -42
  41. package/lib/components/Overview/__tests__/Overview.test.d.ts +0 -1
  42. package/lib/components/Overview/__tests__/Overview.test.js +0 -59
  43. package/lib/components/PayloadSamples/__tests__/Example.test.d.ts +0 -1
  44. package/lib/components/PayloadSamples/__tests__/Example.test.js +0 -36
  45. package/lib/components/PayloadSamples/__tests__/ExampleValue.test.d.ts +0 -1
  46. package/lib/components/PayloadSamples/__tests__/ExampleValue.test.js +0 -197
  47. package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.d.ts +0 -1
  48. package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.js +0 -38
  49. package/lib/components/PropertyDetails/__tests__/Extensions.test.d.ts +0 -1
  50. package/lib/components/PropertyDetails/__tests__/Extensions.test.js +0 -21
  51. package/lib/components/PropertyDetails/__tests__/FieldDetail.test.d.ts +0 -1
  52. package/lib/components/PropertyDetails/__tests__/FieldDetail.test.js +0 -52
  53. package/lib/components/PropertyDetails/__tests__/FieldDetails.test.d.ts +0 -1
  54. package/lib/components/PropertyDetails/__tests__/FieldDetails.test.js +0 -191
  55. package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.d.ts +0 -1
  56. package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.js +0 -365
  57. package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.d.ts +0 -1
  58. package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.js +0 -23
  59. package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.d.ts +0 -1
  60. package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.js +0 -16
  61. package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.d.ts +0 -1
  62. package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.js +0 -104
  63. package/lib/components/RenderHook/__tests__/RenderHook.test.d.ts +0 -1
  64. package/lib/components/RenderHook/__tests__/RenderHook.test.js +0 -15
  65. package/lib/components/Replay/__tests__/utils.test.d.ts +0 -1
  66. package/lib/components/Replay/__tests__/utils.test.js +0 -526
  67. package/lib/components/Request/__tests__/RequestDetails.test.d.ts +0 -1
  68. package/lib/components/Request/__tests__/RequestDetails.test.js +0 -98
  69. package/lib/components/RequestSamples/__tests__/Example.test.d.ts +0 -1
  70. package/lib/components/RequestSamples/__tests__/Example.test.js +0 -384
  71. package/lib/components/RequestSamples/__tests__/RequestSamples.test.d.ts +0 -1
  72. package/lib/components/RequestSamples/__tests__/RequestSamples.test.js +0 -226
  73. package/lib/components/RequestSamples/__tests__/useCodeSamples.test.d.ts +0 -1
  74. package/lib/components/RequestSamples/__tests__/useCodeSamples.test.js +0 -64
  75. package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.d.ts +0 -1
  76. package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.js +0 -29
  77. package/lib/components/Responses/__tests__/OperationResponseList.test.d.ts +0 -1
  78. package/lib/components/Responses/__tests__/OperationResponseList.test.js +0 -89
  79. package/lib/components/Responses/__tests__/ResponseDetails.test.d.ts +0 -1
  80. package/lib/components/Responses/__tests__/ResponseDetails.test.js +0 -111
  81. package/lib/components/Responses/__tests__/ResponsesHeaders.test.d.ts +0 -1
  82. package/lib/components/Responses/__tests__/ResponsesHeaders.test.js +0 -26
  83. package/lib/components/Schema/__tests__/ArraySchema.test.d.ts +0 -1
  84. package/lib/components/Schema/__tests__/ArraySchema.test.js +0 -93
  85. package/lib/components/Schema/__tests__/ObjectSchema.test.d.ts +0 -1
  86. package/lib/components/Schema/__tests__/ObjectSchema.test.js +0 -115
  87. package/lib/components/Schema/__tests__/OneOfSchema.test.d.ts +0 -1
  88. package/lib/components/Schema/__tests__/OneOfSchema.test.js +0 -33
  89. package/lib/components/Schema/__tests__/Schema.test.d.ts +0 -1
  90. package/lib/components/Schema/__tests__/Schema.test.js +0 -67
  91. package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.d.ts +0 -1
  92. package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.js +0 -22
  93. package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.d.ts +0 -1
  94. package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.js +0 -95
  95. package/lib/components/Security/__tests__/Security.test.d.ts +0 -1
  96. package/lib/components/Security/__tests__/Security.test.js +0 -38
  97. package/lib/components/Security/__tests__/SecurityButton.test.d.ts +0 -1
  98. package/lib/components/Security/__tests__/SecurityButton.test.js +0 -92
  99. package/lib/components/Security/__tests__/SecurityModal.test.d.ts +0 -1
  100. package/lib/components/Security/__tests__/SecurityModal.test.js +0 -172
  101. package/lib/components/ServerList/__tests__/ServerList.test.d.ts +0 -1
  102. package/lib/components/ServerList/__tests__/ServerList.test.js +0 -83
  103. package/lib/components/Tabs/__tests__/Tabs.test.d.ts +0 -1
  104. package/lib/components/Tabs/__tests__/Tabs.test.js +0 -27
  105. package/lib/components/ViewNested/__tests__/ViewNested.test.d.ts +0 -1
  106. package/lib/components/ViewNested/__tests__/ViewNested.test.js +0 -42
  107. package/lib/components/__tests__/Samples/ExampleSwitch.test.d.ts +0 -1
  108. package/lib/components/__tests__/Samples/ExampleSwitch.test.js +0 -45
  109. package/lib/components/__tests__/Samples/use-example-key.test.d.ts +0 -1
  110. package/lib/components/__tests__/Samples/use-example-key.test.js +0 -28
  111. package/lib/components/__tests__/common/ClearButton.test.d.ts +0 -1
  112. package/lib/components/__tests__/common/ClearButton.test.js +0 -18
  113. package/lib/components/__tests__/common/Dropdown.test.d.ts +0 -1
  114. package/lib/components/__tests__/common/Dropdown.test.js +0 -52
  115. package/lib/components/__tests__/mocks/examples.d.ts +0 -4
  116. package/lib/components/__tests__/mocks/examples.js +0 -115
  117. package/lib/components/common/__tests__/Dropdown.test.d.ts +0 -1
  118. package/lib/components/common/__tests__/Dropdown.test.js +0 -129
  119. package/lib/components/common/__tests__/LinkToField.test.d.ts +0 -1
  120. package/lib/components/common/__tests__/LinkToField.test.js +0 -39
  121. package/lib/jotai/__tests__/app.test.d.ts +0 -1
  122. package/lib/jotai/__tests__/app.test.js +0 -53
  123. package/lib/models/__tests__/Callback.test.d.ts +0 -1
  124. package/lib/models/__tests__/Callback.test.js +0 -15
  125. package/lib/models/__tests__/FieldModel.test.d.ts +0 -1
  126. package/lib/models/__tests__/FieldModel.test.js +0 -117
  127. package/lib/models/__tests__/MediaContent.test.d.ts +0 -1
  128. package/lib/models/__tests__/MediaContent.test.js +0 -105
  129. package/lib/models/__tests__/Operation.test.d.ts +0 -1
  130. package/lib/models/__tests__/Operation.test.js +0 -459
  131. package/lib/models/__tests__/Response.test.d.ts +0 -1
  132. package/lib/models/__tests__/Response.test.js +0 -221
  133. package/lib/models/__tests__/Schema.circular.test.d.ts +0 -1
  134. package/lib/models/__tests__/Schema.circular.test.js +0 -694
  135. package/lib/models/__tests__/Schema.test.d.ts +0 -1
  136. package/lib/models/__tests__/Schema.test.js +0 -1395
  137. package/lib/models/__tests__/example.test.d.ts +0 -1
  138. package/lib/models/__tests__/example.test.js +0 -90
  139. package/lib/models/__tests__/group.test.d.ts +0 -1
  140. package/lib/models/__tests__/group.test.js +0 -52
  141. package/lib/models/__tests__/helpers.d.ts +0 -5
  142. package/lib/models/__tests__/helpers.js +0 -62
  143. package/lib/models/__tests__/request.test.d.ts +0 -1
  144. package/lib/models/__tests__/request.test.js +0 -119
  145. package/lib/services/__tests__/OpenAPIParser.test.d.ts +0 -1
  146. package/lib/services/__tests__/OpenAPIParser.test.js +0 -80
  147. package/lib/services/__tests__/check.test.d.ts +0 -1
  148. package/lib/services/__tests__/check.test.js +0 -22
  149. package/lib/services/__tests__/utils.test.d.ts +0 -1
  150. package/lib/services/__tests__/utils.test.js +0 -42
  151. package/lib/services/code-samples/__tests__/apply-environments.test.d.ts +0 -1
  152. package/lib/services/code-samples/__tests__/apply-environments.test.js +0 -64
  153. package/lib/services/code-samples/__tests__/build-code-samples.test.d.ts +0 -1
  154. package/lib/services/code-samples/__tests__/build-code-samples.test.js +0 -70
  155. package/lib/services/code-samples/__tests__/convertSampleToString.test.d.ts +0 -1
  156. package/lib/services/code-samples/__tests__/convertSampleToString.test.js +0 -116
  157. package/lib/services/code-samples/__tests__/generator-data-value.test.d.ts +0 -1
  158. package/lib/services/code-samples/__tests__/generator-data-value.test.js +0 -277
  159. package/lib/services/code-samples/__tests__/generator-serialized-value.test.d.ts +0 -1
  160. package/lib/services/code-samples/__tests__/generator-serialized-value.test.js +0 -258
  161. package/lib/services/code-samples/__tests__/generator-value.test.d.ts +0 -1
  162. package/lib/services/code-samples/__tests__/generator-value.test.js +0 -273
  163. package/lib/services/code-samples/__tests__/generator.test.d.ts +0 -249
  164. package/lib/services/code-samples/__tests__/generator.test.js +0 -1201
  165. package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.d.ts +0 -1
  166. package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.js +0 -31
  167. package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.d.ts +0 -1
  168. package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.js +0 -222
  169. package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.d.ts +0 -1
  170. package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.js +0 -129
  171. package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.d.ts +0 -1
  172. package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.js +0 -49
  173. package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.d.ts +0 -1
  174. package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.js +0 -172
  175. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.d.ts +0 -1
  176. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.js +0 -172
  177. package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.d.ts +0 -1
  178. package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.js +0 -130
  179. package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.d.ts +0 -1
  180. package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.js +0 -191
  181. package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.d.ts +0 -1
  182. package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.js +0 -172
  183. package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.d.ts +0 -1
  184. package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.js +0 -85
  185. package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.d.ts +0 -1
  186. package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.js +0 -85
  187. package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.d.ts +0 -1
  188. package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.js +0 -126
  189. package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.d.ts +0 -1
  190. package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.js +0 -105
  191. package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.d.ts +0 -1
  192. package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.js +0 -126
  193. package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.d.ts +0 -1
  194. package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.js +0 -129
  195. package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.d.ts +0 -1
  196. package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.js +0 -129
  197. package/lib/services/config-options/__tests__/helpers.test.d.ts +0 -1
  198. package/lib/services/config-options/__tests__/helpers.test.js +0 -234
  199. package/lib/services/history/__tests__/helpers.test.d.ts +0 -1
  200. package/lib/services/history/__tests__/helpers.test.js +0 -19
  201. package/lib/services/menu/__tests__/buildNestedTagsItems.test.d.ts +0 -1
  202. package/lib/services/menu/__tests__/buildNestedTagsItems.test.js +0 -109
  203. package/lib/services/menu/__tests__/builder.test.d.ts +0 -1
  204. package/lib/services/menu/__tests__/builder.test.js +0 -307
  205. package/lib/services/menu/__tests__/operation.test.d.ts +0 -1
  206. package/lib/services/menu/__tests__/operation.test.js +0 -240
  207. package/lib/services/menu/__tests__/tags.test.d.ts +0 -1
  208. package/lib/services/menu/__tests__/tags.test.js +0 -71
  209. package/lib/telemetry/__tests__/RedocTelemetry.test.d.ts +0 -1
  210. package/lib/telemetry/__tests__/RedocTelemetry.test.js +0 -107
  211. package/lib/testProviders.d.ts +0 -6
  212. package/lib/testProviders.js +0 -14
  213. package/lib/utils/__tests__/areArraysEqual.test.d.ts +0 -1
  214. package/lib/utils/__tests__/areArraysEqual.test.js +0 -33
  215. package/lib/utils/__tests__/argValuesHelpers.d.ts +0 -1
  216. package/lib/utils/__tests__/argValuesHelpers.js +0 -56
  217. package/lib/utils/__tests__/calculateMaxLength.test.d.ts +0 -1
  218. package/lib/utils/__tests__/calculateMaxLength.test.js +0 -119
  219. package/lib/utils/__tests__/configure-helpers.test.d.ts +0 -1
  220. package/lib/utils/__tests__/configure-helpers.test.js +0 -356
  221. package/lib/utils/__tests__/convertSwagger2OpenAPI.test.d.ts +0 -1
  222. package/lib/utils/__tests__/convertSwagger2OpenAPI.test.js +0 -392
  223. package/lib/utils/__tests__/debounce.test.d.ts +0 -1
  224. package/lib/utils/__tests__/debounce.test.js +0 -54
  225. package/lib/utils/__tests__/debug.test.d.ts +0 -1
  226. package/lib/utils/__tests__/debug.test.js +0 -23
  227. package/lib/utils/__tests__/dom.test.d.ts +0 -1
  228. package/lib/utils/__tests__/dom.test.js +0 -108
  229. package/lib/utils/__tests__/getBreadcrumbs.test.d.ts +0 -1
  230. package/lib/utils/__tests__/getBreadcrumbs.test.js +0 -98
  231. package/lib/utils/__tests__/hasNestedFields.test.d.ts +0 -1
  232. package/lib/utils/__tests__/hasNestedFields.test.js +0 -147
  233. package/lib/utils/__tests__/helpers.test.d.ts +0 -1
  234. package/lib/utils/__tests__/helpers.test.js +0 -174
  235. package/lib/utils/__tests__/isMobile.test.d.ts +0 -1
  236. package/lib/utils/__tests__/isMobile.test.js +0 -28
  237. package/lib/utils/__tests__/loadAndBundleSpec.test.d.ts +0 -1
  238. package/lib/utils/__tests__/loadAndBundleSpec.test.js +0 -22
  239. package/lib/utils/__tests__/local-storage.test.d.ts +0 -1
  240. package/lib/utils/__tests__/local-storage.test.js +0 -48
  241. package/lib/utils/__tests__/object.test.d.ts +0 -1
  242. package/lib/utils/__tests__/object.test.js +0 -45
  243. package/lib/utils/__tests__/openapi.test.d.ts +0 -1
  244. package/lib/utils/__tests__/openapi.test.js +0 -1378
  245. package/lib/utils/__tests__/path.test.d.ts +0 -1
  246. package/lib/utils/__tests__/path.test.js +0 -16
  247. package/lib/utils/__tests__/queryString.test.d.ts +0 -1
  248. package/lib/utils/__tests__/queryString.test.js +0 -60
  249. package/lib/utils/__tests__/replaceVariables.test.d.ts +0 -1
  250. package/lib/utils/__tests__/replaceVariables.test.js +0 -46
  251. package/lib/utils/__tests__/simplifyAstStructure.test.d.ts +0 -1
  252. package/lib/utils/__tests__/simplifyAstStructure.test.js +0 -26
  253. package/lib/utils/__tests__/sort.test.d.ts +0 -1
  254. package/lib/utils/__tests__/sort.test.js +0 -16
  255. package/lib/utils/__tests__/string.test.d.ts +0 -1
  256. package/lib/utils/__tests__/string.test.js +0 -16
  257. package/lib/utils/__tests__/theme-helpers.test.d.ts +0 -1
  258. package/lib/utils/__tests__/theme-helpers.test.js +0 -24
  259. package/lib/utils/__tests__/url.test.d.ts +0 -1
  260. package/lib/utils/__tests__/url.test.js +0 -134
@@ -1,126 +0,0 @@
1
- export { HTTPSnippet } from '../../../index.js'; // we need to reexport it before to prevent circular ref issue
2
- import httr from '../httr.js';
3
- import { originalOptions, serverVariablesOptions, source } from '../../__mocks__/mock.js';
4
- describe('#code-samples R lang', () => {
5
- describe('handler', () => {
6
- it('returns code API POST /pet', () => {
7
- const result = httr(source['POST http://petstore.swagger.io/v2/pet'], originalOptions, {
8
- target: 'r',
9
- client: 'httr',
10
- });
11
- expect(result).toMatchSnapshot();
12
- });
13
- it('returns code with path parameters reserved (data) and not (petId) /pet/{petId}/uploadImage/{data}', () => {
14
- const result = httr(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}'], originalOptions, { target: 'r', client: 'httr' });
15
- expect(result).toMatchSnapshot();
16
- });
17
- it('returns code with one path parameter inside url /pet/{petId}/uploadImage', () => {
18
- const result = httr(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage'], originalOptions, { target: 'r', client: 'httr' });
19
- expect(result).toMatchSnapshot();
20
- });
21
- it('returns code with path parameter and query /pet/findByStatus/{id}?status=...', () => {
22
- const result = httr(source['GET http://petstore.swagger.io/v2/pet/findByStatus/{id}'], originalOptions, { target: 'r', client: 'httr' });
23
- expect(result).toMatchSnapshot();
24
- });
25
- it('should generate code with server variables', () => {
26
- const result = httr(source['POST https://{customerId}.saas-app.com:{port}/v2'], serverVariablesOptions, { target: 'r', client: 'httr' });
27
- expect(result).toMatchSnapshot();
28
- });
29
- it('should generate code with basic auth', () => {
30
- const result = httr(source['POST http://petstore.swagger.io/login'], serverVariablesOptions, {
31
- target: 'r',
32
- client: 'httr',
33
- });
34
- expect(result).toMatchSnapshot();
35
- });
36
- it('should handle URL_ENCODED with text but no params (serializedValue case)', () => {
37
- const sourceWithUrlEncodedText = {
38
- method: 'post',
39
- url: 'http://petstore.swagger.io/v2/pet',
40
- httpVersion: 'HTTP/1.1',
41
- cookies: [],
42
- headers: [{ name: 'Content-Type', value: 'application/x-www-form-urlencoded' }],
43
- queryString: [],
44
- postData: {
45
- mimeType: 'application/x-www-form-urlencoded',
46
- text: 'name=Museum+Visitor&value=premium&count=5',
47
- params: [],
48
- },
49
- headersSize: 0,
50
- bodySize: 0,
51
- securityOAuth2ExtraCalls: [],
52
- pathParameters: {},
53
- serverVariables: {},
54
- queryObj: {},
55
- headersObj: { 'Content-Type': 'application/x-www-form-urlencoded' },
56
- cookiesObj: {},
57
- allHeaders: { 'Content-Type': 'application/x-www-form-urlencoded' },
58
- uriObj: {
59
- protocol: 'http:',
60
- slashes: true,
61
- auth: null,
62
- host: 'petstore.swagger.io',
63
- port: null,
64
- hostname: 'petstore.swagger.io',
65
- hash: null,
66
- search: '',
67
- query: {},
68
- pathname: '/v2/pet',
69
- path: '/v2/pet',
70
- href: 'http://petstore.swagger.io/v2/pet',
71
- },
72
- fullUrl: 'http://petstore.swagger.io/v2/pet',
73
- };
74
- const result = httr(sourceWithUrlEncodedText, originalOptions, {
75
- target: 'r',
76
- client: 'httr',
77
- });
78
- expect(result).toMatchSnapshot();
79
- });
80
- it('should handle MULTIPART with text but no params (serializedValue case)', () => {
81
- const sourceWithMultipartText = {
82
- method: 'post',
83
- url: 'http://petstore.swagger.io/v2/pet',
84
- httpVersion: 'HTTP/1.1',
85
- cookies: [],
86
- headers: [{ name: 'Content-Type', value: 'multipart/form-data' }],
87
- queryString: [],
88
- postData: {
89
- mimeType: 'multipart/form-data',
90
- text: '--boundary123\r\nContent-Disposition: form-data; name="field1"\r\n\r\nvalue1\r\n--boundary123\r\nContent-Disposition: form-data; name="field2"\r\n\r\nvalue2\r\n--boundary123--',
91
- params: [],
92
- },
93
- headersSize: 0,
94
- bodySize: 0,
95
- securityOAuth2ExtraCalls: [],
96
- pathParameters: {},
97
- serverVariables: {},
98
- queryObj: {},
99
- headersObj: { 'Content-Type': 'multipart/form-data' },
100
- cookiesObj: {},
101
- allHeaders: { 'Content-Type': 'multipart/form-data' },
102
- uriObj: {
103
- protocol: 'http:',
104
- slashes: true,
105
- auth: null,
106
- host: 'petstore.swagger.io',
107
- port: null,
108
- hostname: 'petstore.swagger.io',
109
- hash: null,
110
- search: '',
111
- query: {},
112
- pathname: '/v2/pet',
113
- path: '/v2/pet',
114
- href: 'http://petstore.swagger.io/v2/pet',
115
- },
116
- fullUrl: 'http://petstore.swagger.io/v2/pet',
117
- };
118
- const result = httr(sourceWithMultipartText, originalOptions, {
119
- target: 'r',
120
- client: 'httr',
121
- });
122
- expect(result).toMatchSnapshot();
123
- });
124
- });
125
- });
126
- //# sourceMappingURL=httr.test.js.map
@@ -1 +0,0 @@
1
- export { HTTPSnippet } from '../../../index.js';
@@ -1,129 +0,0 @@
1
- export { HTTPSnippet } from '../../../index.js'; // we need to reexport it before to prevent circular ref issue
2
- import native from '../native.js';
3
- import { originalOptions, serverVariablesOptions, source } from '../../__mocks__/mock.js';
4
- describe('#code-samples Ruby lang', () => {
5
- describe('handler', () => {
6
- it('returns code API POST /pet', () => {
7
- const result = native(source['POST http://petstore.swagger.io/v2/pet'], originalOptions, {
8
- target: 'ruby',
9
- client: 'net::http',
10
- });
11
- expect(result).toMatchSnapshot();
12
- });
13
- it('returns code with path parameters reserved (data) and not (petId) /pet/{petId}/uploadImage/{data}', () => {
14
- const result = native(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}'], originalOptions, { target: 'ruby', client: 'net::http' });
15
- expect(result).toMatchSnapshot();
16
- });
17
- it('returns code with one path parameter inside url /pet/{petId}/uploadImage', () => {
18
- const result = native(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage'], originalOptions, { target: 'ruby', client: 'net::http' });
19
- expect(result).toMatchSnapshot();
20
- });
21
- it('returns code with path parameter and query /pet/findByStatus/{id}?status=...', () => {
22
- const result = native(source['GET http://petstore.swagger.io/v2/pet/findByStatus/{id}'], originalOptions, { target: 'ruby', client: 'net::http' });
23
- expect(result).toMatchSnapshot();
24
- });
25
- it('should generate code with server variables', () => {
26
- const result = native(source['POST https://{customerId}.saas-app.com:{port}/v2'], serverVariablesOptions, {
27
- target: 'ruby',
28
- client: 'net::http',
29
- });
30
- expect(result).toMatchSnapshot();
31
- });
32
- it('should generate code with basic auth', () => {
33
- const result = native(source['POST http://petstore.swagger.io/login'], serverVariablesOptions, {
34
- target: 'ruby',
35
- client: 'net::http',
36
- });
37
- expect(result).toMatchSnapshot();
38
- });
39
- it('should handle URL_ENCODED with text but no params (serializedValue case)', () => {
40
- const sourceWithUrlEncodedText = {
41
- method: 'post',
42
- url: 'http://petstore.swagger.io/v2/pet',
43
- httpVersion: 'HTTP/1.1',
44
- cookies: [],
45
- headers: [{ name: 'Content-Type', value: 'application/x-www-form-urlencoded' }],
46
- queryString: [],
47
- postData: {
48
- mimeType: 'application/x-www-form-urlencoded',
49
- text: 'name=Museum+Visitor&value=premium&count=5',
50
- params: [],
51
- },
52
- headersSize: 0,
53
- bodySize: 0,
54
- securityOAuth2ExtraCalls: [],
55
- pathParameters: {},
56
- serverVariables: {},
57
- queryObj: {},
58
- headersObj: { 'Content-Type': 'application/x-www-form-urlencoded' },
59
- cookiesObj: {},
60
- allHeaders: { 'Content-Type': 'application/x-www-form-urlencoded' },
61
- uriObj: {
62
- protocol: 'http:',
63
- slashes: true,
64
- auth: null,
65
- host: 'petstore.swagger.io',
66
- port: null,
67
- hostname: 'petstore.swagger.io',
68
- hash: null,
69
- search: '',
70
- query: {},
71
- pathname: '/v2/pet',
72
- path: '/v2/pet',
73
- href: 'http://petstore.swagger.io/v2/pet',
74
- },
75
- fullUrl: 'http://petstore.swagger.io/v2/pet',
76
- };
77
- const result = native(sourceWithUrlEncodedText, originalOptions, {
78
- target: 'ruby',
79
- client: 'net::http',
80
- });
81
- expect(result).toMatchSnapshot();
82
- });
83
- it('should handle MULTIPART with text but no params (serializedValue case)', () => {
84
- const sourceWithMultipartText = {
85
- method: 'post',
86
- url: 'http://petstore.swagger.io/v2/pet',
87
- httpVersion: 'HTTP/1.1',
88
- cookies: [],
89
- headers: [{ name: 'Content-Type', value: 'multipart/form-data' }],
90
- queryString: [],
91
- postData: {
92
- mimeType: 'multipart/form-data',
93
- text: '--boundary123\r\nContent-Disposition: form-data; name="field1"\r\n\r\nvalue1\r\n--boundary123\r\nContent-Disposition: form-data; name="field2"\r\n\r\nvalue2\r\n--boundary123--',
94
- params: [],
95
- },
96
- headersSize: 0,
97
- bodySize: 0,
98
- securityOAuth2ExtraCalls: [],
99
- pathParameters: {},
100
- serverVariables: {},
101
- queryObj: {},
102
- headersObj: { 'Content-Type': 'multipart/form-data' },
103
- cookiesObj: {},
104
- allHeaders: { 'Content-Type': 'multipart/form-data' },
105
- uriObj: {
106
- protocol: 'http:',
107
- slashes: true,
108
- auth: null,
109
- host: 'petstore.swagger.io',
110
- port: null,
111
- hostname: 'petstore.swagger.io',
112
- hash: null,
113
- search: '',
114
- query: {},
115
- pathname: '/v2/pet',
116
- path: '/v2/pet',
117
- href: 'http://petstore.swagger.io/v2/pet',
118
- },
119
- fullUrl: 'http://petstore.swagger.io/v2/pet',
120
- };
121
- const result = native(sourceWithMultipartText, originalOptions, {
122
- target: 'ruby',
123
- client: 'net::http',
124
- });
125
- expect(result).toMatchSnapshot();
126
- });
127
- });
128
- });
129
- //# sourceMappingURL=native.test.js.map
@@ -1 +0,0 @@
1
- export { HTTPSnippet } from '../../../index.js';
@@ -1,129 +0,0 @@
1
- export { HTTPSnippet } from '../../../index.js'; // we need to reexport it before to prevent circular ref issue
2
- import curl from '../curl.js';
3
- import { originalOptions, serverVariablesOptions, source } from '../../__mocks__/mock.js';
4
- describe('#code-samples Curl', () => {
5
- describe('handler', () => {
6
- it('returns code API PUT /pet', () => {
7
- const result = curl(source['PUT http://petstore.swagger.io/v2/pet'], originalOptions, {
8
- target: 'shell',
9
- client: 'curl',
10
- });
11
- expect(result).toMatchSnapshot();
12
- });
13
- it('returns code with path parameters reserved (data) and not (petId) /pet/{petId}/uploadImage/{data}', () => {
14
- const result = curl(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage/{data}'], originalOptions, { target: 'shell', client: 'curl' });
15
- expect(result).toMatchSnapshot();
16
- });
17
- it('returns code with one path parameter inside url /pet/{petId}/uploadImage', () => {
18
- const result = curl(source['POST http://petstore.swagger.io/v2/pet/{petId}/uploadImage'], originalOptions, { target: 'shell', client: 'curl' });
19
- expect(result).toMatchSnapshot();
20
- });
21
- it('returns code with path parameter and query /pet/findByStatus/{id}?status=...', () => {
22
- const result = curl(source['GET http://petstore.swagger.io/v2/pet/findByStatus/{id}'], originalOptions, { target: 'shell', client: 'curl' });
23
- expect(result).toMatchSnapshot();
24
- });
25
- it('should generate code with server variables', () => {
26
- const result = curl(source['POST https://{customerId}.saas-app.com:{port}/v2'], serverVariablesOptions, {
27
- target: 'shell',
28
- client: 'curl',
29
- });
30
- expect(result).toMatchSnapshot();
31
- });
32
- it('should generate code with basic auth', () => {
33
- const result = curl(source['POST http://petstore.swagger.io/login'], serverVariablesOptions, {
34
- target: 'shell',
35
- client: 'curl',
36
- });
37
- expect(result).toMatchSnapshot();
38
- });
39
- it('should handle MULTIPART with text but no params (serializedValue case)', () => {
40
- const sourceWithMultipartText = {
41
- method: 'post',
42
- url: 'http://petstore.swagger.io/v2/pet',
43
- httpVersion: 'HTTP/1.1',
44
- cookies: [],
45
- headers: [{ name: 'Content-Type', value: 'multipart/form-data' }],
46
- queryString: [],
47
- postData: {
48
- mimeType: 'multipart/form-data',
49
- text: '--boundary123\r\nContent-Disposition: form-data; name="field1"\r\n\r\nvalue1\r\n--boundary123\r\nContent-Disposition: form-data; name="field2"\r\n\r\nvalue2\r\n--boundary123--',
50
- params: [],
51
- },
52
- headersSize: 0,
53
- bodySize: 0,
54
- securityOAuth2ExtraCalls: [],
55
- pathParameters: {},
56
- serverVariables: {},
57
- queryObj: {},
58
- headersObj: { 'Content-Type': 'multipart/form-data' },
59
- cookiesObj: {},
60
- allHeaders: { 'Content-Type': 'multipart/form-data' },
61
- uriObj: {
62
- protocol: 'http:',
63
- slashes: true,
64
- auth: null,
65
- host: 'petstore.swagger.io',
66
- port: null,
67
- hostname: 'petstore.swagger.io',
68
- hash: null,
69
- search: '',
70
- query: {},
71
- pathname: '/v2/pet',
72
- path: '/v2/pet',
73
- href: 'http://petstore.swagger.io/v2/pet',
74
- },
75
- fullUrl: 'http://petstore.swagger.io/v2/pet',
76
- };
77
- const result = curl(sourceWithMultipartText, originalOptions, {
78
- target: 'shell',
79
- client: 'curl',
80
- });
81
- expect(result).toMatchSnapshot();
82
- });
83
- it('should handle URL_ENCODED with text but no params (serializedValue case)', () => {
84
- const sourceWithUrlEncodedText = {
85
- method: 'post',
86
- url: 'http://petstore.swagger.io/v2/pet',
87
- httpVersion: 'HTTP/1.1',
88
- cookies: [],
89
- headers: [{ name: 'Content-Type', value: 'application/x-www-form-urlencoded' }],
90
- queryString: [],
91
- postData: {
92
- mimeType: 'application/x-www-form-urlencoded',
93
- text: 'name=Museum+Visitor&value=premium&count=5',
94
- params: [],
95
- },
96
- headersSize: 0,
97
- bodySize: 0,
98
- securityOAuth2ExtraCalls: [],
99
- pathParameters: {},
100
- serverVariables: {},
101
- queryObj: {},
102
- headersObj: { 'Content-Type': 'application/x-www-form-urlencoded' },
103
- cookiesObj: {},
104
- allHeaders: { 'Content-Type': 'application/x-www-form-urlencoded' },
105
- uriObj: {
106
- protocol: 'http:',
107
- slashes: true,
108
- auth: null,
109
- host: 'petstore.swagger.io',
110
- port: null,
111
- hostname: 'petstore.swagger.io',
112
- hash: null,
113
- search: '',
114
- query: {},
115
- pathname: '/v2/pet',
116
- path: '/v2/pet',
117
- href: 'http://petstore.swagger.io/v2/pet',
118
- },
119
- fullUrl: 'http://petstore.swagger.io/v2/pet',
120
- };
121
- const result = curl(sourceWithUrlEncodedText, originalOptions, {
122
- target: 'shell',
123
- client: 'curl',
124
- });
125
- expect(result).toMatchSnapshot();
126
- });
127
- });
128
- });
129
- //# sourceMappingURL=curl.test.js.map
@@ -1,234 +0,0 @@
1
- import { vi } from 'vitest';
2
- import { normalizeShowExtensions, normalizeScrollYOffset,
3
- // @community-ignore
4
- normalizeCodeSamples,
5
- // @community-ignore-end
6
- } from '../helpers.js';
7
- import { querySelector } from '../../../utils/dom.js';
8
- import { isNumeric } from '../../../utils/helpers.js';
9
- // @community-ignore
10
- import { Languages } from '../../code-samples/constants.js';
11
- // @community-ignore-end
12
- vi.mock('../../../utils/dom.js');
13
- vi.mock('../../../utils/helpers.js');
14
- const mockQuerySelector = querySelector;
15
- const mockIsNumeric = isNumeric;
16
- describe('helpers', () => {
17
- const originalConsoleWarn = console.warn;
18
- beforeEach(() => {
19
- vi.clearAllMocks();
20
- console.warn = vi.fn();
21
- });
22
- afterAll(() => {
23
- console.warn = originalConsoleWarn;
24
- });
25
- describe('normalizeShowExtensions', () => {
26
- it('should return false for undefined value', () => {
27
- const result = normalizeShowExtensions(undefined);
28
- expect(result).toBe(false);
29
- });
30
- it('should return true for empty string', () => {
31
- const result = normalizeShowExtensions('');
32
- expect(result).toBe(true);
33
- });
34
- it('should return true for string "true"', () => {
35
- const result = normalizeShowExtensions('true');
36
- expect(result).toBe(true);
37
- });
38
- it('should return false for string "false"', () => {
39
- const result = normalizeShowExtensions('false');
40
- expect(result).toBe(false);
41
- });
42
- it('should return array of extensions for comma-separated string', () => {
43
- const result = normalizeShowExtensions('x-extension,y-extension, z-extension');
44
- expect(result).toEqual(['x-extension', 'y-extension', 'z-extension']);
45
- });
46
- it('should trim whitespace from extensions', () => {
47
- const result = normalizeShowExtensions(' x-ext , y-ext ');
48
- expect(result).toEqual(['x-ext', 'y-ext']);
49
- });
50
- it('should return boolean value as-is when not string', () => {
51
- const result = normalizeShowExtensions(true);
52
- expect(result).toBe(true);
53
- });
54
- it('should return array value as-is when not string', () => {
55
- const extensions = ['x-custom', 'y-custom'];
56
- const result = normalizeShowExtensions(extensions);
57
- expect(result).toBe(extensions);
58
- });
59
- it('should handle single extension without comma', () => {
60
- const result = normalizeShowExtensions('x-single-extension');
61
- expect(result).toEqual(['x-single-extension']);
62
- });
63
- it('should handle empty extensions in comma-separated string', () => {
64
- const result = normalizeShowExtensions('x-ext,,y-ext,');
65
- expect(result).toEqual(['x-ext', 'y-ext']);
66
- });
67
- });
68
- describe('normalizeScrollYOffset', () => {
69
- beforeEach(() => {
70
- mockIsNumeric.mockReset();
71
- mockQuerySelector.mockReset();
72
- });
73
- it('should return function that returns element bottom for valid selector', () => {
74
- const mockElement = {
75
- getBoundingClientRect: vi.fn().mockReturnValue({ bottom: 100 }),
76
- };
77
- mockIsNumeric.mockReturnValue(false);
78
- mockQuerySelector.mockReturnValue(mockElement);
79
- const offsetFn = normalizeScrollYOffset('#header');
80
- const result = offsetFn();
81
- expect(mockQuerySelector).toHaveBeenCalledWith('#header');
82
- expect(mockElement.getBoundingClientRect).toHaveBeenCalled();
83
- expect(result).toBe(100);
84
- });
85
- it('should return function that returns 0 and warn for invalid selector', () => {
86
- mockIsNumeric.mockReturnValue(false);
87
- mockQuerySelector.mockReturnValue(null);
88
- const offsetFn = normalizeScrollYOffset('#non-existent');
89
- const result = offsetFn();
90
- expect(console.warn).toHaveBeenCalledWith('scrollYOffset value is a selector to non-existing element. Using offset 0 by default');
91
- expect(result).toBe(0);
92
- });
93
- it('should return function that returns number for numeric value', () => {
94
- const offsetFn = normalizeScrollYOffset(50);
95
- const result = offsetFn();
96
- expect(result).toBe(50);
97
- });
98
- it('should return function that parses numeric string', () => {
99
- mockIsNumeric.mockReturnValue(true);
100
- const offsetFn = normalizeScrollYOffset('75.5');
101
- const result = offsetFn();
102
- expect(result).toBe(75.5);
103
- });
104
- it('should handle function that returns number', () => {
105
- const mockFn = vi.fn().mockReturnValue(120);
106
- const offsetFn = normalizeScrollYOffset(mockFn);
107
- const result = offsetFn();
108
- expect(mockFn).toHaveBeenCalled();
109
- expect(result).toBe(120);
110
- });
111
- it('should warn when function returns non-number', () => {
112
- const mockFn = vi.fn().mockReturnValue('invalid');
113
- const offsetFn = normalizeScrollYOffset(mockFn);
114
- const result = offsetFn();
115
- expect(console.warn).toHaveBeenCalledWith('scrollYOffset should return number but returned value "invalid" of type string');
116
- expect(result).toBe('invalid');
117
- });
118
- it('should return function that returns 0 for invalid value types', () => {
119
- const offsetFn = normalizeScrollYOffset({});
120
- const result = offsetFn();
121
- expect(console.warn).toHaveBeenCalledWith('Wrong value for scrollYOffset ReDoc option: should be string, number or function');
122
- expect(result).toBe(0);
123
- });
124
- it('should return function that returns 0 for undefined', () => {
125
- const offsetFn = normalizeScrollYOffset(undefined);
126
- const result = offsetFn();
127
- expect(result).toBe(0);
128
- });
129
- it('should handle string that is numeric but not call querySelector', () => {
130
- mockIsNumeric.mockReturnValue(true);
131
- const offsetFn = normalizeScrollYOffset('42');
132
- const result = offsetFn();
133
- expect(mockQuerySelector).not.toHaveBeenCalled();
134
- expect(result).toBe(42);
135
- });
136
- it('should handle zero numeric value', () => {
137
- const offsetFn = normalizeScrollYOffset(0);
138
- const result = offsetFn();
139
- expect(result).toBe(0);
140
- });
141
- it('should handle negative numeric value', () => {
142
- const offsetFn = normalizeScrollYOffset(-10);
143
- const result = offsetFn();
144
- expect(result).toBe(-10);
145
- });
146
- });
147
- // @community-ignore
148
- describe('normalizeCodeSamples', () => {
149
- const expectedDefaultLanguages = Object.values(Languages).map((lang) => ({ lang }));
150
- it('should return default structure for undefined value', () => {
151
- const result = normalizeCodeSamples(undefined);
152
- expect(result).toEqual({
153
- languages: expectedDefaultLanguages,
154
- });
155
- });
156
- it('should return default structure for null value', () => {
157
- const result = normalizeCodeSamples(null);
158
- expect(result).toEqual({
159
- languages: expectedDefaultLanguages,
160
- });
161
- });
162
- it('should merge provided config with defaults', () => {
163
- const customConfig = {
164
- skipOptionalParameters: true,
165
- withOAuth2Call: false,
166
- };
167
- const result = normalizeCodeSamples(customConfig);
168
- expect(result).toEqual({
169
- languages: expectedDefaultLanguages,
170
- skipOptionalParameters: true,
171
- withOAuth2Call: false,
172
- });
173
- });
174
- it('should preserve custom languages when provided', () => {
175
- const customLanguages = [
176
- { lang: 'curl' },
177
- { lang: 'JavaScript', label: 'JS' },
178
- ];
179
- const customConfig = {
180
- languages: customLanguages,
181
- };
182
- const result = normalizeCodeSamples(customConfig);
183
- expect(result).toEqual({
184
- languages: customLanguages,
185
- });
186
- });
187
- it('should merge complex config with all properties', () => {
188
- const onSampleTabClickMock = vi.fn();
189
- const customLanguages = [{ lang: 'Python', options: { withComments: true } }];
190
- const customConfig = {
191
- languages: customLanguages,
192
- skipOptionalParameters: true,
193
- withOAuth2Call: true,
194
- onSampleTabClick: onSampleTabClickMock,
195
- };
196
- const result = normalizeCodeSamples(customConfig);
197
- expect(result).toEqual({
198
- languages: customLanguages,
199
- skipOptionalParameters: true,
200
- withOAuth2Call: true,
201
- onSampleTabClick: onSampleTabClickMock,
202
- });
203
- });
204
- it('should handle empty object config', () => {
205
- const result = normalizeCodeSamples({});
206
- expect(result).toEqual({
207
- languages: expectedDefaultLanguages,
208
- });
209
- });
210
- it('should handle config with only boolean properties', () => {
211
- const customConfig = {
212
- skipOptionalParameters: false,
213
- withOAuth2Call: true,
214
- };
215
- const result = normalizeCodeSamples(customConfig);
216
- expect(result).toEqual({
217
- languages: expectedDefaultLanguages,
218
- skipOptionalParameters: false,
219
- withOAuth2Call: true,
220
- });
221
- });
222
- it('should verify default languages structure', () => {
223
- const result = normalizeCodeSamples();
224
- // Verify that each language from the Languages constant is included
225
- const languageValues = Object.values(Languages);
226
- expect(result.languages).toHaveLength(languageValues.length);
227
- languageValues.forEach((lang, index) => {
228
- expect(result.languages[index]).toEqual({ lang });
229
- });
230
- });
231
- });
232
- // @community-ignore-end
233
- });
234
- //# sourceMappingURL=helpers.test.js.map
@@ -1 +0,0 @@
1
- export {};
@@ -1,19 +0,0 @@
1
- import { joinWithSeparator } from '../helpers.js';
2
- describe('History helpers', () => {
3
- describe('joinWithSeparator', () => {
4
- test.each `
5
- base | path | expected
6
- ${'a'} | ${'b'} | ${'a/b'}
7
- ${'a/'} | ${'/b'} | ${'a/b'}
8
- ${'a'} | ${''} | ${'a'}
9
- ${''} | ${'b'} | ${'b'}
10
- ${'a/'} | ${undefined} | ${'a'}
11
- ${undefined} | ${'/b'} | ${'b'}
12
- ${'/a/'} | ${'/b/'} | ${'/a/b/'}
13
- ${'/'} | ${'b'} | ${'/b'}
14
- `('returns $expected when joining "$base" and "$path"', ({ base, path, expected }) => {
15
- expect(joinWithSeparator(base, path)).toBe(expected);
16
- });
17
- });
18
- });
19
- //# sourceMappingURL=helpers.test.js.map