@goast/core 0.4.1 → 0.4.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 (378) hide show
  1. package/esm/src/transform/helpers.d.ts.map +1 -1
  2. package/esm/src/transform/helpers.js +5 -1
  3. package/esm/src/utils/source-builder.d.ts +2 -0
  4. package/esm/src/utils/source-builder.d.ts.map +1 -1
  5. package/esm/src/utils/source-builder.js +7 -1
  6. package/package.json +1 -4
  7. package/script/src/transform/helpers.d.ts.map +1 -1
  8. package/script/src/transform/helpers.js +5 -1
  9. package/script/src/utils/source-builder.d.ts +2 -0
  10. package/script/src/utils/source-builder.d.ts.map +1 -1
  11. package/script/src/utils/source-builder.js +8 -1
  12. package/src/src/transform/helpers.ts +6 -1
  13. package/src/src/utils/source-builder.ts +9 -1
  14. package/esm/_dnt.test_polyfills.d.ts +0 -29
  15. package/esm/_dnt.test_polyfills.d.ts.map +0 -1
  16. package/esm/_dnt.test_polyfills.js +0 -31
  17. package/esm/_dnt.test_shims.d.ts +0 -14
  18. package/esm/_dnt.test_shims.d.ts.map +0 -1
  19. package/esm/_dnt.test_shims.js +0 -69
  20. package/esm/deps/jsr.io/@std/assert/1.0.11/assertion_error.d.ts +0 -26
  21. package/esm/deps/jsr.io/@std/assert/1.0.11/assertion_error.d.ts.map +0 -1
  22. package/esm/deps/jsr.io/@std/assert/1.0.11/assertion_error.js +0 -30
  23. package/esm/deps/jsr.io/@std/assert/1.0.11/false.d.ts +0 -18
  24. package/esm/deps/jsr.io/@std/assert/1.0.11/false.d.ts.map +0 -1
  25. package/esm/deps/jsr.io/@std/assert/1.0.11/false.js +0 -22
  26. package/esm/deps/jsr.io/@std/assert/1.0.11/instance_of.d.ts +0 -23
  27. package/esm/deps/jsr.io/@std/assert/1.0.11/instance_of.d.ts.map +0 -1
  28. package/esm/deps/jsr.io/@std/assert/1.0.11/instance_of.js +0 -53
  29. package/esm/deps/jsr.io/@std/assert/1.0.11/match.d.ts +0 -18
  30. package/esm/deps/jsr.io/@std/assert/1.0.11/match.d.ts.map +0 -1
  31. package/esm/deps/jsr.io/@std/assert/1.0.11/match.js +0 -26
  32. package/esm/deps/jsr.io/@std/assert/1.0.11/not_instance_of.d.ts +0 -20
  33. package/esm/deps/jsr.io/@std/assert/1.0.11/not_instance_of.d.ts.map +0 -1
  34. package/esm/deps/jsr.io/@std/assert/1.0.11/not_instance_of.js +0 -29
  35. package/esm/deps/jsr.io/@std/assert/1.0.11/not_match.d.ts +0 -18
  36. package/esm/deps/jsr.io/@std/assert/1.0.11/not_match.d.ts.map +0 -1
  37. package/esm/deps/jsr.io/@std/assert/1.0.11/not_match.js +0 -26
  38. package/esm/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.d.ts +0 -23
  39. package/esm/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.d.ts.map +0 -1
  40. package/esm/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.js +0 -32
  41. package/esm/deps/jsr.io/@std/assert/1.0.11/strict_equals.d.ts +0 -24
  42. package/esm/deps/jsr.io/@std/assert/1.0.11/strict_equals.d.ts.map +0 -1
  43. package/esm/deps/jsr.io/@std/assert/1.0.11/strict_equals.js +0 -57
  44. package/esm/deps/jsr.io/@std/expect/1.0.12/_assert_equals.d.ts +0 -20
  45. package/esm/deps/jsr.io/@std/expect/1.0.12/_assert_equals.d.ts.map +0 -1
  46. package/esm/deps/jsr.io/@std/expect/1.0.12/_assert_equals.js +0 -29
  47. package/esm/deps/jsr.io/@std/expect/1.0.12/_assert_is_error.d.ts +0 -14
  48. package/esm/deps/jsr.io/@std/expect/1.0.12/_assert_is_error.d.ts.map +0 -1
  49. package/esm/deps/jsr.io/@std/expect/1.0.12/_assert_is_error.js +0 -43
  50. package/esm/deps/jsr.io/@std/expect/1.0.12/_assert_not_equals.d.ts +0 -17
  51. package/esm/deps/jsr.io/@std/expect/1.0.12/_assert_not_equals.d.ts.map +0 -1
  52. package/esm/deps/jsr.io/@std/expect/1.0.12/_assert_not_equals.js +0 -26
  53. package/esm/deps/jsr.io/@std/expect/1.0.12/_assertions.d.ts +0 -4
  54. package/esm/deps/jsr.io/@std/expect/1.0.12/_assertions.d.ts.map +0 -1
  55. package/esm/deps/jsr.io/@std/expect/1.0.12/_assertions.js +0 -13
  56. package/esm/deps/jsr.io/@std/expect/1.0.12/_asymmetric_matchers.d.ts +0 -46
  57. package/esm/deps/jsr.io/@std/expect/1.0.12/_asymmetric_matchers.d.ts.map +0 -1
  58. package/esm/deps/jsr.io/@std/expect/1.0.12/_asymmetric_matchers.js +0 -161
  59. package/esm/deps/jsr.io/@std/expect/1.0.12/_build_message.d.ts +0 -6
  60. package/esm/deps/jsr.io/@std/expect/1.0.12/_build_message.d.ts.map +0 -1
  61. package/esm/deps/jsr.io/@std/expect/1.0.12/_build_message.js +0 -29
  62. package/esm/deps/jsr.io/@std/expect/1.0.12/_custom_equality_tester.d.ts +0 -4
  63. package/esm/deps/jsr.io/@std/expect/1.0.12/_custom_equality_tester.d.ts.map +0 -1
  64. package/esm/deps/jsr.io/@std/expect/1.0.12/_custom_equality_tester.js +0 -11
  65. package/esm/deps/jsr.io/@std/expect/1.0.12/_equal.d.ts +0 -9
  66. package/esm/deps/jsr.io/@std/expect/1.0.12/_equal.d.ts.map +0 -1
  67. package/esm/deps/jsr.io/@std/expect/1.0.12/_equal.js +0 -191
  68. package/esm/deps/jsr.io/@std/expect/1.0.12/_extend.d.ts +0 -4
  69. package/esm/deps/jsr.io/@std/expect/1.0.12/_extend.d.ts.map +0 -1
  70. package/esm/deps/jsr.io/@std/expect/1.0.12/_extend.js +0 -11
  71. package/esm/deps/jsr.io/@std/expect/1.0.12/_inspect_args.d.ts +0 -3
  72. package/esm/deps/jsr.io/@std/expect/1.0.12/_inspect_args.d.ts.map +0 -1
  73. package/esm/deps/jsr.io/@std/expect/1.0.12/_inspect_args.js +0 -12
  74. package/esm/deps/jsr.io/@std/expect/1.0.12/_matchers.d.ts +0 -34
  75. package/esm/deps/jsr.io/@std/expect/1.0.12/_matchers.d.ts.map +0 -1
  76. package/esm/deps/jsr.io/@std/expect/1.0.12/_matchers.js +0 -714
  77. package/esm/deps/jsr.io/@std/expect/1.0.12/_mock_util.d.ts +0 -11
  78. package/esm/deps/jsr.io/@std/expect/1.0.12/_mock_util.d.ts.map +0 -1
  79. package/esm/deps/jsr.io/@std/expect/1.0.12/_mock_util.js +0 -10
  80. package/esm/deps/jsr.io/@std/expect/1.0.12/_serializer.d.ts +0 -4
  81. package/esm/deps/jsr.io/@std/expect/1.0.12/_serializer.d.ts.map +0 -1
  82. package/esm/deps/jsr.io/@std/expect/1.0.12/_serializer.js +0 -10
  83. package/esm/deps/jsr.io/@std/expect/1.0.12/_types.d.ts +0 -843
  84. package/esm/deps/jsr.io/@std/expect/1.0.12/_types.d.ts.map +0 -1
  85. package/esm/deps/jsr.io/@std/expect/1.0.12/_types.js +0 -3
  86. package/esm/deps/jsr.io/@std/expect/1.0.12/_utils.d.ts +0 -9
  87. package/esm/deps/jsr.io/@std/expect/1.0.12/_utils.d.ts.map +0 -1
  88. package/esm/deps/jsr.io/@std/expect/1.0.12/_utils.js +0 -218
  89. package/esm/deps/jsr.io/@std/expect/1.0.12/expect.d.ts +0 -60
  90. package/esm/deps/jsr.io/@std/expect/1.0.12/expect.d.ts.map +0 -1
  91. package/esm/deps/jsr.io/@std/expect/1.0.12/expect.js +0 -523
  92. package/esm/deps/jsr.io/@std/expect/1.0.12/fn.d.ts +0 -29
  93. package/esm/deps/jsr.io/@std/expect/1.0.12/fn.d.ts.map +0 -1
  94. package/esm/deps/jsr.io/@std/expect/1.0.12/fn.js +0 -85
  95. package/esm/deps/jsr.io/@std/expect/1.0.12/mod.d.ts +0 -86
  96. package/esm/deps/jsr.io/@std/expect/1.0.12/mod.d.ts.map +0 -1
  97. package/esm/deps/jsr.io/@std/expect/1.0.12/mod.js +0 -88
  98. package/esm/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts +0 -160
  99. package/esm/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +0 -1
  100. package/esm/deps/jsr.io/@std/internal/1.0.5/assertion_state.js +0 -199
  101. package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts +0 -82
  102. package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +0 -1
  103. package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.js +0 -111
  104. package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts +0 -140
  105. package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +0 -1
  106. package/esm/deps/jsr.io/@std/internal/1.0.5/diff.js +0 -277
  107. package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts +0 -99
  108. package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +0 -1
  109. package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.js +0 -180
  110. package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts +0 -2
  111. package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +0 -1
  112. package/esm/deps/jsr.io/@std/internal/1.0.5/format.js +0 -37
  113. package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts +0 -159
  114. package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +0 -1
  115. package/esm/deps/jsr.io/@std/internal/1.0.5/styles.js +0 -207
  116. package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts +0 -16
  117. package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +0 -1
  118. package/esm/deps/jsr.io/@std/internal/1.0.5/types.js +0 -2
  119. package/esm/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts +0 -79
  120. package/esm/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +0 -1
  121. package/esm/deps/jsr.io/@std/testing/1.0.9/_test_suite.js +0 -380
  122. package/esm/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts +0 -738
  123. package/esm/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +0 -1
  124. package/esm/deps/jsr.io/@std/testing/1.0.9/bdd.js +0 -654
  125. package/esm/src/collect/helpers.test.d.ts +0 -2
  126. package/esm/src/collect/helpers.test.d.ts.map +0 -1
  127. package/esm/src/collect/helpers.test.js +0 -77
  128. package/esm/src/transform/helpers.test.d.ts +0 -2
  129. package/esm/src/transform/helpers.test.d.ts.map +0 -1
  130. package/esm/src/transform/helpers.test.js +0 -265
  131. package/esm/src/utils/action-provider.test.d.ts +0 -2
  132. package/esm/src/utils/action-provider.test.d.ts.map +0 -1
  133. package/esm/src/utils/action-provider.test.js +0 -28
  134. package/esm/src/utils/common.utils.test.d.ts +0 -2
  135. package/esm/src/utils/common.utils.test.d.ts.map +0 -1
  136. package/esm/src/utils/common.utils.test.js +0 -18
  137. package/esm/src/utils/condition.test.d.ts +0 -2
  138. package/esm/src/utils/condition.test.d.ts.map +0 -1
  139. package/esm/src/utils/condition.test.js +0 -31
  140. package/esm/src/utils/endpoint.utils.test.d.ts +0 -2
  141. package/esm/src/utils/endpoint.utils.test.d.ts.map +0 -1
  142. package/esm/src/utils/endpoint.utils.test.js +0 -31
  143. package/esm/src/utils/factory.test.d.ts +0 -2
  144. package/esm/src/utils/factory.test.d.ts.map +0 -1
  145. package/esm/src/utils/factory.test.js +0 -34
  146. package/esm/src/utils/generator.utils.test.d.ts +0 -2
  147. package/esm/src/utils/generator.utils.test.d.ts.map +0 -1
  148. package/esm/src/utils/generator.utils.test.js +0 -13
  149. package/esm/src/utils/object.utils.test.d.ts +0 -2
  150. package/esm/src/utils/object.utils.test.d.ts.map +0 -1
  151. package/esm/src/utils/object.utils.test.js +0 -29
  152. package/esm/src/utils/schema.utils.test.d.ts +0 -2
  153. package/esm/src/utils/schema.utils.test.d.ts.map +0 -1
  154. package/esm/src/utils/schema.utils.test.js +0 -70
  155. package/esm/src/utils/source-builder.test.d.ts +0 -2
  156. package/esm/src/utils/source-builder.test.d.ts.map +0 -1
  157. package/esm/src/utils/source-builder.test.js +0 -505
  158. package/esm/src/utils/string-builder/string-builder.test.d.ts +0 -2
  159. package/esm/src/utils/string-builder/string-builder.test.d.ts.map +0 -1
  160. package/esm/src/utils/string-builder/string-builder.test.js +0 -163
  161. package/esm/src/utils/string.utils.test.d.ts +0 -2
  162. package/esm/src/utils/string.utils.test.d.ts.map +0 -1
  163. package/esm/src/utils/string.utils.test.js +0 -528
  164. package/esm/tests/openapi.test.d.ts +0 -2
  165. package/esm/tests/openapi.test.d.ts.map +0 -1
  166. package/esm/tests/openapi.test.js +0 -33
  167. package/esm/tests/schema-factory.d.ts +0 -42
  168. package/esm/tests/schema-factory.d.ts.map +0 -1
  169. package/esm/tests/schema-factory.js +0 -138
  170. package/script/_dnt.test_polyfills.d.ts +0 -29
  171. package/script/_dnt.test_polyfills.d.ts.map +0 -1
  172. package/script/_dnt.test_polyfills.js +0 -32
  173. package/script/_dnt.test_shims.d.ts +0 -14
  174. package/script/_dnt.test_shims.d.ts.map +0 -1
  175. package/script/_dnt.test_shims.js +0 -79
  176. package/script/deps/jsr.io/@std/assert/1.0.11/assertion_error.d.ts +0 -26
  177. package/script/deps/jsr.io/@std/assert/1.0.11/assertion_error.d.ts.map +0 -1
  178. package/script/deps/jsr.io/@std/assert/1.0.11/assertion_error.js +0 -34
  179. package/script/deps/jsr.io/@std/assert/1.0.11/false.d.ts +0 -18
  180. package/script/deps/jsr.io/@std/assert/1.0.11/false.d.ts.map +0 -1
  181. package/script/deps/jsr.io/@std/assert/1.0.11/false.js +0 -25
  182. package/script/deps/jsr.io/@std/assert/1.0.11/instance_of.d.ts +0 -23
  183. package/script/deps/jsr.io/@std/assert/1.0.11/instance_of.d.ts.map +0 -1
  184. package/script/deps/jsr.io/@std/assert/1.0.11/instance_of.js +0 -56
  185. package/script/deps/jsr.io/@std/assert/1.0.11/match.d.ts +0 -18
  186. package/script/deps/jsr.io/@std/assert/1.0.11/match.d.ts.map +0 -1
  187. package/script/deps/jsr.io/@std/assert/1.0.11/match.js +0 -29
  188. package/script/deps/jsr.io/@std/assert/1.0.11/not_instance_of.d.ts +0 -20
  189. package/script/deps/jsr.io/@std/assert/1.0.11/not_instance_of.d.ts.map +0 -1
  190. package/script/deps/jsr.io/@std/assert/1.0.11/not_instance_of.js +0 -32
  191. package/script/deps/jsr.io/@std/assert/1.0.11/not_match.d.ts +0 -18
  192. package/script/deps/jsr.io/@std/assert/1.0.11/not_match.d.ts.map +0 -1
  193. package/script/deps/jsr.io/@std/assert/1.0.11/not_match.js +0 -29
  194. package/script/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.d.ts +0 -23
  195. package/script/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.d.ts.map +0 -1
  196. package/script/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.js +0 -35
  197. package/script/deps/jsr.io/@std/assert/1.0.11/strict_equals.d.ts +0 -24
  198. package/script/deps/jsr.io/@std/assert/1.0.11/strict_equals.d.ts.map +0 -1
  199. package/script/deps/jsr.io/@std/assert/1.0.11/strict_equals.js +0 -60
  200. package/script/deps/jsr.io/@std/expect/1.0.12/_assert_equals.d.ts +0 -20
  201. package/script/deps/jsr.io/@std/expect/1.0.12/_assert_equals.d.ts.map +0 -1
  202. package/script/deps/jsr.io/@std/expect/1.0.12/_assert_equals.js +0 -32
  203. package/script/deps/jsr.io/@std/expect/1.0.12/_assert_is_error.d.ts +0 -14
  204. package/script/deps/jsr.io/@std/expect/1.0.12/_assert_is_error.d.ts.map +0 -1
  205. package/script/deps/jsr.io/@std/expect/1.0.12/_assert_is_error.js +0 -46
  206. package/script/deps/jsr.io/@std/expect/1.0.12/_assert_not_equals.d.ts +0 -17
  207. package/script/deps/jsr.io/@std/expect/1.0.12/_assert_not_equals.d.ts.map +0 -1
  208. package/script/deps/jsr.io/@std/expect/1.0.12/_assert_not_equals.js +0 -29
  209. package/script/deps/jsr.io/@std/expect/1.0.12/_assertions.d.ts +0 -4
  210. package/script/deps/jsr.io/@std/expect/1.0.12/_assertions.d.ts.map +0 -1
  211. package/script/deps/jsr.io/@std/expect/1.0.12/_assertions.js +0 -18
  212. package/script/deps/jsr.io/@std/expect/1.0.12/_asymmetric_matchers.d.ts +0 -46
  213. package/script/deps/jsr.io/@std/expect/1.0.12/_asymmetric_matchers.d.ts.map +0 -1
  214. package/script/deps/jsr.io/@std/expect/1.0.12/_asymmetric_matchers.js +0 -183
  215. package/script/deps/jsr.io/@std/expect/1.0.12/_build_message.d.ts +0 -6
  216. package/script/deps/jsr.io/@std/expect/1.0.12/_build_message.d.ts.map +0 -1
  217. package/script/deps/jsr.io/@std/expect/1.0.12/_build_message.js +0 -33
  218. package/script/deps/jsr.io/@std/expect/1.0.12/_custom_equality_tester.d.ts +0 -4
  219. package/script/deps/jsr.io/@std/expect/1.0.12/_custom_equality_tester.d.ts.map +0 -1
  220. package/script/deps/jsr.io/@std/expect/1.0.12/_custom_equality_tester.js +0 -15
  221. package/script/deps/jsr.io/@std/expect/1.0.12/_equal.d.ts +0 -9
  222. package/script/deps/jsr.io/@std/expect/1.0.12/_equal.d.ts.map +0 -1
  223. package/script/deps/jsr.io/@std/expect/1.0.12/_equal.js +0 -194
  224. package/script/deps/jsr.io/@std/expect/1.0.12/_extend.d.ts +0 -4
  225. package/script/deps/jsr.io/@std/expect/1.0.12/_extend.d.ts.map +0 -1
  226. package/script/deps/jsr.io/@std/expect/1.0.12/_extend.js +0 -15
  227. package/script/deps/jsr.io/@std/expect/1.0.12/_inspect_args.d.ts +0 -3
  228. package/script/deps/jsr.io/@std/expect/1.0.12/_inspect_args.d.ts.map +0 -1
  229. package/script/deps/jsr.io/@std/expect/1.0.12/_inspect_args.js +0 -17
  230. package/script/deps/jsr.io/@std/expect/1.0.12/_matchers.d.ts +0 -34
  231. package/script/deps/jsr.io/@std/expect/1.0.12/_matchers.d.ts.map +0 -1
  232. package/script/deps/jsr.io/@std/expect/1.0.12/_matchers.js +0 -748
  233. package/script/deps/jsr.io/@std/expect/1.0.12/_mock_util.d.ts +0 -11
  234. package/script/deps/jsr.io/@std/expect/1.0.12/_mock_util.d.ts.map +0 -1
  235. package/script/deps/jsr.io/@std/expect/1.0.12/_mock_util.js +0 -14
  236. package/script/deps/jsr.io/@std/expect/1.0.12/_serializer.d.ts +0 -4
  237. package/script/deps/jsr.io/@std/expect/1.0.12/_serializer.d.ts.map +0 -1
  238. package/script/deps/jsr.io/@std/expect/1.0.12/_serializer.js +0 -14
  239. package/script/deps/jsr.io/@std/expect/1.0.12/_types.d.ts +0 -843
  240. package/script/deps/jsr.io/@std/expect/1.0.12/_types.d.ts.map +0 -1
  241. package/script/deps/jsr.io/@std/expect/1.0.12/_types.js +0 -4
  242. package/script/deps/jsr.io/@std/expect/1.0.12/_utils.d.ts +0 -9
  243. package/script/deps/jsr.io/@std/expect/1.0.12/_utils.d.ts.map +0 -1
  244. package/script/deps/jsr.io/@std/expect/1.0.12/_utils.js +0 -226
  245. package/script/deps/jsr.io/@std/expect/1.0.12/expect.d.ts +0 -60
  246. package/script/deps/jsr.io/@std/expect/1.0.12/expect.d.ts.map +0 -1
  247. package/script/deps/jsr.io/@std/expect/1.0.12/expect.js +0 -527
  248. package/script/deps/jsr.io/@std/expect/1.0.12/fn.d.ts +0 -29
  249. package/script/deps/jsr.io/@std/expect/1.0.12/fn.d.ts.map +0 -1
  250. package/script/deps/jsr.io/@std/expect/1.0.12/fn.js +0 -88
  251. package/script/deps/jsr.io/@std/expect/1.0.12/mod.d.ts +0 -86
  252. package/script/deps/jsr.io/@std/expect/1.0.12/mod.d.ts.map +0 -1
  253. package/script/deps/jsr.io/@std/expect/1.0.12/mod.js +0 -91
  254. package/script/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts +0 -160
  255. package/script/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +0 -1
  256. package/script/deps/jsr.io/@std/internal/1.0.5/assertion_state.js +0 -204
  257. package/script/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts +0 -82
  258. package/script/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +0 -1
  259. package/script/deps/jsr.io/@std/internal/1.0.5/build_message.js +0 -116
  260. package/script/deps/jsr.io/@std/internal/1.0.5/diff.d.ts +0 -140
  261. package/script/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +0 -1
  262. package/script/deps/jsr.io/@std/internal/1.0.5/diff.js +0 -284
  263. package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts +0 -99
  264. package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +0 -1
  265. package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.js +0 -186
  266. package/script/deps/jsr.io/@std/internal/1.0.5/format.d.ts +0 -2
  267. package/script/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +0 -1
  268. package/script/deps/jsr.io/@std/internal/1.0.5/format.js +0 -41
  269. package/script/deps/jsr.io/@std/internal/1.0.5/styles.d.ts +0 -159
  270. package/script/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +0 -1
  271. package/script/deps/jsr.io/@std/internal/1.0.5/styles.js +0 -220
  272. package/script/deps/jsr.io/@std/internal/1.0.5/types.d.ts +0 -16
  273. package/script/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +0 -1
  274. package/script/deps/jsr.io/@std/internal/1.0.5/types.js +0 -3
  275. package/script/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts +0 -79
  276. package/script/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +0 -1
  277. package/script/deps/jsr.io/@std/testing/1.0.9/_test_suite.js +0 -385
  278. package/script/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts +0 -738
  279. package/script/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +0 -1
  280. package/script/deps/jsr.io/@std/testing/1.0.9/bdd.js +0 -665
  281. package/script/src/collect/helpers.test.d.ts +0 -2
  282. package/script/src/collect/helpers.test.d.ts.map +0 -1
  283. package/script/src/collect/helpers.test.js +0 -79
  284. package/script/src/transform/helpers.test.d.ts +0 -2
  285. package/script/src/transform/helpers.test.d.ts.map +0 -1
  286. package/script/src/transform/helpers.test.js +0 -267
  287. package/script/src/utils/action-provider.test.d.ts +0 -2
  288. package/script/src/utils/action-provider.test.d.ts.map +0 -1
  289. package/script/src/utils/action-provider.test.js +0 -30
  290. package/script/src/utils/common.utils.test.d.ts +0 -2
  291. package/script/src/utils/common.utils.test.d.ts.map +0 -1
  292. package/script/src/utils/common.utils.test.js +0 -20
  293. package/script/src/utils/condition.test.d.ts +0 -2
  294. package/script/src/utils/condition.test.d.ts.map +0 -1
  295. package/script/src/utils/condition.test.js +0 -33
  296. package/script/src/utils/endpoint.utils.test.d.ts +0 -2
  297. package/script/src/utils/endpoint.utils.test.d.ts.map +0 -1
  298. package/script/src/utils/endpoint.utils.test.js +0 -33
  299. package/script/src/utils/factory.test.d.ts +0 -2
  300. package/script/src/utils/factory.test.d.ts.map +0 -1
  301. package/script/src/utils/factory.test.js +0 -36
  302. package/script/src/utils/generator.utils.test.d.ts +0 -2
  303. package/script/src/utils/generator.utils.test.d.ts.map +0 -1
  304. package/script/src/utils/generator.utils.test.js +0 -15
  305. package/script/src/utils/object.utils.test.d.ts +0 -2
  306. package/script/src/utils/object.utils.test.d.ts.map +0 -1
  307. package/script/src/utils/object.utils.test.js +0 -31
  308. package/script/src/utils/schema.utils.test.d.ts +0 -2
  309. package/script/src/utils/schema.utils.test.d.ts.map +0 -1
  310. package/script/src/utils/schema.utils.test.js +0 -72
  311. package/script/src/utils/source-builder.test.d.ts +0 -2
  312. package/script/src/utils/source-builder.test.d.ts.map +0 -1
  313. package/script/src/utils/source-builder.test.js +0 -507
  314. package/script/src/utils/string-builder/string-builder.test.d.ts +0 -2
  315. package/script/src/utils/string-builder/string-builder.test.d.ts.map +0 -1
  316. package/script/src/utils/string-builder/string-builder.test.js +0 -165
  317. package/script/src/utils/string.utils.test.d.ts +0 -2
  318. package/script/src/utils/string.utils.test.d.ts.map +0 -1
  319. package/script/src/utils/string.utils.test.js +0 -530
  320. package/script/tests/openapi.test.d.ts +0 -2
  321. package/script/tests/openapi.test.d.ts.map +0 -1
  322. package/script/tests/openapi.test.js +0 -35
  323. package/script/tests/schema-factory.d.ts +0 -42
  324. package/script/tests/schema-factory.d.ts.map +0 -1
  325. package/script/tests/schema-factory.js +0 -162
  326. package/src/_dnt.test_polyfills.ts +0 -70
  327. package/src/_dnt.test_shims.ts +0 -72
  328. package/src/deps/jsr.io/@std/assert/1.0.11/assertion_error.ts +0 -31
  329. package/src/deps/jsr.io/@std/assert/1.0.11/false.ts +0 -26
  330. package/src/deps/jsr.io/@std/assert/1.0.11/instance_of.ts +0 -64
  331. package/src/deps/jsr.io/@std/assert/1.0.11/match.ts +0 -30
  332. package/src/deps/jsr.io/@std/assert/1.0.11/not_instance_of.ts +0 -33
  333. package/src/deps/jsr.io/@std/assert/1.0.11/not_match.ts +0 -30
  334. package/src/deps/jsr.io/@std/assert/1.0.11/not_strict_equals.ts +0 -42
  335. package/src/deps/jsr.io/@std/assert/1.0.11/strict_equals.ts +0 -67
  336. package/src/deps/jsr.io/@std/expect/1.0.12/_assert_equals.ts +0 -38
  337. package/src/deps/jsr.io/@std/expect/1.0.12/_assert_is_error.ts +0 -54
  338. package/src/deps/jsr.io/@std/expect/1.0.12/_assert_not_equals.ts +0 -35
  339. package/src/deps/jsr.io/@std/expect/1.0.12/_assertions.ts +0 -18
  340. package/src/deps/jsr.io/@std/expect/1.0.12/_asymmetric_matchers.ts +0 -198
  341. package/src/deps/jsr.io/@std/expect/1.0.12/_build_message.ts +0 -51
  342. package/src/deps/jsr.io/@std/expect/1.0.12/_custom_equality_tester.ts +0 -19
  343. package/src/deps/jsr.io/@std/expect/1.0.12/_equal.ts +0 -230
  344. package/src/deps/jsr.io/@std/expect/1.0.12/_extend.ts +0 -16
  345. package/src/deps/jsr.io/@std/expect/1.0.12/_inspect_args.ts +0 -15
  346. package/src/deps/jsr.io/@std/expect/1.0.12/_matchers.ts +0 -1028
  347. package/src/deps/jsr.io/@std/expect/1.0.12/_mock_util.ts +0 -22
  348. package/src/deps/jsr.io/@std/expect/1.0.12/_serializer.ts +0 -15
  349. package/src/deps/jsr.io/@std/expect/1.0.12/_types.ts +0 -923
  350. package/src/deps/jsr.io/@std/expect/1.0.12/_utils.ts +0 -283
  351. package/src/deps/jsr.io/@std/expect/1.0.12/expect.ts +0 -620
  352. package/src/deps/jsr.io/@std/expect/1.0.12/fn.ts +0 -91
  353. package/src/deps/jsr.io/@std/expect/1.0.12/mod.ts +0 -89
  354. package/src/deps/jsr.io/@std/internal/1.0.5/assertion_state.ts +0 -214
  355. package/src/deps/jsr.io/@std/internal/1.0.5/build_message.ts +0 -134
  356. package/src/deps/jsr.io/@std/internal/1.0.5/diff.ts +0 -317
  357. package/src/deps/jsr.io/@std/internal/1.0.5/diff_str.ts +0 -204
  358. package/src/deps/jsr.io/@std/internal/1.0.5/format.ts +0 -39
  359. package/src/deps/jsr.io/@std/internal/1.0.5/styles.ts +0 -233
  360. package/src/deps/jsr.io/@std/internal/1.0.5/types.ts +0 -18
  361. package/src/deps/jsr.io/@std/testing/1.0.9/_test_suite.ts +0 -448
  362. package/src/deps/jsr.io/@std/testing/1.0.9/bdd.ts +0 -1288
  363. package/src/src/collect/helpers.test.ts +0 -91
  364. package/src/src/transform/helpers.test.ts +0 -316
  365. package/src/src/utils/action-provider.test.ts +0 -32
  366. package/src/src/utils/common.utils.test.ts +0 -22
  367. package/src/src/utils/condition.test.ts +0 -36
  368. package/src/src/utils/endpoint.utils.test.ts +0 -36
  369. package/src/src/utils/factory.test.ts +0 -31
  370. package/src/src/utils/generator.utils.test.ts +0 -16
  371. package/src/src/utils/object.utils.test.ts +0 -33
  372. package/src/src/utils/schema.utils.test.ts +0 -88
  373. package/src/src/utils/source-builder.test.ts +0 -657
  374. package/src/src/utils/string-builder/string-builder.test.ts +0 -188
  375. package/src/src/utils/string.utils.test.ts +0 -691
  376. package/src/tests/openapi.test.ts +0 -50
  377. package/src/tests/schema-factory.ts +0 -185
  378. package/test_runner.js +0 -221
