@n1k1t/mock-server 0.1.1 → 0.1.3

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 (373) hide show
  1. package/lib/package.json +5 -2
  2. package/lib/src/client/helpers/expectations.d.ts +89 -0
  3. package/lib/src/client/helpers/expectations.d.ts.map +1 -0
  4. package/lib/src/client/helpers/expectations.js +66 -0
  5. package/lib/src/client/helpers/expectations.js.map +1 -0
  6. package/lib/src/client/helpers/index.d.ts +2 -0
  7. package/lib/src/client/helpers/index.d.ts.map +1 -0
  8. package/lib/src/client/helpers/index.js +18 -0
  9. package/lib/src/client/helpers/index.js.map +1 -0
  10. package/lib/src/client/index.d.ts +1 -0
  11. package/lib/src/client/index.d.ts.map +1 -1
  12. package/lib/src/client/index.js +1 -0
  13. package/lib/src/client/index.js.map +1 -1
  14. package/lib/src/client/methods/expectations.create.method.d.ts +1 -3
  15. package/lib/src/client/methods/expectations.create.method.d.ts.map +1 -1
  16. package/lib/src/client/methods/expectations.create.method.js +3 -3
  17. package/lib/src/client/methods/expectations.create.method.js.map +1 -1
  18. package/lib/src/client/methods/expectations.update.method.d.ts +2 -2
  19. package/lib/src/client/methods/expectations.update.method.js +6 -6
  20. package/lib/src/client/methods/expectations.update.method.js.map +1 -1
  21. package/lib/src/client/methods/ping.method.d.ts +1 -1
  22. package/lib/src/client/methods/ping.method.js.map +1 -1
  23. package/lib/src/client/models/client.d.ts +40 -0
  24. package/lib/src/client/models/client.d.ts.map +1 -0
  25. package/lib/src/client/models/client.js +33 -0
  26. package/lib/src/client/models/client.js.map +1 -0
  27. package/lib/src/client/models/client.spec.d.ts +2 -0
  28. package/lib/src/client/models/client.spec.d.ts.map +1 -0
  29. package/lib/src/client/models/client.spec.js +224 -0
  30. package/lib/src/client/models/client.spec.js.map +1 -0
  31. package/lib/src/client/models/index.d.ts +1 -0
  32. package/lib/src/client/models/index.d.ts.map +1 -1
  33. package/lib/src/client/models/index.js +1 -0
  34. package/lib/src/client/models/index.js.map +1 -1
  35. package/lib/src/client/models/method.d.ts +4 -4
  36. package/lib/src/client/models/method.d.ts.map +1 -1
  37. package/lib/src/client/models/method.js.map +1 -1
  38. package/lib/src/client/onsite.d.ts +4 -3
  39. package/lib/src/client/onsite.d.ts.map +1 -1
  40. package/lib/src/client/onsite.js +8 -6
  41. package/lib/src/client/onsite.js.map +1 -1
  42. package/lib/src/client/remote.d.ts +4 -4
  43. package/lib/src/client/remote.d.ts.map +1 -1
  44. package/lib/src/client/remote.js +11 -10
  45. package/lib/src/client/remote.js.map +1 -1
  46. package/lib/src/client/types.d.ts +2 -0
  47. package/lib/src/client/types.d.ts.map +1 -1
  48. package/lib/src/client/utils.d.ts +2 -2
  49. package/lib/src/client/utils.d.ts.map +1 -1
  50. package/lib/src/client/utils.js +25 -12
  51. package/lib/src/client/utils.js.map +1 -1
  52. package/lib/src/expectations/__utils__/index.d.ts +2 -2
  53. package/lib/src/expectations/__utils__/index.d.ts.map +1 -1
  54. package/lib/src/expectations/__utils__/index.js +31 -23
  55. package/lib/src/expectations/__utils__/index.js.map +1 -1
  56. package/lib/src/expectations/index.d.ts +1 -2
  57. package/lib/src/expectations/index.d.ts.map +1 -1
  58. package/lib/src/expectations/index.js +1 -2
  59. package/lib/src/expectations/index.js.map +1 -1
  60. package/lib/src/expectations/models/expectation.d.ts +33 -0
  61. package/lib/src/expectations/models/expectation.d.ts.map +1 -0
  62. package/lib/src/expectations/models/expectation.js +81 -0
  63. package/lib/src/expectations/models/expectation.js.map +1 -0
  64. package/lib/src/expectations/models/index.d.ts +4 -0
  65. package/lib/src/expectations/models/index.d.ts.map +1 -0
  66. package/lib/src/expectations/models/index.js +20 -0
  67. package/lib/src/expectations/models/index.js.map +1 -0
  68. package/lib/src/expectations/models/operator.d.ts +20 -0
  69. package/lib/src/expectations/models/operator.d.ts.map +1 -0
  70. package/lib/src/expectations/models/operator.js +49 -0
  71. package/lib/src/expectations/models/operator.js.map +1 -0
  72. package/lib/src/expectations/models/storage.d.ts +15 -0
  73. package/lib/src/expectations/models/storage.d.ts.map +1 -0
  74. package/lib/src/expectations/{storage.js → models/storage.js} +4 -14
  75. package/lib/src/expectations/models/storage.js.map +1 -0
  76. package/lib/src/expectations/models/storage.spec.d.ts +2 -0
  77. package/lib/src/expectations/models/storage.spec.d.ts.map +1 -0
  78. package/lib/src/expectations/models/storage.spec.js +111 -0
  79. package/lib/src/expectations/models/storage.spec.js.map +1 -0
  80. package/lib/src/expectations/operators/and.operator.d.ts +7 -2
  81. package/lib/src/expectations/operators/and.operator.d.ts.map +1 -1
  82. package/lib/src/expectations/operators/and.operator.js +21 -2
  83. package/lib/src/expectations/operators/and.operator.js.map +1 -1
  84. package/lib/src/expectations/operators/and.operator.spec.js +57 -39
  85. package/lib/src/expectations/operators/and.operator.spec.js.map +1 -1
  86. package/lib/src/expectations/operators/exec.operator.d.ts +7 -2
  87. package/lib/src/expectations/operators/exec.operator.d.ts.map +1 -1
  88. package/lib/src/expectations/operators/exec.operator.js +14 -18
  89. package/lib/src/expectations/operators/exec.operator.js.map +1 -1
  90. package/lib/src/expectations/operators/exec.operator.spec.js +49 -18
  91. package/lib/src/expectations/operators/exec.operator.spec.js.map +1 -1
  92. package/lib/src/expectations/operators/has.operator.d.ts +27 -2
  93. package/lib/src/expectations/operators/has.operator.d.ts.map +1 -1
  94. package/lib/src/expectations/operators/has.operator.js +108 -69
  95. package/lib/src/expectations/operators/has.operator.js.map +1 -1
  96. package/lib/src/expectations/operators/has.operator.spec.js +422 -161
  97. package/lib/src/expectations/operators/has.operator.spec.js.map +1 -1
  98. package/lib/src/expectations/operators/if.operator.d.ts +15 -2
  99. package/lib/src/expectations/operators/if.operator.d.ts.map +1 -1
  100. package/lib/src/expectations/operators/if.operator.js +44 -10
  101. package/lib/src/expectations/operators/if.operator.js.map +1 -1
  102. package/lib/src/expectations/operators/if.operator.spec.js +89 -65
  103. package/lib/src/expectations/operators/if.operator.spec.js.map +1 -1
  104. package/lib/src/expectations/operators/index.d.ts +2 -0
  105. package/lib/src/expectations/operators/index.d.ts.map +1 -1
  106. package/lib/src/expectations/operators/index.js +5 -1
  107. package/lib/src/expectations/operators/index.js.map +1 -1
  108. package/lib/src/expectations/operators/merge.operator.d.ts +13 -2
  109. package/lib/src/expectations/operators/merge.operator.d.ts.map +1 -1
  110. package/lib/src/expectations/operators/merge.operator.js +23 -19
  111. package/lib/src/expectations/operators/merge.operator.js.map +1 -1
  112. package/lib/src/expectations/operators/merge.operator.spec.js +43 -33
  113. package/lib/src/expectations/operators/merge.operator.spec.js.map +1 -1
  114. package/lib/src/expectations/operators/not.operator.d.ts +7 -2
  115. package/lib/src/expectations/operators/not.operator.d.ts.map +1 -1
  116. package/lib/src/expectations/operators/not.operator.js +21 -2
  117. package/lib/src/expectations/operators/not.operator.js.map +1 -1
  118. package/lib/src/expectations/operators/not.operator.spec.js +28 -9
  119. package/lib/src/expectations/operators/not.operator.spec.js.map +1 -1
  120. package/lib/src/expectations/operators/or.operator.d.ts +7 -2
  121. package/lib/src/expectations/operators/or.operator.d.ts.map +1 -1
  122. package/lib/src/expectations/operators/or.operator.js +21 -6
  123. package/lib/src/expectations/operators/or.operator.js.map +1 -1
  124. package/lib/src/expectations/operators/or.operator.spec.js +58 -39
  125. package/lib/src/expectations/operators/or.operator.spec.js.map +1 -1
  126. package/lib/src/expectations/operators/remove.operator.d.ts +12 -2
  127. package/lib/src/expectations/operators/remove.operator.d.ts.map +1 -1
  128. package/lib/src/expectations/operators/remove.operator.js +22 -17
  129. package/lib/src/expectations/operators/remove.operator.js.map +1 -1
  130. package/lib/src/expectations/operators/remove.operator.spec.js +40 -28
  131. package/lib/src/expectations/operators/remove.operator.spec.js.map +1 -1
  132. package/lib/src/expectations/operators/root.operator.d.ts +8 -0
  133. package/lib/src/expectations/operators/root.operator.d.ts.map +1 -0
  134. package/lib/src/expectations/operators/root.operator.js +36 -0
  135. package/lib/src/expectations/operators/root.operator.js.map +1 -0
  136. package/lib/src/expectations/operators/set.operator.d.ts +20 -2
  137. package/lib/src/expectations/operators/set.operator.d.ts.map +1 -1
  138. package/lib/src/expectations/operators/set.operator.js +38 -23
  139. package/lib/src/expectations/operators/set.operator.js.map +1 -1
  140. package/lib/src/expectations/operators/set.operator.spec.js +87 -43
  141. package/lib/src/expectations/operators/set.operator.spec.js.map +1 -1
  142. package/lib/src/expectations/operators/switch.operator.d.ts +25 -0
  143. package/lib/src/expectations/operators/switch.operator.d.ts.map +1 -0
  144. package/lib/src/expectations/operators/switch.operator.js +68 -0
  145. package/lib/src/expectations/operators/switch.operator.js.map +1 -0
  146. package/lib/src/expectations/operators/switch.operator.spec.d.ts +2 -0
  147. package/lib/src/expectations/operators/switch.operator.spec.d.ts.map +1 -0
  148. package/lib/src/expectations/operators/switch.operator.spec.js +129 -0
  149. package/lib/src/expectations/operators/switch.operator.spec.js.map +1 -0
  150. package/lib/src/expectations/types.d.ts +67 -63
  151. package/lib/src/expectations/types.d.ts.map +1 -1
  152. package/lib/src/expectations/types.js +17 -3
  153. package/lib/src/expectations/types.js.map +1 -1
  154. package/lib/src/expectations/utils.d.ts +23 -10
  155. package/lib/src/expectations/utils.d.ts.map +1 -1
  156. package/lib/src/expectations/utils.js +111 -53
  157. package/lib/src/expectations/utils.js.map +1 -1
  158. package/lib/src/server/endpoints/config.get.endpoint.d.ts +8 -3
  159. package/lib/src/server/endpoints/config.get.endpoint.d.ts.map +1 -1
  160. package/lib/src/server/endpoints/config.get.endpoint.js +2 -4
  161. package/lib/src/server/endpoints/config.get.endpoint.js.map +1 -1
  162. package/lib/src/server/endpoints/expectations.create.endpoint.d.ts +9 -11
  163. package/lib/src/server/endpoints/expectations.create.endpoint.d.ts.map +1 -1
  164. package/lib/src/server/endpoints/expectations.create.endpoint.js +2 -3
  165. package/lib/src/server/endpoints/expectations.create.endpoint.js.map +1 -1
  166. package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts +8 -5
  167. package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts.map +1 -1
  168. package/lib/src/server/endpoints/expectations.delete.endpoint.js +2 -2
  169. package/lib/src/server/endpoints/expectations.delete.endpoint.js.map +1 -1
  170. package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts +8 -3
  171. package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts.map +1 -1
  172. package/lib/src/server/endpoints/expectations.get-list.endpoint.js +2 -2
  173. package/lib/src/server/endpoints/expectations.get-list.endpoint.js.map +1 -1
  174. package/lib/src/server/endpoints/expectations.update.endpoint.d.ts +13 -11
  175. package/lib/src/server/endpoints/expectations.update.endpoint.d.ts.map +1 -1
  176. package/lib/src/server/endpoints/expectations.update.endpoint.js +4 -6
  177. package/lib/src/server/endpoints/expectations.update.endpoint.js.map +1 -1
  178. package/lib/src/server/endpoints/history.get-list.endpoint.d.ts +27 -0
  179. package/lib/src/server/endpoints/history.get-list.endpoint.d.ts.map +1 -0
  180. package/lib/src/server/endpoints/history.get-list.endpoint.js +11 -0
  181. package/lib/src/server/endpoints/history.get-list.endpoint.js.map +1 -0
  182. package/lib/src/server/endpoints/index.d.ts +1 -1
  183. package/lib/src/server/endpoints/index.d.ts.map +1 -1
  184. package/lib/src/server/endpoints/index.js +3 -3
  185. package/lib/src/server/endpoints/index.js.map +1 -1
  186. package/lib/src/server/endpoints/ping.endpoint.d.ts +8 -3
  187. package/lib/src/server/endpoints/ping.endpoint.d.ts.map +1 -1
  188. package/lib/src/server/endpoints/ping.endpoint.js +1 -1
  189. package/lib/src/server/endpoints/ping.endpoint.js.map +1 -1
  190. package/lib/src/server/history/model.d.ts +16 -16
  191. package/lib/src/server/history/model.d.ts.map +1 -1
  192. package/lib/src/server/history/model.js +21 -6
  193. package/lib/src/server/history/model.js.map +1 -1
  194. package/lib/src/server/history/storage.d.ts +3 -4
  195. package/lib/src/server/history/storage.d.ts.map +1 -1
  196. package/lib/src/server/history/storage.js +2 -2
  197. package/lib/src/server/history/storage.js.map +1 -1
  198. package/lib/src/server/index.d.ts +10 -6
  199. package/lib/src/server/index.d.ts.map +1 -1
  200. package/lib/src/server/index.js +21 -22
  201. package/lib/src/server/index.js.map +1 -1
  202. package/lib/src/server/middlewares/delay.middleware.d.ts +24 -0
  203. package/lib/src/server/middlewares/delay.middleware.d.ts.map +1 -0
  204. package/lib/src/server/middlewares/delay.middleware.js +13 -0
  205. package/lib/src/server/middlewares/delay.middleware.js.map +1 -0
  206. package/lib/src/server/middlewares/destroy.midleware.d.ts +24 -0
  207. package/lib/src/server/middlewares/destroy.midleware.d.ts.map +1 -0
  208. package/lib/src/server/middlewares/destroy.midleware.js +16 -0
  209. package/lib/src/server/middlewares/destroy.midleware.js.map +1 -0
  210. package/lib/src/server/middlewares/forward.middleware.d.ts +24 -0
  211. package/lib/src/server/middlewares/forward.middleware.d.ts.map +1 -0
  212. package/lib/src/server/middlewares/forward.middleware.js +71 -0
  213. package/lib/src/server/middlewares/forward.middleware.js.map +1 -0
  214. package/lib/src/server/middlewares/history.middleware.d.ts +24 -0
  215. package/lib/src/server/middlewares/history.middleware.d.ts.map +1 -0
  216. package/lib/src/server/middlewares/history.middleware.js +13 -0
  217. package/lib/src/server/middlewares/history.middleware.js.map +1 -0
  218. package/lib/src/server/middlewares/index.d.ts +7 -6
  219. package/lib/src/server/middlewares/index.d.ts.map +1 -1
  220. package/lib/src/server/middlewares/index.js +15 -13
  221. package/lib/src/server/middlewares/index.js.map +1 -1
  222. package/lib/src/server/middlewares/internal-route.middleware.d.ts +20 -2
  223. package/lib/src/server/middlewares/internal-route.middleware.d.ts.map +1 -1
  224. package/lib/src/server/middlewares/internal-route.middleware.js +4 -3
  225. package/lib/src/server/middlewares/internal-route.middleware.js.map +1 -1
  226. package/lib/src/server/middlewares/manipulate-expectation.middleware.d.ts +24 -0
  227. package/lib/src/server/middlewares/manipulate-expectation.middleware.d.ts.map +1 -0
  228. package/lib/src/server/middlewares/manipulate-expectation.middleware.js +13 -0
  229. package/lib/src/server/middlewares/manipulate-expectation.middleware.js.map +1 -0
  230. package/lib/src/server/middlewares/match-expectation.middleware.d.ts +24 -0
  231. package/lib/src/server/middlewares/match-expectation.middleware.d.ts.map +1 -0
  232. package/lib/src/server/middlewares/match-expectation.middleware.js +20 -0
  233. package/lib/src/server/middlewares/match-expectation.middleware.js.map +1 -0
  234. package/lib/src/server/middlewares/public.middleware.d.ts +24 -0
  235. package/lib/src/server/middlewares/public.middleware.d.ts.map +1 -0
  236. package/lib/src/server/middlewares/{resolve-public.middleware.js → public.middleware.js} +13 -13
  237. package/lib/src/server/middlewares/public.middleware.js.map +1 -0
  238. package/lib/src/server/middlewares/reply.middleware.d.ts +21 -5
  239. package/lib/src/server/middlewares/reply.middleware.d.ts.map +1 -1
  240. package/lib/src/server/middlewares/reply.middleware.js +34 -25
  241. package/lib/src/server/middlewares/reply.middleware.js.map +1 -1
  242. package/lib/src/server/models/endpoint.d.ts +19 -13
  243. package/lib/src/server/models/endpoint.d.ts.map +1 -1
  244. package/lib/src/server/models/endpoint.js +2 -2
  245. package/lib/src/server/models/endpoint.js.map +1 -1
  246. package/lib/src/server/models/middleware.d.ts +21 -20
  247. package/lib/src/server/models/middleware.d.ts.map +1 -1
  248. package/lib/src/server/models/middleware.js +6 -10
  249. package/lib/src/server/models/middleware.js.map +1 -1
  250. package/lib/src/server/models/reply-service/index.d.ts +6 -6
  251. package/lib/src/server/models/reply-service/index.d.ts.map +1 -1
  252. package/lib/src/server/models/reply-service/index.js +24 -24
  253. package/lib/src/server/models/reply-service/index.js.map +1 -1
  254. package/lib/src/server/models/request-context/http.d.ts +45 -0
  255. package/lib/src/server/models/request-context/http.d.ts.map +1 -0
  256. package/lib/src/server/models/request-context/http.js +71 -0
  257. package/lib/src/server/models/request-context/http.js.map +1 -0
  258. package/lib/src/server/models/request-context/index.d.ts +4 -57
  259. package/lib/src/server/models/request-context/index.d.ts.map +1 -1
  260. package/lib/src/server/models/request-context/index.js +4 -57
  261. package/lib/src/server/models/request-context/index.js.map +1 -1
  262. package/lib/src/server/models/request-context/model.d.ts +13 -0
  263. package/lib/src/server/models/request-context/model.d.ts.map +1 -0
  264. package/lib/src/server/models/request-context/model.js +14 -0
  265. package/lib/src/server/models/request-context/model.js.map +1 -0
  266. package/lib/src/server/models/request-context/types.d.ts +16 -18
  267. package/lib/src/server/models/request-context/types.d.ts.map +1 -1
  268. package/lib/src/server/models/request-context/utils.d.ts +7 -3
  269. package/lib/src/server/models/request-context/utils.d.ts.map +1 -1
  270. package/lib/src/server/models/request-context/utils.js +48 -25
  271. package/lib/src/server/models/request-context/utils.js.map +1 -1
  272. package/lib/src/server/models/request-context/ws.d.ts +21 -0
  273. package/lib/src/server/models/request-context/ws.d.ts.map +1 -0
  274. package/lib/src/server/models/request-context/ws.js +22 -0
  275. package/lib/src/server/models/request-context/ws.js.map +1 -0
  276. package/lib/src/server/models/server-context.d.ts +4 -4
  277. package/lib/src/server/models/server-context.d.ts.map +1 -1
  278. package/lib/src/server/models/server-context.js +5 -5
  279. package/lib/src/server/models/server-context.js.map +1 -1
  280. package/lib/src/server/router.d.ts +4 -7
  281. package/lib/src/server/router.d.ts.map +1 -1
  282. package/lib/src/server/router.js +5 -12
  283. package/lib/src/server/router.js.map +1 -1
  284. package/lib/src/server/ws-exchange/index.d.ts +5 -0
  285. package/lib/src/server/ws-exchange/index.d.ts.map +1 -0
  286. package/lib/src/server/{web-socket-exchange → ws-exchange}/index.js +3 -3
  287. package/lib/src/server/ws-exchange/index.js.map +1 -0
  288. package/lib/src/server/ws-exchange/types.d.ts +12 -0
  289. package/lib/src/server/ws-exchange/types.d.ts.map +1 -0
  290. package/lib/src/server/ws-exchange/types.js.map +1 -0
  291. package/lib/src/types.d.ts +0 -1
  292. package/lib/src/types.d.ts.map +1 -1
  293. package/lib/src/utils/index.d.ts +1 -0
  294. package/lib/src/utils/index.d.ts.map +1 -1
  295. package/lib/src/utils/index.js +1 -0
  296. package/lib/src/utils/index.js.map +1 -1
  297. package/lib/src/utils/json.d.ts +1 -1
  298. package/lib/src/utils/json.d.ts.map +1 -1
  299. package/lib/src/utils/json.js +3 -3
  300. package/lib/src/utils/json.js.map +1 -1
  301. package/lib/src/utils/regexp.d.ts +2 -0
  302. package/lib/src/utils/regexp.d.ts.map +1 -0
  303. package/lib/src/utils/regexp.js +9 -0
  304. package/lib/src/utils/regexp.js.map +1 -0
  305. package/lib/test/index.js +140 -136
  306. package/lib/test/index.js.map +1 -1
  307. package/lib/tsconfig.tsbuildinfo +1 -1
  308. package/lib/types/common.global.d.ts +13 -6
  309. package/lib/types/common.global.d.ts.map +1 -1
  310. package/lib/types/lib.d.ts +1 -0
  311. package/lib/types/lib.d.ts.map +1 -1
  312. package/lib/types/lib.js +1 -0
  313. package/lib/types/lib.js.map +1 -1
  314. package/package.json +5 -2
  315. package/types/common.global.ts +21 -2
  316. package/types/lib.ts +1 -0
  317. package/lib/src/expectations/model.d.ts +0 -39
  318. package/lib/src/expectations/model.d.ts.map +0 -1
  319. package/lib/src/expectations/model.js +0 -90
  320. package/lib/src/expectations/model.js.map +0 -1
  321. package/lib/src/expectations/operators/utils.d.ts +0 -20
  322. package/lib/src/expectations/operators/utils.d.ts.map +0 -1
  323. package/lib/src/expectations/operators/utils.js +0 -67
  324. package/lib/src/expectations/operators/utils.js.map +0 -1
  325. package/lib/src/expectations/storage.d.ts +0 -19
  326. package/lib/src/expectations/storage.d.ts.map +0 -1
  327. package/lib/src/expectations/storage.js.map +0 -1
  328. package/lib/src/expectations/utils.spec.d.ts +0 -2
  329. package/lib/src/expectations/utils.spec.d.ts.map +0 -1
  330. package/lib/src/expectations/utils.spec.js +0 -59
  331. package/lib/src/expectations/utils.spec.js.map +0 -1
  332. package/lib/src/expectations/validation-schemas.d.ts +0 -14
  333. package/lib/src/expectations/validation-schemas.d.ts.map +0 -1
  334. package/lib/src/expectations/validation-schemas.js +0 -36
  335. package/lib/src/expectations/validation-schemas.js.map +0 -1
  336. package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts +0 -16
  337. package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts.map +0 -1
  338. package/lib/src/server/endpoints/history-records.get-list.endpoint.js +0 -9
  339. package/lib/src/server/endpoints/history-records.get-list.endpoint.js.map +0 -1
  340. package/lib/src/server/middlewares/add-history.middleware.d.ts +0 -8
  341. package/lib/src/server/middlewares/add-history.middleware.d.ts.map +0 -1
  342. package/lib/src/server/middlewares/add-history.middleware.js +0 -14
  343. package/lib/src/server/middlewares/add-history.middleware.js.map +0 -1
  344. package/lib/src/server/middlewares/destroy-request.midleware.d.ts +0 -8
  345. package/lib/src/server/middlewares/destroy-request.midleware.d.ts.map +0 -1
  346. package/lib/src/server/middlewares/destroy-request.midleware.js +0 -17
  347. package/lib/src/server/middlewares/destroy-request.midleware.js.map +0 -1
  348. package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts +0 -8
  349. package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts.map +0 -1
  350. package/lib/src/server/middlewares/handle-expectation-delay.middleware.js +0 -18
  351. package/lib/src/server/middlewares/handle-expectation-delay.middleware.js.map +0 -1
  352. package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts +0 -8
  353. package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts.map +0 -1
  354. package/lib/src/server/middlewares/handle-expectation-forward.middleware.js +0 -86
  355. package/lib/src/server/middlewares/handle-expectation-forward.middleware.js.map +0 -1
  356. package/lib/src/server/middlewares/resolve-public.middleware.d.ts +0 -6
  357. package/lib/src/server/middlewares/resolve-public.middleware.d.ts.map +0 -1
  358. package/lib/src/server/middlewares/resolve-public.middleware.js.map +0 -1
  359. package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts +0 -6
  360. package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts.map +0 -1
  361. package/lib/src/server/middlewares/validate-expectation-request.middleware.js +0 -20
  362. package/lib/src/server/middlewares/validate-expectation-request.middleware.js.map +0 -1
  363. package/lib/src/server/types.d.ts +0 -6
  364. package/lib/src/server/types.d.ts.map +0 -1
  365. package/lib/src/server/types.js.map +0 -1
  366. package/lib/src/server/web-socket-exchange/index.d.ts +0 -5
  367. package/lib/src/server/web-socket-exchange/index.d.ts.map +0 -1
  368. package/lib/src/server/web-socket-exchange/index.js.map +0 -1
  369. package/lib/src/server/web-socket-exchange/types.d.ts +0 -12
  370. package/lib/src/server/web-socket-exchange/types.d.ts.map +0 -1
  371. package/lib/src/server/web-socket-exchange/types.js +0 -3
  372. package/lib/src/server/web-socket-exchange/types.js.map +0 -1
  373. /package/lib/src/server/{types.js → ws-exchange/types.js} +0 -0
