@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.
- package/lib/package.json +5 -2
- package/lib/src/client/helpers/expectations.d.ts +89 -0
- package/lib/src/client/helpers/expectations.d.ts.map +1 -0
- package/lib/src/client/helpers/expectations.js +66 -0
- package/lib/src/client/helpers/expectations.js.map +1 -0
- package/lib/src/client/helpers/index.d.ts +2 -0
- package/lib/src/client/helpers/index.d.ts.map +1 -0
- package/lib/src/client/helpers/index.js +18 -0
- package/lib/src/client/helpers/index.js.map +1 -0
- package/lib/src/client/index.d.ts +1 -0
- package/lib/src/client/index.d.ts.map +1 -1
- package/lib/src/client/index.js +1 -0
- package/lib/src/client/index.js.map +1 -1
- package/lib/src/client/methods/expectations.create.method.d.ts +1 -3
- package/lib/src/client/methods/expectations.create.method.d.ts.map +1 -1
- package/lib/src/client/methods/expectations.create.method.js +3 -3
- package/lib/src/client/methods/expectations.create.method.js.map +1 -1
- package/lib/src/client/methods/expectations.update.method.d.ts +2 -2
- package/lib/src/client/methods/expectations.update.method.js +6 -6
- package/lib/src/client/methods/expectations.update.method.js.map +1 -1
- package/lib/src/client/methods/ping.method.d.ts +1 -1
- package/lib/src/client/methods/ping.method.js.map +1 -1
- package/lib/src/client/models/client.d.ts +40 -0
- package/lib/src/client/models/client.d.ts.map +1 -0
- package/lib/src/client/models/client.js +33 -0
- package/lib/src/client/models/client.js.map +1 -0
- package/lib/src/client/models/client.spec.d.ts +2 -0
- package/lib/src/client/models/client.spec.d.ts.map +1 -0
- package/lib/src/client/models/client.spec.js +224 -0
- package/lib/src/client/models/client.spec.js.map +1 -0
- package/lib/src/client/models/index.d.ts +1 -0
- package/lib/src/client/models/index.d.ts.map +1 -1
- package/lib/src/client/models/index.js +1 -0
- package/lib/src/client/models/index.js.map +1 -1
- package/lib/src/client/models/method.d.ts +4 -4
- package/lib/src/client/models/method.d.ts.map +1 -1
- package/lib/src/client/models/method.js.map +1 -1
- package/lib/src/client/onsite.d.ts +4 -3
- package/lib/src/client/onsite.d.ts.map +1 -1
- package/lib/src/client/onsite.js +8 -6
- package/lib/src/client/onsite.js.map +1 -1
- package/lib/src/client/remote.d.ts +4 -4
- package/lib/src/client/remote.d.ts.map +1 -1
- package/lib/src/client/remote.js +11 -10
- package/lib/src/client/remote.js.map +1 -1
- package/lib/src/client/types.d.ts +2 -0
- package/lib/src/client/types.d.ts.map +1 -1
- package/lib/src/client/utils.d.ts +2 -2
- package/lib/src/client/utils.d.ts.map +1 -1
- package/lib/src/client/utils.js +25 -12
- package/lib/src/client/utils.js.map +1 -1
- package/lib/src/expectations/__utils__/index.d.ts +2 -2
- package/lib/src/expectations/__utils__/index.d.ts.map +1 -1
- package/lib/src/expectations/__utils__/index.js +31 -23
- package/lib/src/expectations/__utils__/index.js.map +1 -1
- package/lib/src/expectations/index.d.ts +1 -2
- package/lib/src/expectations/index.d.ts.map +1 -1
- package/lib/src/expectations/index.js +1 -2
- package/lib/src/expectations/index.js.map +1 -1
- package/lib/src/expectations/models/expectation.d.ts +33 -0
- package/lib/src/expectations/models/expectation.d.ts.map +1 -0
- package/lib/src/expectations/models/expectation.js +81 -0
- package/lib/src/expectations/models/expectation.js.map +1 -0
- package/lib/src/expectations/models/index.d.ts +4 -0
- package/lib/src/expectations/models/index.d.ts.map +1 -0
- package/lib/src/expectations/models/index.js +20 -0
- package/lib/src/expectations/models/index.js.map +1 -0
- package/lib/src/expectations/models/operator.d.ts +20 -0
- package/lib/src/expectations/models/operator.d.ts.map +1 -0
- package/lib/src/expectations/models/operator.js +49 -0
- package/lib/src/expectations/models/operator.js.map +1 -0
- package/lib/src/expectations/models/storage.d.ts +15 -0
- package/lib/src/expectations/models/storage.d.ts.map +1 -0
- package/lib/src/expectations/{storage.js → models/storage.js} +4 -14
- package/lib/src/expectations/models/storage.js.map +1 -0
- package/lib/src/expectations/models/storage.spec.d.ts +2 -0
- package/lib/src/expectations/models/storage.spec.d.ts.map +1 -0
- package/lib/src/expectations/models/storage.spec.js +111 -0
- package/lib/src/expectations/models/storage.spec.js.map +1 -0
- package/lib/src/expectations/operators/and.operator.d.ts +7 -2
- package/lib/src/expectations/operators/and.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/and.operator.js +21 -2
- package/lib/src/expectations/operators/and.operator.js.map +1 -1
- package/lib/src/expectations/operators/and.operator.spec.js +57 -39
- package/lib/src/expectations/operators/and.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/exec.operator.d.ts +7 -2
- package/lib/src/expectations/operators/exec.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/exec.operator.js +14 -18
- package/lib/src/expectations/operators/exec.operator.js.map +1 -1
- package/lib/src/expectations/operators/exec.operator.spec.js +49 -18
- package/lib/src/expectations/operators/exec.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/has.operator.d.ts +27 -2
- package/lib/src/expectations/operators/has.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/has.operator.js +108 -69
- package/lib/src/expectations/operators/has.operator.js.map +1 -1
- package/lib/src/expectations/operators/has.operator.spec.js +422 -161
- package/lib/src/expectations/operators/has.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/if.operator.d.ts +15 -2
- package/lib/src/expectations/operators/if.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/if.operator.js +44 -10
- package/lib/src/expectations/operators/if.operator.js.map +1 -1
- package/lib/src/expectations/operators/if.operator.spec.js +89 -65
- package/lib/src/expectations/operators/if.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/index.d.ts +2 -0
- package/lib/src/expectations/operators/index.d.ts.map +1 -1
- package/lib/src/expectations/operators/index.js +5 -1
- package/lib/src/expectations/operators/index.js.map +1 -1
- package/lib/src/expectations/operators/merge.operator.d.ts +13 -2
- package/lib/src/expectations/operators/merge.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/merge.operator.js +23 -19
- package/lib/src/expectations/operators/merge.operator.js.map +1 -1
- package/lib/src/expectations/operators/merge.operator.spec.js +43 -33
- package/lib/src/expectations/operators/merge.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/not.operator.d.ts +7 -2
- package/lib/src/expectations/operators/not.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/not.operator.js +21 -2
- package/lib/src/expectations/operators/not.operator.js.map +1 -1
- package/lib/src/expectations/operators/not.operator.spec.js +28 -9
- package/lib/src/expectations/operators/not.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/or.operator.d.ts +7 -2
- package/lib/src/expectations/operators/or.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/or.operator.js +21 -6
- package/lib/src/expectations/operators/or.operator.js.map +1 -1
- package/lib/src/expectations/operators/or.operator.spec.js +58 -39
- package/lib/src/expectations/operators/or.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/remove.operator.d.ts +12 -2
- package/lib/src/expectations/operators/remove.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/remove.operator.js +22 -17
- package/lib/src/expectations/operators/remove.operator.js.map +1 -1
- package/lib/src/expectations/operators/remove.operator.spec.js +40 -28
- package/lib/src/expectations/operators/remove.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/root.operator.d.ts +8 -0
- package/lib/src/expectations/operators/root.operator.d.ts.map +1 -0
- package/lib/src/expectations/operators/root.operator.js +36 -0
- package/lib/src/expectations/operators/root.operator.js.map +1 -0
- package/lib/src/expectations/operators/set.operator.d.ts +20 -2
- package/lib/src/expectations/operators/set.operator.d.ts.map +1 -1
- package/lib/src/expectations/operators/set.operator.js +38 -23
- package/lib/src/expectations/operators/set.operator.js.map +1 -1
- package/lib/src/expectations/operators/set.operator.spec.js +87 -43
- package/lib/src/expectations/operators/set.operator.spec.js.map +1 -1
- package/lib/src/expectations/operators/switch.operator.d.ts +25 -0
- package/lib/src/expectations/operators/switch.operator.d.ts.map +1 -0
- package/lib/src/expectations/operators/switch.operator.js +68 -0
- package/lib/src/expectations/operators/switch.operator.js.map +1 -0
- package/lib/src/expectations/operators/switch.operator.spec.d.ts +2 -0
- package/lib/src/expectations/operators/switch.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/switch.operator.spec.js +129 -0
- package/lib/src/expectations/operators/switch.operator.spec.js.map +1 -0
- package/lib/src/expectations/types.d.ts +67 -63
- package/lib/src/expectations/types.d.ts.map +1 -1
- package/lib/src/expectations/types.js +17 -3
- package/lib/src/expectations/types.js.map +1 -1
- package/lib/src/expectations/utils.d.ts +23 -10
- package/lib/src/expectations/utils.d.ts.map +1 -1
- package/lib/src/expectations/utils.js +111 -53
- package/lib/src/expectations/utils.js.map +1 -1
- package/lib/src/server/endpoints/config.get.endpoint.d.ts +8 -3
- package/lib/src/server/endpoints/config.get.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/config.get.endpoint.js +2 -4
- package/lib/src/server/endpoints/config.get.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/expectations.create.endpoint.d.ts +9 -11
- package/lib/src/server/endpoints/expectations.create.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/expectations.create.endpoint.js +2 -3
- package/lib/src/server/endpoints/expectations.create.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts +8 -5
- package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/expectations.delete.endpoint.js +2 -2
- package/lib/src/server/endpoints/expectations.delete.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts +8 -3
- package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/expectations.get-list.endpoint.js +2 -2
- package/lib/src/server/endpoints/expectations.get-list.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/expectations.update.endpoint.d.ts +13 -11
- package/lib/src/server/endpoints/expectations.update.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/expectations.update.endpoint.js +4 -6
- package/lib/src/server/endpoints/expectations.update.endpoint.js.map +1 -1
- package/lib/src/server/endpoints/history.get-list.endpoint.d.ts +27 -0
- package/lib/src/server/endpoints/history.get-list.endpoint.d.ts.map +1 -0
- package/lib/src/server/endpoints/history.get-list.endpoint.js +11 -0
- package/lib/src/server/endpoints/history.get-list.endpoint.js.map +1 -0
- package/lib/src/server/endpoints/index.d.ts +1 -1
- package/lib/src/server/endpoints/index.d.ts.map +1 -1
- package/lib/src/server/endpoints/index.js +3 -3
- package/lib/src/server/endpoints/index.js.map +1 -1
- package/lib/src/server/endpoints/ping.endpoint.d.ts +8 -3
- package/lib/src/server/endpoints/ping.endpoint.d.ts.map +1 -1
- package/lib/src/server/endpoints/ping.endpoint.js +1 -1
- package/lib/src/server/endpoints/ping.endpoint.js.map +1 -1
- package/lib/src/server/history/model.d.ts +16 -16
- package/lib/src/server/history/model.d.ts.map +1 -1
- package/lib/src/server/history/model.js +21 -6
- package/lib/src/server/history/model.js.map +1 -1
- package/lib/src/server/history/storage.d.ts +3 -4
- package/lib/src/server/history/storage.d.ts.map +1 -1
- package/lib/src/server/history/storage.js +2 -2
- package/lib/src/server/history/storage.js.map +1 -1
- package/lib/src/server/index.d.ts +10 -6
- package/lib/src/server/index.d.ts.map +1 -1
- package/lib/src/server/index.js +21 -22
- package/lib/src/server/index.js.map +1 -1
- package/lib/src/server/middlewares/delay.middleware.d.ts +24 -0
- package/lib/src/server/middlewares/delay.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/delay.middleware.js +13 -0
- package/lib/src/server/middlewares/delay.middleware.js.map +1 -0
- package/lib/src/server/middlewares/destroy.midleware.d.ts +24 -0
- package/lib/src/server/middlewares/destroy.midleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/destroy.midleware.js +16 -0
- package/lib/src/server/middlewares/destroy.midleware.js.map +1 -0
- package/lib/src/server/middlewares/forward.middleware.d.ts +24 -0
- package/lib/src/server/middlewares/forward.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/forward.middleware.js +71 -0
- package/lib/src/server/middlewares/forward.middleware.js.map +1 -0
- package/lib/src/server/middlewares/history.middleware.d.ts +24 -0
- package/lib/src/server/middlewares/history.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/history.middleware.js +13 -0
- package/lib/src/server/middlewares/history.middleware.js.map +1 -0
- package/lib/src/server/middlewares/index.d.ts +7 -6
- package/lib/src/server/middlewares/index.d.ts.map +1 -1
- package/lib/src/server/middlewares/index.js +15 -13
- package/lib/src/server/middlewares/index.js.map +1 -1
- package/lib/src/server/middlewares/internal-route.middleware.d.ts +20 -2
- package/lib/src/server/middlewares/internal-route.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/internal-route.middleware.js +4 -3
- package/lib/src/server/middlewares/internal-route.middleware.js.map +1 -1
- package/lib/src/server/middlewares/manipulate-expectation.middleware.d.ts +24 -0
- package/lib/src/server/middlewares/manipulate-expectation.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/manipulate-expectation.middleware.js +13 -0
- package/lib/src/server/middlewares/manipulate-expectation.middleware.js.map +1 -0
- package/lib/src/server/middlewares/match-expectation.middleware.d.ts +24 -0
- package/lib/src/server/middlewares/match-expectation.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/match-expectation.middleware.js +20 -0
- package/lib/src/server/middlewares/match-expectation.middleware.js.map +1 -0
- package/lib/src/server/middlewares/public.middleware.d.ts +24 -0
- package/lib/src/server/middlewares/public.middleware.d.ts.map +1 -0
- package/lib/src/server/middlewares/{resolve-public.middleware.js → public.middleware.js} +13 -13
- package/lib/src/server/middlewares/public.middleware.js.map +1 -0
- package/lib/src/server/middlewares/reply.middleware.d.ts +21 -5
- package/lib/src/server/middlewares/reply.middleware.d.ts.map +1 -1
- package/lib/src/server/middlewares/reply.middleware.js +34 -25
- package/lib/src/server/middlewares/reply.middleware.js.map +1 -1
- package/lib/src/server/models/endpoint.d.ts +19 -13
- package/lib/src/server/models/endpoint.d.ts.map +1 -1
- package/lib/src/server/models/endpoint.js +2 -2
- package/lib/src/server/models/endpoint.js.map +1 -1
- package/lib/src/server/models/middleware.d.ts +21 -20
- package/lib/src/server/models/middleware.d.ts.map +1 -1
- package/lib/src/server/models/middleware.js +6 -10
- package/lib/src/server/models/middleware.js.map +1 -1
- package/lib/src/server/models/reply-service/index.d.ts +6 -6
- package/lib/src/server/models/reply-service/index.d.ts.map +1 -1
- package/lib/src/server/models/reply-service/index.js +24 -24
- package/lib/src/server/models/reply-service/index.js.map +1 -1
- package/lib/src/server/models/request-context/http.d.ts +45 -0
- package/lib/src/server/models/request-context/http.d.ts.map +1 -0
- package/lib/src/server/models/request-context/http.js +71 -0
- package/lib/src/server/models/request-context/http.js.map +1 -0
- package/lib/src/server/models/request-context/index.d.ts +4 -57
- package/lib/src/server/models/request-context/index.d.ts.map +1 -1
- package/lib/src/server/models/request-context/index.js +4 -57
- package/lib/src/server/models/request-context/index.js.map +1 -1
- package/lib/src/server/models/request-context/model.d.ts +13 -0
- package/lib/src/server/models/request-context/model.d.ts.map +1 -0
- package/lib/src/server/models/request-context/model.js +14 -0
- package/lib/src/server/models/request-context/model.js.map +1 -0
- package/lib/src/server/models/request-context/types.d.ts +16 -18
- package/lib/src/server/models/request-context/types.d.ts.map +1 -1
- package/lib/src/server/models/request-context/utils.d.ts +7 -3
- package/lib/src/server/models/request-context/utils.d.ts.map +1 -1
- package/lib/src/server/models/request-context/utils.js +48 -25
- package/lib/src/server/models/request-context/utils.js.map +1 -1
- package/lib/src/server/models/request-context/ws.d.ts +21 -0
- package/lib/src/server/models/request-context/ws.d.ts.map +1 -0
- package/lib/src/server/models/request-context/ws.js +22 -0
- package/lib/src/server/models/request-context/ws.js.map +1 -0
- package/lib/src/server/models/server-context.d.ts +4 -4
- package/lib/src/server/models/server-context.d.ts.map +1 -1
- package/lib/src/server/models/server-context.js +5 -5
- package/lib/src/server/models/server-context.js.map +1 -1
- package/lib/src/server/router.d.ts +4 -7
- package/lib/src/server/router.d.ts.map +1 -1
- package/lib/src/server/router.js +5 -12
- package/lib/src/server/router.js.map +1 -1
- package/lib/src/server/ws-exchange/index.d.ts +5 -0
- package/lib/src/server/ws-exchange/index.d.ts.map +1 -0
- package/lib/src/server/{web-socket-exchange → ws-exchange}/index.js +3 -3
- package/lib/src/server/ws-exchange/index.js.map +1 -0
- package/lib/src/server/ws-exchange/types.d.ts +12 -0
- package/lib/src/server/ws-exchange/types.d.ts.map +1 -0
- package/lib/src/server/ws-exchange/types.js.map +1 -0
- package/lib/src/types.d.ts +0 -1
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/utils/index.d.ts +1 -0
- package/lib/src/utils/index.d.ts.map +1 -1
- package/lib/src/utils/index.js +1 -0
- package/lib/src/utils/index.js.map +1 -1
- package/lib/src/utils/json.d.ts +1 -1
- package/lib/src/utils/json.d.ts.map +1 -1
- package/lib/src/utils/json.js +3 -3
- package/lib/src/utils/json.js.map +1 -1
- package/lib/src/utils/regexp.d.ts +2 -0
- package/lib/src/utils/regexp.d.ts.map +1 -0
- package/lib/src/utils/regexp.js +9 -0
- package/lib/src/utils/regexp.js.map +1 -0
- package/lib/test/index.js +140 -136
- package/lib/test/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/common.global.d.ts +13 -6
- package/lib/types/common.global.d.ts.map +1 -1
- package/lib/types/lib.d.ts +1 -0
- package/lib/types/lib.d.ts.map +1 -1
- package/lib/types/lib.js +1 -0
- package/lib/types/lib.js.map +1 -1
- package/package.json +5 -2
- package/types/common.global.ts +21 -2
- package/types/lib.ts +1 -0
- package/lib/src/expectations/model.d.ts +0 -39
- package/lib/src/expectations/model.d.ts.map +0 -1
- package/lib/src/expectations/model.js +0 -90
- package/lib/src/expectations/model.js.map +0 -1
- package/lib/src/expectations/operators/utils.d.ts +0 -20
- package/lib/src/expectations/operators/utils.d.ts.map +0 -1
- package/lib/src/expectations/operators/utils.js +0 -67
- package/lib/src/expectations/operators/utils.js.map +0 -1
- package/lib/src/expectations/storage.d.ts +0 -19
- package/lib/src/expectations/storage.d.ts.map +0 -1
- package/lib/src/expectations/storage.js.map +0 -1
- package/lib/src/expectations/utils.spec.d.ts +0 -2
- package/lib/src/expectations/utils.spec.d.ts.map +0 -1
- package/lib/src/expectations/utils.spec.js +0 -59
- package/lib/src/expectations/utils.spec.js.map +0 -1
- package/lib/src/expectations/validation-schemas.d.ts +0 -14
- package/lib/src/expectations/validation-schemas.d.ts.map +0 -1
- package/lib/src/expectations/validation-schemas.js +0 -36
- package/lib/src/expectations/validation-schemas.js.map +0 -1
- package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts +0 -16
- package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts.map +0 -1
- package/lib/src/server/endpoints/history-records.get-list.endpoint.js +0 -9
- package/lib/src/server/endpoints/history-records.get-list.endpoint.js.map +0 -1
- package/lib/src/server/middlewares/add-history.middleware.d.ts +0 -8
- package/lib/src/server/middlewares/add-history.middleware.d.ts.map +0 -1
- package/lib/src/server/middlewares/add-history.middleware.js +0 -14
- package/lib/src/server/middlewares/add-history.middleware.js.map +0 -1
- package/lib/src/server/middlewares/destroy-request.midleware.d.ts +0 -8
- package/lib/src/server/middlewares/destroy-request.midleware.d.ts.map +0 -1
- package/lib/src/server/middlewares/destroy-request.midleware.js +0 -17
- package/lib/src/server/middlewares/destroy-request.midleware.js.map +0 -1
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts +0 -8
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts.map +0 -1
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.js +0 -18
- package/lib/src/server/middlewares/handle-expectation-delay.middleware.js.map +0 -1
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts +0 -8
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts.map +0 -1
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.js +0 -86
- package/lib/src/server/middlewares/handle-expectation-forward.middleware.js.map +0 -1
- package/lib/src/server/middlewares/resolve-public.middleware.d.ts +0 -6
- package/lib/src/server/middlewares/resolve-public.middleware.d.ts.map +0 -1
- package/lib/src/server/middlewares/resolve-public.middleware.js.map +0 -1
- package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts +0 -6
- package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts.map +0 -1
- package/lib/src/server/middlewares/validate-expectation-request.middleware.js +0 -20
- package/lib/src/server/middlewares/validate-expectation-request.middleware.js.map +0 -1
- package/lib/src/server/types.d.ts +0 -6
- package/lib/src/server/types.d.ts.map +0 -1
- package/lib/src/server/types.js.map +0 -1
- package/lib/src/server/web-socket-exchange/index.d.ts +0 -5
- package/lib/src/server/web-socket-exchange/index.d.ts.map +0 -1
- package/lib/src/server/web-socket-exchange/index.js.map +0 -1
- package/lib/src/server/web-socket-exchange/types.d.ts +0 -12
- package/lib/src/server/web-socket-exchange/types.d.ts.map +0 -1
- package/lib/src/server/web-socket-exchange/types.js +0 -3
- package/lib/src/server/web-socket-exchange/types.js.map +0 -1
- /package/lib/src/server/{types.js → ws-exchange/types.js} +0 -0
|
@@ -1,173 +1,434 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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
|
|
8
|
-
const has_operator_1 = __importDefault(require("./has.operator"));
|
|
27
|
+
const operators = __importStar(require("./index"));
|
|
9
28
|
describe('Expectations.Operators.Has', () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|