@@ -1,657 +0,0 @@
1
- import "../../_dnt.test_polyfills.js";
2
- import { EOL } from 'node:os';
3
-
4
- import { expect } from '../../deps/jsr.io/@std/expect/1.0.12/mod.js';
5
- import { beforeEach, describe, it } from '../../deps/jsr.io/@std/testing/1.0.9/bdd.js';
6
-
7
- import { builderTemplate, SourceBuilder, type SourceBuilderOptions } from './source-builder.js';
8
- import { appendValueGroup } from './string-builder/utils.js';
9
-
10
- describe('SourceBuilder', () => {
11
- let sb: SourceBuilder;
12
-
13
- beforeEach(() => {
14
- sb = new SourceBuilder();
15
- });
16
-
17
- describe('constructor', () => {
18
- it('should initialize with default options', () => {
19
- const options = sb.options;
20
- expect(options.indent).toEqual({ type: 'spaces', count: 2 });
21
- expect(options.newLine).toBe(EOL);
22
- });
23
- });
24
-
25
- describe('fromString', () => {
26
- it('should create a new instance of SourceBuilder with the given string', () => {
27
- const str = 'test string';
28
- const sb = SourceBuilder.fromString(str);
29
- expect(sb.toString()).toEqual(str);
30
- });
31
-
32
- it('should create a new instance of SourceBuilder with the given string and options', () => {
33
- const str = 'test string';
34
- const options: Partial<SourceBuilderOptions> = {
35
- indent: { type: 'tabs' },
36
- newLine: '\n-',
37
- };
38
- const sb = SourceBuilder.fromString(str, options);
39
- expect(sb.toString()).toEqual(str);
40
- expect(sb.options).toEqual(expect.objectContaining(options));
41
- });
42
- });
43
-
44
- describe('build', () => {
45
- it('should build a string using a callback function that receives a `SourceBuilder` instance', () => {
46
- const buildAction = (builder: SourceBuilder) => {
47
- builder.append('hello');
48
- builder.append('world');
49
- };
50
- const result = SourceBuilder.build(buildAction);
51
- expect(result).toEqual('helloworld');
52
- });
53
-
54
- it('should build a string using a callback function that receives a `SourceBuilder` instance and options', () => {
55
- const buildAction = (builder: SourceBuilder) => {
56
- builder.appendLine('hello');
57
- builder.indent((b) => b.append('world'));
58
- };
59
- const options: Partial<SourceBuilderOptions> = {
60
- indent: { type: 'spaces', count: 4 },
61
- newLine: '\r\n\t',
62
- };
63
- const result = SourceBuilder.build(buildAction, options);
64
- expect(result).toEqual(`hello${options.newLine} world`);
65
- });
66
- });
67
-
68
- describe('append', () => {
69
- it('should handle consecutive line breaks', () => {
70
- sb.append('line1', EOL, EOL, EOL, 'line2');
71
- expect(sb.toString()).toBe(`line1${EOL}${EOL}${EOL}line2`);
72
- });
73
-
74
- it('should handle mixed line breaks', () => {
75
- sb.append('line1\r\n', '\n', 'line2\r', '\r', 'line3\n', 'line4');
76
- expect(sb.toString()).toBe(`line1${EOL}${EOL}line2line3${EOL}line4`);
77
- });
78
-
79
- it('should handle strings with special chars', () => {
80
- sb.append('line1 {', EOL, 'line2}');
81
- expect(sb.toString()).toBe(`line1 {${EOL}line2}`);
82
- });
83
-
84
- it('should handle long strings without line breaks', () => {
85
- sb.append('This is a long string without any line breaks.');
86
- expect(sb.toString()).toBe('This is a long string without any line breaks.');
87
- });
88
-
89
- it('should handle multiple calls', () => {
90
- sb.append('line1', EOL);
91
- sb.append('line2', EOL);
92
- sb.append('line3', EOL);
93
- expect(sb.toString()).toBe(`line1${EOL}line2${EOL}line3${EOL}`);
94
- });
95
-
96
- it('should handle empty input', () => {
97
- sb.append('', '', '', EOL, '', '');
98
- expect(sb.toString()).toBe(EOL);
99
- });
100
-
101
- it('should apply the provided builder function to the source builder', () => {
102
- const builder = new SourceBuilder().append((b) => b.append('foo'));
103
- expect(builder.toString()).toBe('foo');
104
- });
105
- });
106
-
107
- describe('appendIf', () => {
108
- it('should append the string when condition is true', () => {
109
- sb.appendIf(true, 'line1', EOL);
110
- expect(sb.toString()).toBe(`line1${EOL}`);
111
- });
112
-
113
- it('should not append the string when condition is false', () => {
114
- sb.appendIf(false, 'line1', EOL);
115
- expect(sb.toString()).toBe('');
116
- });
117
-
118
- it('should append the string when condition is a function returning true', () => {
119
- sb.appendIf(() => true, 'line1', EOL);
120
- expect(sb.toString()).toBe(`line1${EOL}`);
121
- });
122
-
123
- it('should not append the string when condition is a function returning false', () => {
124
- sb.appendIf(() => false, 'line1', EOL);
125
- expect(sb.toString()).toBe('');
126
- });
127
- });
128
-
129
- describe('appendLineIf', () => {
130
- it('should append the string when condition is true', () => {
131
- sb.appendLineIf(true, 'line1');
132
- expect(sb.toString()).toBe(`line1${EOL}`);
133
- });
134
-
135
- it('should not append the string when condition is false', () => {
136
- sb.appendLineIf(false, 'line1');
137
- expect(sb.toString()).toBe('');
138
- });
139
-
140
- it('should append the string when condition is a function returning true', () => {
141
- sb.appendLineIf(() => true, 'line1');
142
- expect(sb.toString()).toBe(`line1${EOL}`);
143
- });
144
-
145
- it('should not append the string when condition is a function returning false', () => {
146
- sb.appendLineIf(() => false, 'line1');
147
- expect(sb.toString()).toBe('');
148
- });
149
- });
150
-
151
- describe('prependIf', () => {
152
- it('should prepend the specified value if the condition is true', () => {
153
- const builder = new SourceBuilder().append('bar').prependIf(true, 'foo');
154
- expect(builder.toString()).toBe('foobar');
155
- });
156
-
157
- it('should not prepend the specified value if the condition is false', () => {
158
- const builder = new SourceBuilder().append('bar').prependIf(false, 'foo');
159
- expect(builder.toString()).toBe('bar');
160
- });
161
- });
162
-
163
- describe('prependLineIf', () => {
164
- it('should prepend the specified value with a line terminator if the condition is true', () => {
165
- const builder = new SourceBuilder().append('bar').prependLineIf(true, 'foo');
166
- expect(builder.toString()).toBe(`foo${EOL}bar`);
167
- });
168
-
169
- it('should not prepend the specified value if the condition is false', () => {
170
- const builder = new SourceBuilder().append('bar').prependLineIf(false, 'foo');
171
- expect(builder.toString()).toBe('bar');
172
- });
173
- });
174
-
175
- describe('appendWithLinePrefix', () => {
176
- it('should append the specified values with the specified line prefix', () => {
177
- const builder = new SourceBuilder().appendWithLinePrefix('// ', 'foo', 'bar');
178
- expect(builder.toString()).toBe('// foobar');
179
- });
180
-
181
- it('should handle null and undefined values', () => {
182
- const builder = new SourceBuilder().appendWithLinePrefix('// ', 'foo', null, undefined, 'bar');
183
- expect(builder.toString()).toBe('// foobar');
184
- });
185
-
186
- it('should apply the provided builder function with the specified line prefix', () => {
187
- const builder = new SourceBuilder().appendWithLinePrefix('// ', (b) => {
188
- b.appendLine('foo');
189
- b.appendLine('bar');
190
- });
191
- expect(builder.toString()).toBe(`// foo${EOL}// bar${EOL}`);
192
- });
193
-
194
- it('should apply the provided builder function with the specified line prefix and indentation', () => {
195
- const builder = new SourceBuilder().indent((b) =>
196
- b.appendWithLinePrefix('// ', (b) => {
197
- b.appendLine('foo');
198
- b.appendLine('bar');
199
- })
200
- );
201
- expect(builder.toString()).toBe(` // foo${EOL} // bar${EOL}`);
202
- });
203
-
204
- it('should write indents after the prefix', () => {
205
- const builder = new SourceBuilder().indent((b) =>
206
- b.appendWithLinePrefix('// ', (b) => {
207
- b.indent((b) => b.appendLine('foo'));
208
- })
209
- );
210
- expect(builder.toString()).toBe(` // foo${EOL}`);
211
- });
212
- });
213
-
214
- describe('appendLineWithLinePrefix', () => {
215
- it('should append the specified values as a new line with the specified line prefix', () => {
216
- const builder = new SourceBuilder().appendLineWithLinePrefix('// ', 'foo', 'bar');
217
- expect(builder.toString()).toBe('// foobar' + EOL);
218
- });
219
-
220
- it('should handle null and undefined values', () => {
221
- const builder = new SourceBuilder().appendLineWithLinePrefix('// ', 'foo', null, undefined, 'bar');
222
- expect(builder.toString()).toBe('// foobar' + EOL);
223
- });
224
- });
225
-
226
- describe('ensurePreviousLineEmpty', () => {
227
- it('should insert one empty line when current line is empty', () => {
228
- sb.append('line1', EOL, 'line2', EOL);
229
- sb.ensurePreviousLineEmpty();
230
- expect(sb.toString()).toBe(`line1${EOL}line2${EOL}${EOL}`);
231
- });
232
-
233
- it('should insert two empty lines when current line is not empty', () => {
234
- sb.append('line1', EOL, 'line2');
235
- sb.ensurePreviousLineEmpty();
236
- expect(sb.toString()).toBe(`line1${EOL}line2${EOL}${EOL}`);
237
- });
238
-
239
- it('should not insert an empty line when already empty', () => {
240
- sb.append('line1', EOL, 'line2', EOL, EOL);
241
- sb.ensurePreviousLineEmpty();
242
- expect(sb.toString()).toBe(`line1${EOL}line2${EOL}${EOL}`);
243
- });
244
- });
245
-
246
- describe('ensureCurrentLineEmpty', () => {
247
- it('should insert an empty line', () => {
248
- sb.append('line1', EOL, 'line2');
249
- sb.ensureCurrentLineEmpty();
250
- expect(sb.toString()).toBe(`line1${EOL}line2${EOL}`);
251
- });
252
-
253
- it('should not insert an empty line when already empty', () => {
254
- sb.append('line1', EOL, 'line2', EOL);
255
- sb.ensureCurrentLineEmpty();
256
- expect(sb.toString()).toBe(`line1${EOL}line2${EOL}`);
257
- });
258
- });
259
-
260
- describe('pretendPreviousLineEmpty', () => {
261
- it('should pretend the previous line is empty', () => {
262
- sb.appendLine('line1').append('a').pretendPreviousLineEmpty().ensurePreviousLineEmpty().append('b');
263
- expect(sb.toString()).toBe(`line1${EOL}ab`);
264
- });
265
- });
266
-
267
- describe('pretendCurrentLineEmpty', () => {
268
- it('should pretend the previous line is empty', () => {
269
- sb.append('a').pretendCurrentLineEmpty().ensureCurrentLineEmpty().append('b');
270
- expect(sb.toString()).toBe(`ab`);
271
- });
272
- });
273
-
274
- describe('if', () => {
275
- it('should append the content when condition is true', () => {
276
- sb.if(true, (x) => x.append('stuff'));
277
- expect(sb.toString()).toBe(`stuff`);
278
- });
279
-
280
- it('should not append the content when condition is false', () => {
281
- sb.if(false, (x) => x.append('stuff'));
282
- expect(sb.toString()).toBe(``);
283
- });
284
-
285
- it('should append the content when condition function returns true', () => {
286
- sb.if(
287
- () => true,
288
- (x) => x.append('stuff'),
289
- );
290
- expect(sb.toString()).toBe(`stuff`);
291
- });
292
-
293
- it('should not append the content when condition function returns false', () => {
294
- sb.if(
295
- () => false,
296
- (x) => x.append('stuff'),
297
- );
298
- expect(sb.toString()).toBe(``);
299
- });
300
-
301
- it('should append the correct content when condition is true', () => {
302
- sb.if(
303
- true,
304
- (x) => x.append('stuff'),
305
- (x) => x.append('other stuff'),
306
- );
307
- expect(sb.toString()).toBe(`stuff`);
308
- });
309
-
310
- it('should append the correct content when condition is false', () => {
311
- sb.if(
312
- false,
313
- (x) => x.append('stuff'),
314
- (x) => x.append('other stuff'),
315
- );
316
- expect(sb.toString()).toBe(`other stuff`);
317
- });
318
-
319
- it('should append the correct content when condition function returns true', () => {
320
- sb.if(
321
- () => true,
322
- (x) => x.append('stuff'),
323
- (x) => x.append('other stuff'),
324
- );
325
- expect(sb.toString()).toBe(`stuff`);
326
- });
327
-
328
- it('should append the correct content when condition function returns false', () => {
329
- sb.if(
330
- () => false,
331
- (x) => x.append('stuff'),
332
- (x) => x.append('other stuff'),
333
- );
334
- expect(sb.toString()).toBe(`other stuff`);
335
- });
336
- });
337
-
338
- describe('indent', () => {
339
- it('should correctly indent the content (fn)', () => {
340
- sb.append('line1', EOL);
341
- sb.indent((innerSb) => {
342
- innerSb.append('line2', EOL);
343
- });
344
- sb.append('line3', EOL);
345
- expect(sb.toString()).toBe(`line1${EOL} line2${EOL}line3${EOL}`);
346
- });
347
-
348
- it('should correctly indent the content (string)', () => {
349
- sb.append('line1', EOL);
350
- sb.indent('line2\n');
351
- sb.append('line3', EOL);
352
- expect(sb.toString()).toBe(`line1${EOL} line2${EOL}line3${EOL}`);
353
- });
354
-
355
- it('should correctly handle nested indentation', () => {
356
- sb.indent((innerSb1) => {
357
- innerSb1.append('line1', EOL);
358
- innerSb1.indent((innerSb2) => {
359
- innerSb2.append('line2', EOL);
360
- });
361
- innerSb1.append('line3', EOL);
362
- });
363
- expect(sb.toString()).toBe(` line1${EOL} line2${EOL} line3${EOL}`);
364
- });
365
-
366
- it('should correctly handle multiline strings (fn)', () => {
367
- sb.indent((innerSb) => {
368
- innerSb.append(`line1${EOL}line2`, EOL);
369
- });
370
- expect(sb.toString()).toBe(` line1${EOL} line2${EOL}`);
371
- });
372
-
373
- it('should correctly handle multiline strings (string)', () => {
374
- sb.indent('line1\nline2\n');
375
- expect(sb.toString()).toBe(` line1${EOL} line2${EOL}`);
376
- });
377
-
378
- it('should nest indentations', () => {
379
- sb.appendLine('(')
380
- .indent((b1) => {
381
- b1.appendLine('(')
382
- .indent((b2) => {
383
- b2.appendLine('line1');
384
- })
385
- .appendLine(')');
386
- })
387
- .appendLine(')');
388
- expect(sb.toString()).toBe(`(${EOL} (${EOL} line1${EOL} )${EOL})${EOL}`);
389
- });
390
- });
391
-
392
- describe('indentIf', () => {
393
- it('should indent when condition is true', () => {
394
- sb.indentIf(true, (x) => x.append('stuff'));
395
- expect(sb.toString()).toBe(` stuff`);
396
- });
397
-
398
- it('should not indent when condition is false', () => {
399
- sb.indentIf(false, (x) => x.append('stuff'));
400
- expect(sb.toString()).toBe(`stuff`);
401
- });
402
-
403
- it('should indent when condition function returns true', () => {
404
- sb.indentIf(
405
- () => true,
406
- (x) => x.append('stuff'),
407
- );
408
- expect(sb.toString()).toBe(` stuff`);
409
- });
410
-
411
- it('should not indent when condition function returns false', () => {
412
- sb.indentIf(
413
- () => false,
414
- (x) => x.append('stuff'),
415
- );
416
- expect(sb.toString()).toBe(`stuff`);
417
- });
418
- });
419
-
420
- describe('parenthesize', () => {
421
- it('should parenthesize the content with the given brackets string', () => {
422
- sb.parenthesize('{}', (x) => x.append('stuff'));
423
- expect(sb.toString()).toBe(`{stuff}`);
424
- });
425
-
426
- it('should parenthesize the content with the given brackets array', () => {
427
- sb.parenthesize(['{', '}'], (x) => x.append('stuff'));
428
- expect(sb.toString()).toBe(`{stuff}`);
429
- });
430
-
431
- it('should parenthesize and indent the content (fn)', () => {
432
- sb.parenthesize('()', (x) => x.append(`${EOL}stuff${EOL}`));
433
- expect(sb.toString()).toBe(`(${EOL} stuff${EOL})`);
434
- });
435
-
436
- it('should parenthesize and indent the content (string)', () => {
437
- sb.parenthesize('()', `${EOL}stuff${EOL}`);
438
- expect(sb.toString()).toBe(`(${EOL} stuff${EOL})`);
439
- });
440
-
441
- it('should parenthesize but not indent the content when indent is false', () => {
442
- sb.parenthesize('()', (x) => x.append(`${EOL}stuff${EOL}`), { indent: false });
443
- expect(sb.toString()).toBe(`(${EOL}stuff${EOL})`);
444
- });
445
-
446
- it('should parenthesize the content with the given brackets string (multiline)', () => {
447
- sb.parenthesize('{}', (x) => x.append('stuff'), { multiline: true });
448
- expect(sb.toString()).toBe(`{${EOL} stuff${EOL}}`);
449
- });
450
-
451
- it('should parenthesize the content with the given brackets array (multiline)', () => {
452
- sb.parenthesize(['{', '}'], (x) => x.append('stuff'), { multiline: true });
453
- expect(sb.toString()).toBe(`{${EOL} stuff${EOL}}`);
454
- });
455
-
456
- it('should parenthesize and indent the content (fn) (multiline)', () => {
457
- sb.parenthesize('()', (x) => x.append(`${EOL}stuff${EOL}`), { multiline: true });
458
- expect(sb.toString()).toBe(`(${EOL}${EOL} stuff${EOL})`);
459
- });
460
-
461
- it('should parenthesize and indent the content (string) (multiline)', () => {
462
- sb.parenthesize('()', `${EOL}stuff${EOL}`, { multiline: true });
463
- expect(sb.toString()).toBe(`(${EOL}${EOL} stuff${EOL})`);
464
- });
465
-
466
- it('should parenthesize but not indent the content when indent is false (multiline)', () => {
467
- sb.parenthesize('()', (x) => x.append(`${EOL}stuff${EOL}`), { multiline: true, indent: false });
468
- expect(sb.toString()).toBe(`(${EOL}${EOL}stuff${EOL})`);
469
- });
470
-
471
- it('should ignore first ensurePreviousLineEmpty', () => {
472
- sb.parenthesize('()', (x) => x.ensurePreviousLineEmpty().append('stuff'), { multiline: true });
473
- expect(sb.toString()).toBe(`(${EOL} stuff${EOL})`);
474
- });
475
-
476
- it('should not ignore first ensurePreviousLineEmpty if disabled', () => {
477
- sb.parenthesize('()', (x) => x.ensurePreviousLineEmpty().append('stuff'), {
478
- multiline: true,
479
- pretendEmpty: false,
480
- });
481
- expect(sb.toString()).toBe(`(${EOL}${EOL} stuff${EOL})`);
482
- });
483
- });
484
-
485
- describe('parenthesizeIf', () => {
486
- it('should parenthesize when condition is true (fn)', () => {
487
- sb.parenthesizeIf(true, '()', (x) => x.append('stuff'));
488
- expect(sb.toString()).toBe(`(stuff)`);
489
- });
490
-
491
- it('should parenthesize when condition is true (string)', () => {
492
- sb.parenthesizeIf(true, '()', 'stuff');
493
- expect(sb.toString()).toBe(`(stuff)`);
494
- });
495
-
496
- it('should not parenthesize when condition is false', () => {
497
- sb.parenthesizeIf(false, '()', (x) => x.append('stuff'));
498
- expect(sb.toString()).toBe(`stuff`);
499
- });
500
-
501
- it('should parenthesize when condition function returns true', () => {
502
- sb.parenthesizeIf(
503
- () => true,
504
- '()',
505
- (x) => x.append('stuff'),
506
- );
507
- expect(sb.toString()).toBe(`(stuff)`);
508
- });
509
-
510
- it('should not parenthesize when condition function returns false', () => {
511
- sb.parenthesizeIf(
512
- () => false,
513
- '()',
514
- (x) => x.append('stuff'),
515
- );
516
- expect(sb.toString()).toBe(`stuff`);
517
- });
518
-
519
- it('should parenthesize when condition is true (fn) (multiline)', () => {
520
- sb.parenthesizeIf(true, '()', (x) => x.append('stuff'), { multiline: true });
521
- expect(sb.toString()).toBe(`(${EOL} stuff${EOL})`);
522
- });
523
-
524
- it('should parenthesize when condition is true (string) (multiline)', () => {
525
- sb.parenthesizeIf(true, '()', 'stuff', { multiline: true });
526
- expect(sb.toString()).toBe(`(${EOL} stuff${EOL})`);
527
- });
528
-
529
- it('should not parenthesize when condition is false (multiline)', () => {
530
- sb.parenthesizeIf(false, '()', (x) => x.append('stuff'), { multiline: true });
531
- expect(sb.toString()).toBe(`stuff`);
532
- });
533
-
534
- it('should parenthesize when condition function returns true (multiline)', () => {
535
- sb.parenthesizeIf(
536
- () => true,
537
- '()',
538
- (x) => x.append('stuff'),
539
- { multiline: true },
540
- );
541
- expect(sb.toString()).toBe(`(${EOL} stuff${EOL})`);
542
- });
543
-
544
- it('should not parenthesize when condition function returns false (multiline)', () => {
545
- sb.parenthesizeIf(
546
- () => false,
547
- '()',
548
- (x) => x.append('stuff'),
549
- { multiline: true },
550
- );
551
- expect(sb.toString()).toBe(`stuff`);
552
- });
553
- });
554
-
555
- describe('forEach', () => {
556
- it('should add the content for each item', () => {
557
- sb.forEach(['a', 'b', 'c'], (x, item) => x.append(`(${item})`));
558
- expect(sb.toString()).toBe(`(a)(b)(c)`);
559
- });
560
-
561
- it('should add the content for items that match the condition', () => {
562
- sb.forEach(['a', 'b', 'c'], (x, item) => x.append(`(${item})`), { condition: (item) => item === 'b' });
563
- expect(sb.toString()).toBe(`(b)`);
564
- });
565
-
566
- it('should add the content for each item with the given string separator', () => {
567
- sb.forEach(['a', 'b', 'c'], (x, item) => x.append(`item: ${item}`), { separator: ', ' });
568
- expect(sb.toString()).toBe(`item: a, item: b, item: c`);
569
- });
570
-
571
- it('should add the content for each item with the given separator builder', () => {
572
- sb.forEach(['a', 'b', 'c'], (x, item) => x.append(`item: ${item}`), {
573
- separator: (x, p, n, pi, ni) => x.append(`(${p}:${pi}), (${n}:${ni})`),
574
- });
575
- expect(sb.toString()).toBe(`item: a(a:0), (b:1)item: b(b:1), (c:2)item: c`);
576
- });
577
-
578
- it('should add the content for items that match the condition with the given string separator', () => {
579
- sb.forEach(['a', 'b', 'c'], (x, item) => x.append(`item: ${item}`), {
580
- condition: (item) => item === 'a' || item === 'c',
581
- separator: ', ',
582
- });
583
- expect(sb.toString()).toBe(`item: a, item: c`);
584
- });
585
-
586
- it('should add the content for items that match the condition with the given separator builder', () => {
587
- sb.forEach(['a', 'b', 'c'], (x, item) => x.append(`item: ${item}`), {
588
- condition: (item) => item === 'a' || item === 'c',
589
- separator: (x, p, n, pi, ni) => x.append(`(${p}:${pi}), (${n}:${ni})`),
590
- });
591
- expect(sb.toString()).toBe(`item: a(a:0), (c:2)item: c`);
592
- });
593
- });
594
-
595
- describe('forEachIf', () => {
596
- it('should add the content for each item when condition is true', () => {
597
- sb.forEachIf(true, ['a', 'b', 'c'], (x, item) => x.append(`(${item})`));
598
- expect(sb.toString()).toBe(`(a)(b)(c)`);
599
- });
600
-
601
- it('should not add the content for each item when condition is false', () => {
602
- sb.forEachIf(false, ['a', 'b', 'c'], (x, item) => x.append(`(${item})`));
603
- expect(sb.toString()).toBe(``);
604
- });
605
- });
606
-
607
- describe('appendSeparated', () => {
608
- it('should add the content for each item with the given string separator', () => {
609
- sb.appendSeparated(['a', 'b', 'c'], ', ');
610
- expect(sb.toString()).toBe(`a, b, c`);
611
- });
612
- });
613
-
614
- describe('appendSeparatedIf', () => {
615
- it('should add the content for each item with the given string separator when condition is true', () => {
616
- sb.appendSeparatedIf(true, ['a', 'b', 'c'], ', ');
617
- expect(sb.toString()).toBe(`a, b, c`);
618
- });
619
-
620
- it('should not add the content for each item with the given string separator when condition is false', () => {
621
- sb.appendSeparatedIf(false, ['a', 'b', 'c'], ', ');
622
- expect(sb.toString()).toBe(``);
623
- });
624
- });
625
- });
626
-
627
- describe('builderTemplate', () => {
628
- it('should resolve append values in a template string', () => {
629
- const sb = new SourceBuilder();
630
- sb.append(
631
- builderTemplate`abc${'def'}ghi${123}jkl${(b) => b.append('mno')}pqr${appendValueGroup(['stu', 'vxw'])}yz`,
632
- );
633
- expect(sb.toString()).toEqual('abcdefghi123jklmnopqrstuvxwyz');
634
- });
635
-
636
- it('should remove indentation based on last line', () => {
637
- const sb = new SourceBuilder();
638
- sb.append(
639
- builderTemplate`${'abc'}
640
- ${123}
641
- ghi`,
642
- );
643
- expect(sb.toString()).toEqual(`abc${EOL}123${EOL}ghi`);
644
- });
645
-
646
- describe('indent', () => {
647
- it('should indent the content', () => {
648
- const sb = new SourceBuilder();
649
- sb.append(
650
- builderTemplate.indent`${'abc'}
651
- ${123}
652
- ghi`,
653
- );
654
- expect(sb.toString()).toEqual(` abc${EOL} 123${EOL} ghi`);
655
- });
656
- });
657
- });