@@ -1,173 +1,434 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
4
24
  };
5
25
  Object.defineProperty(exports, "__esModule", { value: true });
6
26
  const __utils__1 = require("../__utils__");
7
- const utils_1 = require("../utils");
8
- const has_operator_1 = __importDefault(require("./has.operator"));
27
+ const operators = __importStar(require("./index"));
9
28
  describe('Expectations.Operators.Has', () => {
10
- it('should handle invalid payload', () => {
11
- const schema = { $location: 'query' };
12
- expect((0, has_operator_1.default)('validation', schema, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeFalsy();
13
- });
14
- it('should handle schema without location', () => {
15
- expect((0, has_operator_1.default)('validation', {}, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeFalsy();
16
- });
17
- it('should validate by schema in query using path', () => {
18
- const schema = {
19
- $location: 'query',
20
- $path: 'foo',
21
- };
22
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
23
- });
24
- it('should validate by schema in query using path and value', () => {
25
- const schema = {
26
- $location: 'query',
27
- $path: 'foo',
28
- $value: 1,
29
- };
30
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
31
- });
32
- it('should validate by schema in query using jsonPath and valueAnyOf', () => {
33
- const schema = {
34
- $location: 'query',
35
- $jsonPath: '$.bar.baz',
36
- $valueAnyOf: [1, 2, null],
37
- };
38
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
39
- });
40
- it('should validate by schema in query using path and regExp', () => {
41
- const schema = {
42
- $location: 'query',
43
- $path: 'foo',
44
- $regExp: /\d/,
45
- };
46
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
47
- });
48
- it('should validate by schema in query using path and regExpAnyOf', () => {
49
- const schema = {
50
- $location: 'query',
51
- $path: 'foo',
52
- $regExpAnyOf: [/\./, /\d/],
53
- };
54
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
55
- });
56
- it('should validate by schema in query using path and minimatch', () => {
57
- const schema = {
58
- $location: 'query',
59
- $path: 'foo',
60
- $minimatch: '*',
61
- };
62
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
63
- });
64
- it('should validate by schema in query using path and minimatchAnyOf', () => {
65
- const schema = {
66
- $location: 'query',
67
- $path: 'foo',
68
- $minimatchAnyOf: ['2', '3', '1'],
69
- };
70
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
71
- });
72
- it('should validate by schema in query using jsonPath', () => {
73
- const schema = {
74
- $location: 'query',
75
- $jsonPath: '$.bar.baz',
76
- };
77
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
78
- });
79
- it('should validate by schema in query using jsonPath and value', () => {
80
- const schema = {
81
- $location: 'query',
82
- $jsonPath: '$.bar.baz',
83
- $value: null,
84
- };
85
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
86
- });
87
- it('should validate by schema with invalid condition in query using jsonPath and value', () => {
88
- const schema = {
89
- $location: 'query',
90
- $jsonPath: '$.bar.baz',
91
- $value: 1,
92
- };
93
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeFalsy();
94
- });
95
- it('should validate by schema in path using value', () => {
96
- const schema = {
97
- $location: 'path',
98
- $value: '/foo/bar/baz',
99
- };
100
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
101
- });
102
- it('should validate by schema in path using valueAnyOf', () => {
103
- const schema = {
104
- $location: 'path',
105
- $valueAnyOf: ['/foo', '/bar', '/foo/bar/baz'],
106
- };
107
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
108
- });
109
- it('should validate by schema in path using regExp', () => {
110
- const schema = {
111
- $location: 'path',
112
- $regExp: /^\/foo\/\w+\/baz$/,
113
- };
114
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
115
- });
116
- it('should validate by schema in path using regExpAnyOf', () => {
117
- const schema = {
118
- $location: 'path',
119
- $regExpAnyOf: [/\./, /^\/foo\/\w+\/baz$/, /^foo$/],
120
- };
121
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
122
- });
123
- it('should validate by schema in path using minimatch', () => {
124
- const schema = {
125
- $location: 'path',
126
- $minimatch: '/foo/*/baz',
127
- };
128
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
129
- });
130
- it('should validate by schema in path using minimatchAnyOf', () => {
131
- const schema = {
132
- $location: 'path',
133
- $minimatchAnyOf: ['/foo/baz', '/bar/baz', '/foo/bar/*'],
134
- };
135
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
136
- });
137
- it('should validate by schema in method using value', () => {
138
- const schema = {
139
- $location: 'method',
140
- $value: 'POST',
141
- };
142
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
29
+ describe('incoming.query', () => {
30
+ it('should handle invalid schema', () => {
31
+ const operator = new operators.$has(operators, { $location: 'incoming.query' });
32
+ expect(operator.match({})).toBeFalsy();
33
+ });
34
+ it('should match by schema using exec', () => {
35
+ const operator = new operators.$has(operators, {
36
+ $location: 'incoming.query',
37
+ $exec: (payload) => payload.foo === 1,
38
+ });
39
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
40
+ });
41
+ it('should not match by schema using exec', () => {
42
+ const operator = new operators.$has(operators, {
43
+ $location: 'incoming.query',
44
+ $exec: (payload) => payload.foo === '2',
45
+ });
46
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
47
+ });
48
+ it('should match by schema using path', () => {
49
+ const operator = new operators.$has(operators, {
50
+ $location: 'incoming.query',
51
+ $path: 'foo',
52
+ });
53
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
54
+ });
55
+ it('should not match by schema using path', () => {
56
+ const operator = new operators.$has(operators, {
57
+ $location: 'incoming.query',
58
+ $path: 'foo1',
59
+ });
60
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
61
+ });
62
+ it('should match by schema using path and value', () => {
63
+ const operator = new operators.$has(operators, {
64
+ $location: 'incoming.query',
65
+ $path: 'foo',
66
+ $value: 1,
67
+ });
68
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
69
+ });
70
+ it('should not match by schema using path and value', () => {
71
+ const operator = new operators.$has(operators, {
72
+ $location: 'incoming.query',
73
+ $path: 'foo',
74
+ $value: 2,
75
+ });
76
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
77
+ });
78
+ it('should match by schema using path and valueAnyOf', () => {
79
+ const operator = new operators.$has(operators, {
80
+ $location: 'incoming.query',
81
+ $path: 'foo',
82
+ $valueAnyOf: [null, 500, 1],
83
+ });
84
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
85
+ });
86
+ it('should not match by schema using path and valueAnyOf', () => {
87
+ const operator = new operators.$has(operators, {
88
+ $location: 'incoming.query',
89
+ $path: 'foo',
90
+ $valueAnyOf: [],
91
+ });
92
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
93
+ });
94
+ it('should match by schema using path and regExp', () => {
95
+ const operator = new operators.$has(operators, {
96
+ $location: 'incoming.query',
97
+ $path: 'foo',
98
+ $regExp: /\d/,
99
+ });
100
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
101
+ });
102
+ it('should not match by schema using path and regExp', () => {
103
+ const operator = new operators.$has(operators, {
104
+ $location: 'incoming.query',
105
+ $path: 'foo',
106
+ $regExp: /[a-z]/,
107
+ });
108
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
109
+ });
110
+ it('should match by schema using path and regExpAnyOf', () => {
111
+ const operator = new operators.$has(operators, {
112
+ $location: 'incoming.query',
113
+ $path: 'foo',
114
+ $regExpAnyOf: [/\./, /\d/],
115
+ });
116
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
117
+ });
118
+ it('should not match by schema using path and regExpAnyOf', () => {
119
+ const operator = new operators.$has(operators, {
120
+ $location: 'incoming.query',
121
+ $path: 'foo',
122
+ $regExpAnyOf: [/\./],
123
+ });
124
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
125
+ });
126
+ it('should match by schema using path and match', () => {
127
+ const operator = new operators.$has(operators, {
128
+ $location: 'incoming.query',
129
+ $path: 'foo',
130
+ $match: '*',
131
+ });
132
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
133
+ });
134
+ it('should not match by schema using path and match', () => {
135
+ const operator = new operators.$has(operators, {
136
+ $location: 'incoming.query',
137
+ $path: 'foo',
138
+ $match: '*foo*',
139
+ });
140
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
141
+ });
142
+ it('should match by schema using path and matchAnyOf', () => {
143
+ const operator = new operators.$has(operators, {
144
+ $location: 'incoming.query',
145
+ $path: 'foo',
146
+ $matchAnyOf: ['2', '3', '1'],
147
+ });
148
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
149
+ });
150
+ it('should not match by schema using path and matchAnyOf', () => {
151
+ const operator = new operators.$has(operators, {
152
+ $location: 'incoming.query',
153
+ $path: 'foo',
154
+ $matchAnyOf: ['*2', '3', '1*0'],
155
+ });
156
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
157
+ });
158
+ it('should match by schema using path and exec', () => {
159
+ const operator = new operators.$has(operators, {
160
+ $location: 'incoming.query',
161
+ $path: 'foo',
162
+ $exec: (payload) => payload === 1,
163
+ });
164
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
165
+ });
166
+ it('should not match by schema using path and exec', () => {
167
+ const operator = new operators.$has(operators, {
168
+ $location: 'incoming.query',
169
+ $path: 'foo',
170
+ $exec: (payload) => payload === '2',
171
+ });
172
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
173
+ });
174
+ it('should match by schema using jsonPath', () => {
175
+ const operator = new operators.$has(operators, {
176
+ $location: 'incoming.query',
177
+ $jsonPath: '$.bar.baz',
178
+ });
179
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
180
+ });
181
+ it('should not match by schema using jsonPath', () => {
182
+ const operator = new operators.$has(operators, {
183
+ $location: 'incoming.query',
184
+ $jsonPath: '$.bar2.baz',
185
+ });
186
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
187
+ });
188
+ it('should match by schema using jsonPath and value', () => {
189
+ const operator = new operators.$has(operators, {
190
+ $location: 'incoming.query',
191
+ $jsonPath: '$.bar.baz',
192
+ $value: null,
193
+ });
194
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
195
+ });
196
+ it('should not match by schema with using jsonPath and value', () => {
197
+ const operator = new operators.$has(operators, {
198
+ $location: 'incoming.query',
199
+ $jsonPath: '$.bar.baz',
200
+ $value: 1,
201
+ });
202
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
203
+ });
204
+ it('should match by schema using jsonPath and valueAnyOf', () => {
205
+ const operator = new operators.$has(operators, {
206
+ $location: 'incoming.query',
207
+ $jsonPath: '$.bar.baz',
208
+ $valueAnyOf: [1, 2, null],
209
+ });
210
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
211
+ });
212
+ it('should not match by schema using jsonPath and valueAnyOf', () => {
213
+ const operator = new operators.$has(operators, {
214
+ $location: 'incoming.query',
215
+ $jsonPath: '$.bar.baz',
216
+ $valueAnyOf: [1, 2, 3],
217
+ });
218
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
219
+ });
220
+ it('should match by schema using jsonPath and exec', () => {
221
+ const operator = new operators.$has(operators, {
222
+ $location: 'incoming.query',
223
+ $jsonPath: '$.bar.baz',
224
+ $exec: (payload) => payload === null,
225
+ });
226
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
227
+ });
228
+ it('should not match by schema using jsonPath and exec', () => {
229
+ const operator = new operators.$has(operators, {
230
+ $location: 'incoming.query',
231
+ $jsonPath: '$.bar.baz',
232
+ $exec: (payload) => payload === 1,
233
+ });
234
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
235
+ });
143
236
  });
144
- it('should validate by schema in statusCode using value', () => {
145
- const schema = {
146
- $location: 'statusCode',
147
- $value: 200,
148
- };
149
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
237
+ describe('incoming.body', () => {
238
+ it('should match by schema using match', () => {
239
+ const operator = new operators.$has(operators, {
240
+ $location: 'incoming.body',
241
+ $match: { foo: { bar: 1 } },
242
+ });
243
+ expect(operator.match({ incoming: { body: { foo: { bar: 1 } } } })).toBeTruthy();
244
+ expect(operator.match({ incoming: { body: { foo: { bar: 2 } } } })).toBeFalsy();
245
+ expect(operator.match({ incoming: { body: {} } })).toBeFalsy();
246
+ });
247
+ it('should match by schema using matchAnyOf', () => {
248
+ const operator = new operators.$has(operators, {
249
+ $location: 'incoming.body',
250
+ $matchAnyOf: [{ foo: { bar: 1 } }, { baz: 2 }],
251
+ });
252
+ expect(operator.match({ incoming: { body: { foo: { bar: 1 } } } })).toBeTruthy();
253
+ expect(operator.match({ incoming: { body: { baz: 2 } } })).toBeTruthy();
254
+ expect(operator.match({ incoming: { body: { foo: { bar: 2 } } } })).toBeFalsy();
255
+ expect(operator.match({ incoming: { body: { baz: 1 } } })).toBeFalsy();
256
+ expect(operator.match({ incoming: { body: {} } })).toBeFalsy();
257
+ });
150
258
  });
151
- it('should validate by schema in statusCode using valueAnyOf', () => {
152
- const schema = {
153
- $location: 'statusCode',
154
- $valueAnyOf: [404, 200],
155
- };
156
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
259
+ describe('incoming.path', () => {
260
+ it('should match by schema using value', () => {
261
+ const operator = new operators.$has(operators, {
262
+ $location: 'path',
263
+ $value: '/foo/bar/baz',
264
+ });
265
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
266
+ });
267
+ it('should match by schema using valueAnyOf', () => {
268
+ const operator = new operators.$has(operators, {
269
+ $location: 'path',
270
+ $valueAnyOf: ['/foo', '/bar', '/foo/bar/baz'],
271
+ });
272
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
273
+ });
274
+ it('should match by schema using regExp', () => {
275
+ const operator = new operators.$has(operators, {
276
+ $location: 'path',
277
+ $regExp: /^\/foo\/\w+\/baz$/,
278
+ });
279
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
280
+ });
281
+ it('should match by schema using regExpAnyOf', () => {
282
+ const operator = new operators.$has(operators, {
283
+ $location: 'path',
284
+ $regExpAnyOf: [/\./, /^\/foo\/\w+\/baz$/, /^foo$/],
285
+ });
286
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
287
+ });
288
+ it('should match by schema using match', () => {
289
+ const operator = new operators.$has(operators, {
290
+ $location: 'path',
291
+ $match: '/foo/*/baz',
292
+ });
293
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
294
+ });
295
+ it('should not match by schema using match', () => {
296
+ const operator = new operators.$has(operators, {
297
+ $location: 'path',
298
+ $match: '/foo/*/*/baz',
299
+ });
300
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
301
+ });
302
+ it('should match by schema using matchAnyOf', () => {
303
+ const operator = new operators.$has(operators, {
304
+ $location: 'path',
305
+ $matchAnyOf: ['/foo/baz', '/bar/baz', '/foo/bar/*'],
306
+ });
307
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
308
+ });
309
+ it('should not match by schema using matchAnyOf', () => {
310
+ const operator = new operators.$has(operators, {
311
+ $location: 'path',
312
+ $matchAnyOf: [],
313
+ });
314
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
315
+ });
316
+ it('should match by schema using exec', () => {
317
+ const operator = new operators.$has(operators, {
318
+ $location: 'path',
319
+ $exec: (payload) => payload.includes('/foo'),
320
+ });
321
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
322
+ });
323
+ it('should not match by schema using exec', () => {
324
+ const operator = new operators.$has(operators, {
325
+ $location: 'path',
326
+ $exec: (payload) => payload === '/foo',
327
+ });
328
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
329
+ });
157
330
  });
158
- it('should validate by schema in statusCode using minimatch', () => {
159
- const schema = {
160
- $location: 'statusCode',
161
- $minimatch: '2**',
162
- };
163
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
331
+ describe('incoming.method', () => {
332
+ it('should match by schema using value', () => {
333
+ const operator = new operators.$has(operators, {
334
+ $location: 'method',
335
+ $value: 'POST',
336
+ });
337
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
338
+ });
164
339
  });
165
- it('should validate by schema in statusCode using minimatchAnyOf', () => {
166
- const schema = {
167
- $location: 'statusCode',
168
- $minimatchAnyOf: ['2*1', '200'],
169
- };
170
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
340
+ describe('outgoing.status', () => {
341
+ it('should match by schema using value', () => {
342
+ const operator = new operators.$has(operators, {
343
+ $location: 'outgoing.status',
344
+ $value: 200,
345
+ });
346
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
347
+ });
348
+ it('should not match by schema using value', () => {
349
+ const operator = new operators.$has(operators, {
350
+ $location: 'outgoing.status',
351
+ $value: 201,
352
+ });
353
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
354
+ });
355
+ it('should match by schema using valueAnyOf', () => {
356
+ const operator = new operators.$has(operators, {
357
+ $location: 'outgoing.status',
358
+ $valueAnyOf: [404, 200],
359
+ });
360
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
361
+ });
362
+ it('should not match by schema using valueAnyOf', () => {
363
+ const operator = new operators.$has(operators, {
364
+ $location: 'outgoing.status',
365
+ $valueAnyOf: [404, 201],
366
+ });
367
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
368
+ });
369
+ it('should match by schema using match', () => {
370
+ const operator = new operators.$has(operators, {
371
+ $location: 'outgoing.status',
372
+ $match: '2**',
373
+ });
374
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
375
+ });
376
+ it('should not match by schema using match', () => {
377
+ const operator = new operators.$has(operators, {
378
+ $location: 'outgoing.status',
379
+ $match: '2*1',
380
+ });
381
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
382
+ });
383
+ it('should match by schema using matchAnyOf', () => {
384
+ const operator = new operators.$has(operators, {
385
+ $location: 'outgoing.status',
386
+ $matchAnyOf: ['2*1', '200'],
387
+ });
388
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
389
+ });
390
+ it('should not match by schema using matchAnyOf', () => {
391
+ const operator = new operators.$has(operators, {
392
+ $location: 'outgoing.status',
393
+ $matchAnyOf: ['2*1'],
394
+ });
395
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
396
+ });
397
+ it('should match by schema using exec', () => {
398
+ const operator = new operators.$has(operators, {
399
+ $location: 'outgoing.status',
400
+ $exec: (payload) => payload === 200,
401
+ });
402
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
403
+ });
404
+ it('should not match by schema using exec', () => {
405
+ const operator = new operators.$has(operators, {
406
+ $location: 'outgoing.status',
407
+ $exec: (payload) => payload === '200',
408
+ });
409
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
410
+ });
411
+ it('should match by schema using exec as string', () => {
412
+ const operator = new operators.$has(operators, {
413
+ $location: 'outgoing.status',
414
+ $exec: 'payload === 200',
415
+ });
416
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
417
+ });
418
+ it('should not match by schema using exec as string', () => {
419
+ const operator = new operators.$has(operators, {
420
+ $location: 'outgoing.status',
421
+ $exec: 'payload === 201',
422
+ });
423
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
424
+ });
425
+ it('should match by schema using exec as string with utils', () => {
426
+ const operator = new operators.$has(operators, {
427
+ $location: 'outgoing.status',
428
+ $exec: '_.isEqual(payload, 200)',
429
+ });
430
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
431
+ });
171
432
  });
172
433
  });
173
434
  //# sourceMappingURL=has.operator.spec.js.map