@n1k1t/mock-server 0.1.59 → 0.1.61
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/bin/index.ts +33 -0
- package/coverage/clover.xml +1372 -0
- package/coverage/cobertura-coverage.xml +3466 -0
- package/coverage/coverage-final.json +76 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/client/errors/connection.error.ts.html +106 -0
- package/coverage/lcov-report/client/errors/index.html +161 -0
- package/coverage/lcov-report/client/errors/index.ts.html +97 -0
- package/coverage/lcov-report/client/errors/internal-server.error.ts.html +115 -0
- package/coverage/lcov-report/client/errors/validation.error.ts.html +115 -0
- package/coverage/lcov-report/client/helpers/expectations.ts.html +766 -0
- package/coverage/lcov-report/client/helpers/index.html +131 -0
- package/coverage/lcov-report/client/helpers/index.ts.html +88 -0
- package/coverage/lcov-report/client/index.html +161 -0
- package/coverage/lcov-report/client/index.ts.html +100 -0
- package/coverage/lcov-report/client/methods/expectations-group.update.method.ts.html +193 -0
- package/coverage/lcov-report/client/methods/expectations.create.method.ts.html +202 -0
- package/coverage/lcov-report/client/methods/expectations.delete.method.ts.html +184 -0
- package/coverage/lcov-report/client/methods/expectations.update.method.ts.html +241 -0
- package/coverage/lcov-report/client/methods/index.html +191 -0
- package/coverage/lcov-report/client/methods/index.ts.html +103 -0
- package/coverage/lcov-report/client/methods/ping.method.ts.html +160 -0
- package/coverage/lcov-report/client/models/client.ts.html +340 -0
- package/coverage/lcov-report/client/models/index.html +146 -0
- package/coverage/lcov-report/client/models/index.ts.html +91 -0
- package/coverage/lcov-report/client/models/method.ts.html +235 -0
- package/coverage/lcov-report/client/onsite.ts.html +172 -0
- package/coverage/lcov-report/client/remote.ts.html +187 -0
- package/coverage/lcov-report/client/utils.ts.html +211 -0
- package/coverage/lcov-report/config/index.html +131 -0
- package/coverage/lcov-report/config/index.ts.html +97 -0
- package/coverage/lcov-report/config/model.ts.html +226 -0
- package/coverage/lcov-report/expectations/__utils__/index.html +116 -0
- package/coverage/lcov-report/expectations/__utils__/index.ts.html +268 -0
- package/coverage/lcov-report/expectations/index.html +146 -0
- package/coverage/lcov-report/expectations/index.ts.html +94 -0
- package/coverage/lcov-report/expectations/models/expectation.ts.html +373 -0
- package/coverage/lcov-report/expectations/models/index.html +161 -0
- package/coverage/lcov-report/expectations/models/index.ts.html +94 -0
- package/coverage/lcov-report/expectations/models/operator.ts.html +352 -0
- package/coverage/lcov-report/expectations/models/storage.ts.html +211 -0
- package/coverage/lcov-report/expectations/operators/and.operator.ts.html +196 -0
- package/coverage/lcov-report/expectations/operators/exec.operator.ts.html +160 -0
- package/coverage/lcov-report/expectations/operators/has.operator.ts.html +778 -0
- package/coverage/lcov-report/expectations/operators/if.operator.ts.html +316 -0
- package/coverage/lcov-report/expectations/operators/index.html +281 -0
- package/coverage/lcov-report/expectations/operators/index.ts.html +118 -0
- package/coverage/lcov-report/expectations/operators/merge.operator.ts.html +379 -0
- package/coverage/lcov-report/expectations/operators/not.operator.ts.html +199 -0
- package/coverage/lcov-report/expectations/operators/or.operator.ts.html +196 -0
- package/coverage/lcov-report/expectations/operators/remove.operator.ts.html +238 -0
- package/coverage/lcov-report/expectations/operators/root.operator.ts.html +238 -0
- package/coverage/lcov-report/expectations/operators/set.operator.ts.html +436 -0
- package/coverage/lcov-report/expectations/operators/switch.operator.ts.html +463 -0
- package/coverage/lcov-report/expectations/types.ts.html +766 -0
- package/coverage/lcov-report/expectations/utils.ts.html +802 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +431 -0
- package/coverage/lcov-report/logger/index.html +131 -0
- package/coverage/lcov-report/logger/index.ts.html +325 -0
- package/coverage/lcov-report/logger/utils.ts.html +160 -0
- package/coverage/lcov-report/meta/index.html +146 -0
- package/coverage/lcov-report/meta/index.ts.html +103 -0
- package/coverage/lcov-report/meta/model.ts.html +172 -0
- package/coverage/lcov-report/meta/storage.ts.html +145 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/server/expectations/__utils__/index.html +116 -0
- package/coverage/lcov-report/server/expectations/__utils__/index.ts.html +199 -0
- package/coverage/lcov-report/server/expectations/index.html +131 -0
- package/coverage/lcov-report/server/expectations/operators/and.operator.ts.html +103 -0
- package/coverage/lcov-report/server/expectations/operators/exec.operator.ts.html +139 -0
- package/coverage/lcov-report/server/expectations/operators/has.operator.ts.html +358 -0
- package/coverage/lcov-report/server/expectations/operators/if.operator.ts.html +130 -0
- package/coverage/lcov-report/server/expectations/operators/index.html +266 -0
- package/coverage/lcov-report/server/expectations/operators/index.ts.html +112 -0
- package/coverage/lcov-report/server/expectations/operators/merge.operator.ts.html +193 -0
- package/coverage/lcov-report/server/expectations/operators/not.operator.ts.html +100 -0
- package/coverage/lcov-report/server/expectations/operators/or.operator.ts.html +115 -0
- package/coverage/lcov-report/server/expectations/operators/remove.operator.ts.html +169 -0
- package/coverage/lcov-report/server/expectations/operators/set.operator.ts.html +208 -0
- package/coverage/lcov-report/server/expectations/operators/utils.ts.html +346 -0
- package/coverage/lcov-report/server/expectations/types.ts.html +517 -0
- package/coverage/lcov-report/server/expectations/utils.ts.html +358 -0
- package/coverage/lcov-report/server/models/containers/index.html +161 -0
- package/coverage/lcov-report/server/models/containers/index.ts.html +91 -0
- package/coverage/lcov-report/server/models/containers/model.ts.html +328 -0
- package/coverage/lcov-report/server/models/containers/storage.ts.html +256 -0
- package/coverage/lcov-report/server/models/containers/utils.ts.html +97 -0
- package/coverage/lcov-report/server/models/context/index.html +146 -0
- package/coverage/lcov-report/server/models/context/index.ts.html +514 -0
- package/coverage/lcov-report/server/models/context/snapshot.ts.html +529 -0
- package/coverage/lcov-report/server/models/context/utils.ts.html +382 -0
- package/coverage/lcov-report/server/models/endpoint.ts.html +304 -0
- package/coverage/lcov-report/server/models/exchanges/index.html +131 -0
- package/coverage/lcov-report/server/models/exchanges/index.ts.html +88 -0
- package/coverage/lcov-report/server/models/exchanges/socket-io.ts.html +154 -0
- package/coverage/lcov-report/server/models/executor/errors/index.html +116 -0
- package/coverage/lcov-report/server/models/executor/errors/index.ts.html +130 -0
- package/coverage/lcov-report/server/models/executor/index.html +116 -0
- package/coverage/lcov-report/server/models/executor/index.ts.html +1018 -0
- package/coverage/lcov-report/server/models/history/index.html +146 -0
- package/coverage/lcov-report/server/models/history/index.ts.html +91 -0
- package/coverage/lcov-report/server/models/history/model.ts.html +331 -0
- package/coverage/lcov-report/server/models/history/storage.ts.html +184 -0
- package/coverage/lcov-report/server/models/index.html +161 -0
- package/coverage/lcov-report/server/models/index.ts.html +115 -0
- package/coverage/lcov-report/server/models/providers/index.html +146 -0
- package/coverage/lcov-report/server/models/providers/index.ts.html +91 -0
- package/coverage/lcov-report/server/models/providers/model.ts.html +211 -0
- package/coverage/lcov-report/server/models/providers/storage.ts.html +172 -0
- package/coverage/lcov-report/server/models/reply.ts.html +115 -0
- package/coverage/lcov-report/server/models/router.ts.html +313 -0
- package/coverage/lcov-report/server/models/transports/index.html +146 -0
- package/coverage/lcov-report/server/models/transports/index.ts.html +91 -0
- package/coverage/lcov-report/server/models/transports/model.ts.html +112 -0
- package/coverage/lcov-report/server/models/transports/storage.ts.html +124 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/utils/common.ts.html +187 -0
- package/coverage/lcov-report/utils/index.html +176 -0
- package/coverage/lcov-report/utils/index.ts.html +97 -0
- package/coverage/lcov-report/utils/json.ts.html +193 -0
- package/coverage/lcov-report/utils/regexp.ts.html +97 -0
- package/coverage/lcov-report/utils/validation.ts.html +190 -0
- package/coverage/lcov.info +3012 -0
- package/discardedTests.txt +35606 -0
- package/images/preview.png +0 -0
- package/images/strategy.png +0 -0
- package/keploy.yml +64 -0
- package/lib/package.json +1 -1
- package/lib/src/client/errors/connection.error.spec.d.ts +2 -0
- package/lib/src/client/errors/connection.error.spec.d.ts.map +1 -0
- package/lib/src/client/errors/connection.error.spec.js +12 -0
- package/lib/src/client/errors/connection.error.spec.js.map +1 -0
- package/lib/src/client/errors/internal-server.error.spec.d.ts +2 -0
- package/lib/src/client/errors/internal-server.error.spec.d.ts.map +1 -0
- package/lib/src/client/errors/internal-server.error.spec.js +12 -0
- package/lib/src/client/errors/internal-server.error.spec.js.map +1 -0
- package/lib/src/client/errors/validation.error.spec.d.ts +2 -0
- package/lib/src/client/errors/validation.error.spec.d.ts.map +1 -0
- package/lib/src/client/errors/validation.error.spec.js +10 -0
- package/lib/src/client/errors/validation.error.spec.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 +244 -0
- package/lib/src/client/models/client.spec.js.map +1 -0
- package/lib/src/client/onsite.spec.d.ts +2 -0
- package/lib/src/client/onsite.spec.d.ts.map +1 -0
- package/lib/src/client/onsite.spec.js +23 -0
- package/lib/src/client/onsite.spec.js.map +1 -0
- package/lib/src/client/remote.spec.d.ts +2 -0
- package/lib/src/client/remote.spec.d.ts.map +1 -0
- package/lib/src/client/remote.spec.js +16 -0
- package/lib/src/client/remote.spec.js.map +1 -0
- package/lib/src/client/utils.spec.d.ts +2 -0
- package/lib/src/client/utils.spec.d.ts.map +1 -0
- package/lib/src/client/utils.spec.js +57 -0
- package/lib/src/client/utils.spec.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 +57 -0
- package/lib/src/expectations/models/storage.spec.js.map +1 -0
- package/lib/src/expectations/operators/and.operator.spec.d.ts +2 -0
- package/lib/src/expectations/operators/and.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/and.operator.spec.js +83 -0
- package/lib/src/expectations/operators/and.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/exec.operator.spec.d.ts +2 -0
- package/lib/src/expectations/operators/exec.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/exec.operator.spec.js +68 -0
- package/lib/src/expectations/operators/exec.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/has.operator.spec.d.ts +2 -0
- package/lib/src/expectations/operators/has.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/has.operator.spec.js +444 -0
- package/lib/src/expectations/operators/has.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/if.operator.spec.d.ts +2 -0
- package/lib/src/expectations/operators/if.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/if.operator.spec.js +132 -0
- package/lib/src/expectations/operators/if.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/merge.operator.spec.d.ts +2 -0
- package/lib/src/expectations/operators/merge.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/merge.operator.spec.js +75 -0
- package/lib/src/expectations/operators/merge.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/not.operator.spec.d.ts +2 -0
- package/lib/src/expectations/operators/not.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/not.operator.spec.js +46 -0
- package/lib/src/expectations/operators/not.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/or.operator.spec.d.ts +2 -0
- package/lib/src/expectations/operators/or.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/or.operator.spec.js +84 -0
- package/lib/src/expectations/operators/or.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/remove.operator.spec.d.ts +2 -0
- package/lib/src/expectations/operators/remove.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/remove.operator.spec.js +67 -0
- package/lib/src/expectations/operators/remove.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/root.operator.spec.d.ts +2 -0
- package/lib/src/expectations/operators/root.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/root.operator.spec.js +29 -0
- package/lib/src/expectations/operators/root.operator.spec.js.map +1 -0
- package/lib/src/expectations/operators/set.operator.spec.d.ts +2 -0
- package/lib/src/expectations/operators/set.operator.spec.d.ts.map +1 -0
- package/lib/src/expectations/operators/set.operator.spec.js +111 -0
- package/lib/src/expectations/operators/set.operator.spec.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 +139 -0
- package/lib/src/expectations/operators/switch.operator.spec.js.map +1 -0
- package/lib/src/expectations/utils/location.spec.d.ts +2 -0
- package/lib/src/expectations/utils/location.spec.d.ts.map +1 -0
- package/lib/src/expectations/utils/location.spec.js +62 -0
- package/lib/src/expectations/utils/location.spec.js.map +1 -0
- package/lib/src/expectations/utils/schema.spec.d.ts +2 -0
- package/lib/src/expectations/utils/schema.spec.d.ts.map +1 -0
- package/lib/src/expectations/utils/schema.spec.js +19 -0
- package/lib/src/expectations/utils/schema.spec.js.map +1 -0
- package/lib/src/gui/app/types/dev.d.ts +7 -0
- package/lib/src/gui/app/types/dev.d.ts.map +1 -0
- package/lib/src/gui/app/types/dev.js +3 -0
- package/lib/src/gui/app/types/dev.js.map +1 -0
- package/lib/src/gui/app/types/index.d.ts +2 -0
- package/lib/src/gui/app/types/index.d.ts.map +1 -0
- package/lib/src/gui/app/types/index.js +18 -0
- package/lib/src/gui/app/types/index.js.map +1 -0
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/meta/model.spec.d.ts +2 -0
- package/lib/src/meta/model.spec.d.ts.map +1 -0
- package/lib/src/meta/model.spec.js +28 -0
- package/lib/src/meta/model.spec.js.map +1 -0
- package/lib/src/meta/storage.spec.d.ts +2 -0
- package/lib/src/meta/storage.spec.d.ts.map +1 -0
- package/lib/src/meta/storage.spec.js +19 -0
- package/lib/src/meta/storage.spec.js.map +1 -0
- package/lib/src/server/models/containers/model.spec.d.ts +2 -0
- package/lib/src/server/models/containers/model.spec.d.ts.map +1 -0
- package/lib/src/server/models/containers/model.spec.js +79 -0
- package/lib/src/server/models/containers/model.spec.js.map +1 -0
- package/lib/src/server/models/containers/storage.spec.d.ts +2 -0
- package/lib/src/server/models/containers/storage.spec.d.ts.map +1 -0
- package/lib/src/server/models/containers/storage.spec.js +39 -0
- package/lib/src/server/models/containers/storage.spec.js.map +1 -0
- package/lib/src/server/models/context/index.spec.d.ts +2 -0
- package/lib/src/server/models/context/index.spec.d.ts.map +1 -0
- package/lib/src/server/models/context/index.spec.js +143 -0
- package/lib/src/server/models/context/index.spec.js.map +1 -0
- package/lib/src/server/models/context/snapshot.spec.d.ts +2 -0
- package/lib/src/server/models/context/snapshot.spec.d.ts.map +1 -0
- package/lib/src/server/models/context/snapshot.spec.js +75 -0
- package/lib/src/server/models/context/snapshot.spec.js.map +1 -0
- package/lib/src/server/models/context/utils.spec.d.ts +2 -0
- package/lib/src/server/models/context/utils.spec.d.ts.map +1 -0
- package/lib/src/server/models/context/utils.spec.js +69 -0
- package/lib/src/server/models/context/utils.spec.js.map +1 -0
- package/lib/src/server/models/endpoint.spec.d.ts +2 -0
- package/lib/src/server/models/endpoint.spec.d.ts.map +1 -0
- package/lib/src/server/models/endpoint.spec.js +28 -0
- package/lib/src/server/models/endpoint.spec.js.map +1 -0
- package/lib/src/server/models/exchanges/socket-io.spec.d.ts +2 -0
- package/lib/src/server/models/exchanges/socket-io.spec.d.ts.map +1 -0
- package/lib/src/server/models/exchanges/socket-io.spec.js +12 -0
- package/lib/src/server/models/exchanges/socket-io.spec.js.map +1 -0
- package/lib/src/server/models/executor/errors/index.spec.d.ts +2 -0
- package/lib/src/server/models/executor/errors/index.spec.d.ts.map +1 -0
- package/lib/src/server/models/executor/errors/index.spec.js +23 -0
- package/lib/src/server/models/executor/errors/index.spec.js.map +1 -0
- package/lib/src/server/models/executor/index.spec.d.ts +2 -0
- package/lib/src/server/models/executor/index.spec.d.ts.map +1 -0
- package/lib/src/server/models/executor/index.spec.js +137 -0
- package/lib/src/server/models/executor/index.spec.js.map +1 -0
- package/lib/src/server/models/history/model.spec.d.ts +2 -0
- package/lib/src/server/models/history/model.spec.d.ts.map +1 -0
- package/lib/src/server/models/history/model.spec.js +30 -0
- package/lib/src/server/models/history/model.spec.js.map +1 -0
- package/lib/src/server/models/history/storage.spec.d.ts +2 -0
- package/lib/src/server/models/history/storage.spec.d.ts.map +1 -0
- package/lib/src/server/models/history/storage.spec.js +42 -0
- package/lib/src/server/models/history/storage.spec.js.map +1 -0
- package/lib/src/server/models/providers/model.spec.d.ts +2 -0
- package/lib/src/server/models/providers/model.spec.d.ts.map +1 -0
- package/lib/src/server/models/providers/model.spec.js +13 -0
- package/lib/src/server/models/providers/model.spec.js.map +1 -0
- package/lib/src/server/models/providers/storage.spec.d.ts +2 -0
- package/lib/src/server/models/providers/storage.spec.d.ts.map +1 -0
- package/lib/src/server/models/providers/storage.spec.js +19 -0
- package/lib/src/server/models/providers/storage.spec.js.map +1 -0
- package/lib/src/server/models/reply.spec.d.ts +2 -0
- package/lib/src/server/models/reply.spec.d.ts.map +1 -0
- package/lib/src/server/models/reply.spec.js +20 -0
- package/lib/src/server/models/reply.spec.js.map +1 -0
- package/lib/src/server/models/router.spec.d.ts +2 -0
- package/lib/src/server/models/router.spec.d.ts.map +1 -0
- package/lib/src/server/models/router.spec.js +46 -0
- package/lib/src/server/models/router.spec.js.map +1 -0
- package/lib/src/server/models/transports/storage.spec.d.ts +2 -0
- package/lib/src/server/models/transports/storage.spec.d.ts.map +1 -0
- package/lib/src/server/models/transports/storage.spec.js +13 -0
- package/lib/src/server/models/transports/storage.spec.js.map +1 -0
- package/lib/src/server/services/analytics.service.spec.d.ts +2 -0
- package/lib/src/server/services/analytics.service.spec.d.ts.map +1 -0
- package/lib/src/server/services/analytics.service.spec.js +35 -0
- package/lib/src/server/services/analytics.service.spec.js.map +1 -0
- package/lib/src/server/services/metrics.service.spec.d.ts +2 -0
- package/lib/src/server/services/metrics.service.spec.d.ts.map +1 -0
- package/lib/src/server/services/metrics.service.spec.js +35 -0
- package/lib/src/server/services/metrics.service.spec.js.map +1 -0
- package/lib/src/server/types/index.d.ts +27 -0
- package/lib/src/server/types/index.d.ts.map +1 -0
- package/lib/src/server/types/index.js +3 -0
- package/lib/src/server/types/index.js.map +1 -0
- package/lib/src/utils/index.spec.d.ts +2 -0
- package/lib/src/utils/index.spec.d.ts.map +1 -0
- package/lib/src/utils/index.spec.js +30 -0
- package/lib/src/utils/index.spec.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/common.d.ts +73 -0
- package/lib/types/common.d.ts.map +1 -0
- package/lib/types/common.js +3 -0
- package/lib/types/common.js.map +1 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +18 -0
- package/lib/types/index.js.map +1 -0
- package/lib/vite.config.d.ts +3 -0
- package/lib/vite.config.d.ts.map +1 -0
- package/lib/vite.config.js +57 -0
- package/lib/vite.config.js.map +1 -0
- package/package.json +1 -1
- package/src/client/errors/connection.error.spec.ts +10 -0
- package/src/client/errors/connection.error.ts +7 -0
- package/src/client/errors/index.ts +4 -0
- package/src/client/errors/internal-server.error.spec.ts +12 -0
- package/src/client/errors/internal-server.error.ts +10 -0
- package/src/client/errors/types.ts +3 -0
- package/src/client/errors/validation.error.spec.ts +9 -0
- package/src/client/errors/validation.error.ts +10 -0
- package/src/client/helpers/expectations.ts +227 -0
- package/src/client/helpers/index.ts +1 -0
- package/src/client/index.ts +5 -0
- package/src/client/methods/expectations-group.update.method.ts +36 -0
- package/src/client/methods/expectations.create.method.ts +39 -0
- package/src/client/methods/expectations.delete.method.ts +33 -0
- package/src/client/methods/expectations.update.method.ts +58 -0
- package/src/client/methods/index.ts +6 -0
- package/src/client/methods/ping.method.ts +25 -0
- package/src/client/models/__snapshots__/client.spec.ts.snap +1294 -0
- package/src/client/models/client.spec.ts +316 -0
- package/src/client/models/client.ts +85 -0
- package/src/client/models/index.ts +2 -0
- package/src/client/models/method.ts +50 -0
- package/src/client/onsite.spec.ts +23 -0
- package/src/client/onsite.ts +29 -0
- package/src/client/remote.spec.ts +15 -0
- package/src/client/remote.ts +34 -0
- package/src/client/types.ts +31 -0
- package/src/client/utils.spec.ts +60 -0
- package/src/client/utils.ts +41 -0
- package/src/config/index.ts +34 -0
- package/src/config/model.ts +24 -0
- package/src/expectations/__utils__/index.ts +61 -0
- package/src/expectations/errors/index.ts +7 -0
- package/src/expectations/index.ts +3 -0
- package/src/expectations/models/expectation.ts +96 -0
- package/src/expectations/models/index.ts +3 -0
- package/src/expectations/models/operator.ts +89 -0
- package/src/expectations/models/storage.spec.ts +70 -0
- package/src/expectations/models/storage.ts +42 -0
- package/src/expectations/operators/and.operator.spec.ts +59 -0
- package/src/expectations/operators/and.operator.ts +37 -0
- package/src/expectations/operators/exec.operator.spec.ts +47 -0
- package/src/expectations/operators/exec.operator.ts +25 -0
- package/src/expectations/operators/has.operator.spec.ts +514 -0
- package/src/expectations/operators/has.operator.ts +230 -0
- package/src/expectations/operators/if.operator.spec.ts +116 -0
- package/src/expectations/operators/if.operator.ts +77 -0
- package/src/expectations/operators/index.ts +11 -0
- package/src/expectations/operators/merge.operator.spec.ts +48 -0
- package/src/expectations/operators/merge.operator.ts +97 -0
- package/src/expectations/operators/not.operator.spec.ts +12 -0
- package/src/expectations/operators/not.operator.ts +38 -0
- package/src/expectations/operators/or.operator.spec.ts +60 -0
- package/src/expectations/operators/or.operator.ts +37 -0
- package/src/expectations/operators/remove.operator.spec.ts +40 -0
- package/src/expectations/operators/remove.operator.ts +50 -0
- package/src/expectations/operators/root.operator.spec.ts +26 -0
- package/src/expectations/operators/root.operator.ts +51 -0
- package/src/expectations/operators/set.operator.spec.ts +96 -0
- package/src/expectations/operators/set.operator.ts +116 -0
- package/src/expectations/operators/switch.operator.spec.ts +157 -0
- package/src/expectations/operators/switch.operator.ts +126 -0
- package/src/expectations/types.ts +225 -0
- package/src/expectations/utils/index.ts +3 -0
- package/src/expectations/utils/json.ts +22 -0
- package/src/expectations/utils/location.spec.ts +64 -0
- package/src/expectations/utils/location.ts +180 -0
- package/src/expectations/utils/schema.spec.ts +17 -0
- package/src/expectations/utils/schema.ts +60 -0
- package/src/gui/app/components/chart.component/index.ts +173 -0
- package/src/gui/app/components/chart.component/style.scss +4 -0
- package/src/gui/app/components/checkbox-area.component/index.ts +101 -0
- package/src/gui/app/components/checkbox-area.component/item.component.ts +72 -0
- package/src/gui/app/components/checkbox-area.component/style.scss +19 -0
- package/src/gui/app/components/checkbox-area.component/template.hbs +3 -0
- package/src/gui/app/components/curtain.component/index.ts +19 -0
- package/src/gui/app/components/curtain.component/style.scss +14 -0
- package/src/gui/app/components/empty.component/index.ts +10 -0
- package/src/gui/app/components/empty.component/style.scss +34 -0
- package/src/gui/app/components/empty.component/template.hbs +6 -0
- package/src/gui/app/components/expectation.component/index.ts +60 -0
- package/src/gui/app/components/expectation.component/style.scss +5 -0
- package/src/gui/app/components/expectation.component/template.hbs +5 -0
- package/src/gui/app/components/header.component/index.ts +81 -0
- package/src/gui/app/components/header.component/style.scss +46 -0
- package/src/gui/app/components/header.component/template.hbs +15 -0
- package/src/gui/app/components/history.component/index.ts +86 -0
- package/src/gui/app/components/history.component/style.scss +5 -0
- package/src/gui/app/components/history.component/template.hbs +62 -0
- package/src/gui/app/components/index.ts +11 -0
- package/src/gui/app/components/loader.component/index.ts +12 -0
- package/src/gui/app/components/loader.component/style.scss +39 -0
- package/src/gui/app/components/panel.component/index.ts +52 -0
- package/src/gui/app/components/panel.component/style.scss +60 -0
- package/src/gui/app/components/panel.component/template.hbs +13 -0
- package/src/gui/app/components/popups.component/index.ts +26 -0
- package/src/gui/app/components/popups.component/style.scss +51 -0
- package/src/gui/app/components/popups.component/template.hbs +9 -0
- package/src/gui/app/components/search.component/index.ts +67 -0
- package/src/gui/app/components/search.component/style.scss +43 -0
- package/src/gui/app/components/search.component/template.hbs +7 -0
- package/src/gui/app/components/viewer.component/index.ts +28 -0
- package/src/gui/app/components/viewer.component/style.scss +38 -0
- package/src/gui/app/components/viewer.component/template.hbs +3 -0
- package/src/gui/app/context.ts +76 -0
- package/src/gui/app/handlebars/helpers.ts +32 -0
- package/src/gui/app/handlebars/index.ts +11 -0
- package/src/gui/app/handlebars/partials/expectation-meta.hbs +53 -0
- package/src/gui/app/handlebars/partials/index.ts +2 -0
- package/src/gui/app/handlebars/partials/truncated.hbs +10 -0
- package/src/gui/app/handlebars/utils.ts +9 -0
- package/src/gui/app/main.ts +38 -0
- package/src/gui/app/models/button.ts +41 -0
- package/src/gui/app/models/client-storage.ts +21 -0
- package/src/gui/app/models/component.ts +79 -0
- package/src/gui/app/models/context.ts +14 -0
- package/src/gui/app/models/dynamic-storage.ts +36 -0
- package/src/gui/app/models/form.ts +75 -0
- package/src/gui/app/models/index.ts +7 -0
- package/src/gui/app/models/section.ts +82 -0
- package/src/gui/app/sections/analytics.section/index.ts +97 -0
- package/src/gui/app/sections/analytics.section/style.scss +1 -0
- package/src/gui/app/sections/analytics.section/template.hbs +6 -0
- package/src/gui/app/sections/expectations.section/index.ts +179 -0
- package/src/gui/app/sections/expectations.section/style.scss +1 -0
- package/src/gui/app/sections/expectations.section/template.hbs +15 -0
- package/src/gui/app/sections/history.section/index.ts +175 -0
- package/src/gui/app/sections/history.section/style.scss +10 -0
- package/src/gui/app/sections/history.section/templates/actions.hbs +5 -0
- package/src/gui/app/sections/history.section/templates/section.hbs +15 -0
- package/src/gui/app/sections/index.ts +4 -0
- package/src/gui/app/sections/settings.section/index.ts +63 -0
- package/src/gui/app/sections/settings.section/style.scss +24 -0
- package/src/gui/app/sections/settings.section/templates/cache.hbs +6 -0
- package/src/gui/app/sections/settings.section/templates/section.hbs +6 -0
- package/src/gui/app/sections/settings.section/templates/stats.hbs +6 -0
- package/src/gui/app/setup.ts +7 -0
- package/src/gui/app/tsconfig.json +20 -0
- package/src/gui/app/types/dev.ts +6 -0
- package/src/gui/app/types/index.ts +1 -0
- package/src/gui/app/types/window.global.ts +9 -0
- package/src/gui/app/utils.ts +15 -0
- package/src/gui/assets/fa-all.css +5 -0
- package/src/gui/assets/fa-regular-400.woff2 +0 -0
- package/src/gui/assets/fa-solid-900.woff2 +0 -0
- package/src/gui/assets/favicon.png +0 -0
- package/src/gui/index.html +18 -0
- package/src/gui/styles/_constants.scss +11 -0
- package/src/gui/styles/_elements.scss +216 -0
- package/src/gui/styles/_soon.scss +35 -0
- package/src/gui/styles/main.scss +245 -0
- package/src/index.ts +9 -0
- package/src/logger/index.ts +80 -0
- package/src/logger/types.ts +4 -0
- package/src/logger/utils.ts +25 -0
- package/src/meta/index.ts +6 -0
- package/src/meta/model.spec.ts +28 -0
- package/src/meta/model.ts +29 -0
- package/src/meta/storage.spec.ts +18 -0
- package/src/meta/storage.ts +20 -0
- package/src/server/endpoints/cache.delete.endpoint.ts +54 -0
- package/src/server/endpoints/cache.usage.get.endpoint.ts +12 -0
- package/src/server/endpoints/config.get.endpoint.ts +10 -0
- package/src/server/endpoints/expectations-group.update.endpoint.ts +32 -0
- package/src/server/endpoints/expectations.create.endpoint.ts +23 -0
- package/src/server/endpoints/expectations.delete.endpoint.ts +12 -0
- package/src/server/endpoints/expectations.get-list.endpoint.ts +15 -0
- package/src/server/endpoints/expectations.update.endpoint.ts +29 -0
- package/src/server/endpoints/gui.endpoint.ts +76 -0
- package/src/server/endpoints/history.delete.endpoint.ts +10 -0
- package/src/server/endpoints/history.get-list.endpoint.ts +15 -0
- package/src/server/endpoints/index.ts +18 -0
- package/src/server/endpoints/metrics.endpoint.ts +12 -0
- package/src/server/endpoints/ping.endpoint.ts +7 -0
- package/src/server/endpoints/stats.endpoint.ts +20 -0
- package/src/server/index.ts +182 -0
- package/src/server/models/containers/index.ts +2 -0
- package/src/server/models/containers/model.spec.ts +81 -0
- package/src/server/models/containers/model.ts +79 -0
- package/src/server/models/containers/storage.spec.ts +41 -0
- package/src/server/models/containers/storage.ts +59 -0
- package/src/server/models/containers/utils.ts +4 -0
- package/src/server/models/context/index.spec.ts +171 -0
- package/src/server/models/context/index.ts +136 -0
- package/src/server/models/context/snapshot.spec.ts +84 -0
- package/src/server/models/context/snapshot.ts +148 -0
- package/src/server/models/context/types.ts +65 -0
- package/src/server/models/context/utils.spec.ts +77 -0
- package/src/server/models/context/utils.ts +99 -0
- package/src/server/models/endpoint.spec.ts +28 -0
- package/src/server/models/endpoint.ts +69 -0
- package/src/server/models/exchanges/index.ts +1 -0
- package/src/server/models/exchanges/socket-io.spec.ts +13 -0
- package/src/server/models/exchanges/socket-io.ts +14 -0
- package/src/server/models/executor/errors/index.spec.ts +23 -0
- package/src/server/models/executor/errors/index.ts +15 -0
- package/src/server/models/executor/index.spec.ts +148 -0
- package/src/server/models/executor/index.ts +297 -0
- package/src/server/models/history/index.ts +2 -0
- package/src/server/models/history/model.spec.ts +35 -0
- package/src/server/models/history/model.ts +82 -0
- package/src/server/models/history/storage.spec.ts +41 -0
- package/src/server/models/history/storage.ts +38 -0
- package/src/server/models/index.ts +11 -0
- package/src/server/models/providers/index.ts +2 -0
- package/src/server/models/providers/model.spec.ts +11 -0
- package/src/server/models/providers/model.ts +33 -0
- package/src/server/models/providers/storage.spec.ts +21 -0
- package/src/server/models/providers/storage.ts +34 -0
- package/src/server/models/reply.spec.ts +17 -0
- package/src/server/models/reply.ts +10 -0
- package/src/server/models/router.spec.ts +50 -0
- package/src/server/models/router.ts +79 -0
- package/src/server/models/service.ts +5 -0
- package/src/server/models/transports/index.ts +2 -0
- package/src/server/models/transports/model.ts +9 -0
- package/src/server/models/transports/storage.spec.ts +14 -0
- package/src/server/models/transports/storage.ts +13 -0
- package/src/server/services/analytics.service.spec.ts +38 -0
- package/src/server/services/analytics.service.ts +58 -0
- package/src/server/services/index.ts +2 -0
- package/src/server/services/metrics.service.spec.ts +42 -0
- package/src/server/services/metrics.service.ts +46 -0
- package/src/server/transports/http.transport/context.ts +72 -0
- package/src/server/transports/http.transport/executor.ts +156 -0
- package/src/server/transports/http.transport/index.ts +53 -0
- package/src/server/transports/index.ts +3 -0
- package/src/server/transports/internal/http.transport/context.ts +50 -0
- package/src/server/transports/internal/http.transport/executor.ts +56 -0
- package/src/server/transports/internal/http.transport/index.ts +23 -0
- package/src/server/transports/internal/http.transport/reply.ts +82 -0
- package/src/server/transports/internal/index.ts +2 -0
- package/src/server/transports/internal/io.transport/context.ts +40 -0
- package/src/server/transports/internal/io.transport/executor.ts +27 -0
- package/src/server/transports/internal/io.transport/index.ts +36 -0
- package/src/server/transports/internal/io.transport/reply.ts +26 -0
- package/src/server/transports/internal/utils.ts +6 -0
- package/src/server/transports/ws.transport/context.ts +90 -0
- package/src/server/transports/ws.transport/executor.ts +64 -0
- package/src/server/transports/ws.transport/index.ts +105 -0
- package/src/server/types/index.ts +32 -0
- package/src/server/utils/index.ts +35 -0
- package/src/utils/index.spec.ts +31 -0
- package/src/utils/index.ts +51 -0
- package/test/index.ts +299 -0
- package/test/providers/index.ts +2 -0
- package/test/providers/root.ts +241 -0
- package/test/providers/statics.ts +37 -0
- package/tsconfig.json +108 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/types/common.ts +127 -0
- package/types/index.ts +1 -0
- package/vite.config.ts +64 -0
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import { buildExpectationContext } from '../__utils__';
|
|
2
|
+
import * as operators from './index';
|
|
3
|
+
|
|
4
|
+
describe('Expectations.Operators.Has', () => {
|
|
5
|
+
describe('incoming.query', () => {
|
|
6
|
+
it('should handle invalid schema', () => {
|
|
7
|
+
const operator = new operators.$has(operators, { $location: 'incoming.query' });
|
|
8
|
+
expect(operator.match(<any>{})).toBeFalsy();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should match by schema using exec', () => {
|
|
12
|
+
const operator = new operators.$has<any>(operators, {
|
|
13
|
+
$location: 'incoming.query',
|
|
14
|
+
$exec: (payload) => payload.foo === 1,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should not match by schema using exec', () => {
|
|
21
|
+
const operator = new operators.$has<any>(operators, {
|
|
22
|
+
$location: 'incoming.query',
|
|
23
|
+
$exec: (payload) => payload.foo === '2',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should match by schema using path', () => {
|
|
30
|
+
const operator = new operators.$has(operators, {
|
|
31
|
+
$location: 'incoming.query',
|
|
32
|
+
$path: 'foo',
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should not match by schema using path', () => {
|
|
39
|
+
const operator = new operators.$has(operators, {
|
|
40
|
+
$location: 'incoming.query',
|
|
41
|
+
$path: 'foo1',
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should match by schema using path and value', () => {
|
|
48
|
+
const operator = new operators.$has(operators, {
|
|
49
|
+
$location: 'incoming.query',
|
|
50
|
+
$path: 'foo',
|
|
51
|
+
$value: 1,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should not match by schema using path and value', () => {
|
|
58
|
+
const operator = new operators.$has(operators, {
|
|
59
|
+
$location: 'incoming.query',
|
|
60
|
+
$path: 'foo',
|
|
61
|
+
$value: 2,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should match by schema using path and valueAnyOf', () => {
|
|
68
|
+
const operator = new operators.$has(operators, {
|
|
69
|
+
$location: 'incoming.query',
|
|
70
|
+
$path: 'foo',
|
|
71
|
+
$valueAnyOf: [null, 500, 1],
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('should not match by schema using path and valueAnyOf', () => {
|
|
78
|
+
const operator = new operators.$has(operators, {
|
|
79
|
+
$location: 'incoming.query',
|
|
80
|
+
$path: 'foo',
|
|
81
|
+
$valueAnyOf: [],
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('should match by schema using path and regExp', () => {
|
|
88
|
+
const operator = new operators.$has(operators, {
|
|
89
|
+
$location: 'incoming.query',
|
|
90
|
+
$path: 'foo',
|
|
91
|
+
$regExp: /\d/,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should not match by schema using path and regExp', () => {
|
|
98
|
+
const operator = new operators.$has(operators, {
|
|
99
|
+
$location: 'incoming.query',
|
|
100
|
+
$path: 'foo',
|
|
101
|
+
$regExp: /[a-z]/,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('should match by schema using path and regExpAnyOf', () => {
|
|
108
|
+
const operator = new operators.$has(operators, {
|
|
109
|
+
$location: 'incoming.query',
|
|
110
|
+
$path: 'foo',
|
|
111
|
+
$regExpAnyOf: [/\./, /\d/],
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should not match by schema using path and regExpAnyOf', () => {
|
|
118
|
+
const operator = new operators.$has(operators, {
|
|
119
|
+
$location: 'incoming.query',
|
|
120
|
+
$path: 'foo',
|
|
121
|
+
$regExpAnyOf: [/\./],
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should match by schema using path and match', () => {
|
|
128
|
+
const operator = new operators.$has<any>(operators, {
|
|
129
|
+
$location: 'incoming.query',
|
|
130
|
+
$path: 'foo',
|
|
131
|
+
$match: '*',
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('should not match by schema using path and match', () => {
|
|
138
|
+
const operator = new operators.$has<any>(operators, {
|
|
139
|
+
$location: 'incoming.query',
|
|
140
|
+
$path: 'foo',
|
|
141
|
+
$match: '*foo*',
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('should match by schema using path and matchAnyOf', () => {
|
|
148
|
+
const operator = new operators.$has<any>(operators, {
|
|
149
|
+
$location: 'incoming.query',
|
|
150
|
+
$path: 'foo',
|
|
151
|
+
$matchAnyOf: ['2', '3', '1'],
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('should not match by schema using path and matchAnyOf', () => {
|
|
158
|
+
const operator = new operators.$has<any>(operators, {
|
|
159
|
+
$location: 'incoming.query',
|
|
160
|
+
$path: 'foo',
|
|
161
|
+
$matchAnyOf: ['*2', '3', '1*0'],
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('should match by schema using path and exec', () => {
|
|
168
|
+
const operator = new operators.$has<any>(operators, {
|
|
169
|
+
$location: 'incoming.query',
|
|
170
|
+
$path: 'foo',
|
|
171
|
+
$exec: (payload) => payload === 1,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('should not match by schema using path and exec', () => {
|
|
178
|
+
const operator = new operators.$has<any>(operators, {
|
|
179
|
+
$location: 'incoming.query',
|
|
180
|
+
$path: 'foo',
|
|
181
|
+
$exec: (payload) => payload === '2',
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('should match by schema using jsonPath', () => {
|
|
188
|
+
const operator = new operators.$has(operators, {
|
|
189
|
+
$location: 'incoming.query',
|
|
190
|
+
$jsonPath: '$.bar.baz',
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('should not match by schema using jsonPath', () => {
|
|
197
|
+
const operator = new operators.$has(operators, {
|
|
198
|
+
$location: 'incoming.query',
|
|
199
|
+
$jsonPath: '$.bar2.baz',
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it('should match by schema using jsonPath and value', () => {
|
|
206
|
+
const operator = new operators.$has(operators, {
|
|
207
|
+
$location: 'incoming.query',
|
|
208
|
+
$jsonPath: '$.bar.baz',
|
|
209
|
+
$value: null,
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('should not match by schema with using jsonPath and value', () => {
|
|
216
|
+
const operator = new operators.$has(operators, {
|
|
217
|
+
$location: 'incoming.query',
|
|
218
|
+
$jsonPath: '$.bar.baz',
|
|
219
|
+
$value: 1,
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('should match by schema using jsonPath and valueAnyOf', () => {
|
|
226
|
+
const operator = new operators.$has(operators, {
|
|
227
|
+
$location: 'incoming.query',
|
|
228
|
+
$jsonPath: '$.bar.baz',
|
|
229
|
+
$valueAnyOf: [1, 2, null],
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('should not match by schema using jsonPath and valueAnyOf', () => {
|
|
236
|
+
const operator = new operators.$has(operators, {
|
|
237
|
+
$location: 'incoming.query',
|
|
238
|
+
$jsonPath: '$.bar.baz',
|
|
239
|
+
$valueAnyOf: [1, 2, 3],
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it('should match by schema using jsonPath and exec', () => {
|
|
246
|
+
const operator = new operators.$has(operators, {
|
|
247
|
+
$location: 'incoming.query',
|
|
248
|
+
$jsonPath: '$.bar.baz',
|
|
249
|
+
$exec: (payload) => payload === null,
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('should not match by schema using jsonPath and exec', () => {
|
|
256
|
+
const operator = new operators.$has<any>(operators, {
|
|
257
|
+
$location: 'incoming.query',
|
|
258
|
+
$jsonPath: '$.bar.baz',
|
|
259
|
+
$exec: (payload) => payload === 1,
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
describe('incoming.data', () => {
|
|
267
|
+
it('should match by schema using match', () => {
|
|
268
|
+
const operator = new operators.$has<any>(operators, {
|
|
269
|
+
$location: 'incoming.data',
|
|
270
|
+
$match: { foo: { bar: 1 } },
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
expect(operator.match({ incoming: { data: { foo: { bar: 1 } } } })).toBeTruthy();
|
|
274
|
+
expect(operator.match({ incoming: { data: { foo: { bar: 2 } } } })).toBeFalsy();
|
|
275
|
+
expect(operator.match({ incoming: { data: {} } })).toBeFalsy();
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it('should match by schema using matchAnyOf', () => {
|
|
279
|
+
const operator = new operators.$has<any>(operators, {
|
|
280
|
+
$location: 'incoming.data',
|
|
281
|
+
$matchAnyOf: [{ foo: { bar: 1 } }, { baz: 2 }],
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
expect(operator.match({ incoming: { data: { foo: { bar: 1 } } } })).toBeTruthy();
|
|
285
|
+
expect(operator.match({ incoming: { data: { baz: 2 } } })).toBeTruthy();
|
|
286
|
+
|
|
287
|
+
expect(operator.match({ incoming: { data: { foo: { bar: 2 } } } })).toBeFalsy();
|
|
288
|
+
expect(operator.match({ incoming: { data: { baz: 1 } } })).toBeFalsy();
|
|
289
|
+
expect(operator.match({ incoming: { data: {} } })).toBeFalsy();
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
describe('incoming.path', () => {
|
|
294
|
+
it('should match by schema using value', () => {
|
|
295
|
+
const operator = new operators.$has(operators, {
|
|
296
|
+
$location: 'path',
|
|
297
|
+
$value: '/foo/bar/baz',
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
it('should match by schema using valueAnyOf', () => {
|
|
304
|
+
const operator = new operators.$has(operators, {
|
|
305
|
+
$location: 'path',
|
|
306
|
+
$valueAnyOf: ['/foo', '/bar', '/foo/bar/baz'],
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it('should match by schema using regExp', () => {
|
|
313
|
+
const operator = new operators.$has(operators, {
|
|
314
|
+
$location: 'path',
|
|
315
|
+
$regExp: /^\/foo\/\w+\/baz$/,
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
it('should match by schema using regExpAnyOf', () => {
|
|
322
|
+
const operator = new operators.$has(operators, {
|
|
323
|
+
$location: 'path',
|
|
324
|
+
$regExpAnyOf: [/\./, /^\/foo\/\w+\/baz$/, /^foo$/],
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
it('should match by schema using match', () => {
|
|
331
|
+
const operator = new operators.$has(operators, {
|
|
332
|
+
$location: 'path',
|
|
333
|
+
$match: '/foo/*/baz',
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
it('should not match by schema using match', () => {
|
|
340
|
+
const operator = new operators.$has(operators, {
|
|
341
|
+
$location: 'path',
|
|
342
|
+
$match: '/foo/*/*/baz',
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
it('should match by schema using matchAnyOf', () => {
|
|
349
|
+
const operator = new operators.$has(operators, {
|
|
350
|
+
$location: 'path',
|
|
351
|
+
$matchAnyOf: ['/foo/baz', '/bar/baz', '/foo/bar/*'],
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
it('should not match by schema using matchAnyOf', () => {
|
|
358
|
+
const operator = new operators.$has(operators, {
|
|
359
|
+
$location: 'path',
|
|
360
|
+
$matchAnyOf: [],
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
it('should match by schema using exec', () => {
|
|
367
|
+
const operator = new operators.$has(operators, {
|
|
368
|
+
$location: 'path',
|
|
369
|
+
$exec: (payload) => payload.includes('/foo'),
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
it('should not match by schema using exec', () => {
|
|
376
|
+
const operator = new operators.$has(operators, {
|
|
377
|
+
$location: 'path',
|
|
378
|
+
$exec: (payload) => payload === '/foo',
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
describe('incoming.method', () => {
|
|
386
|
+
it('should match by schema using value', () => {
|
|
387
|
+
const operator = new operators.$has(operators, {
|
|
388
|
+
$location: 'method',
|
|
389
|
+
$value: 'POST',
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
describe('outgoing.status', () => {
|
|
397
|
+
it('should match by schema using value', () => {
|
|
398
|
+
const operator = new operators.$has(operators, {
|
|
399
|
+
$location: 'outgoing.status',
|
|
400
|
+
$value: 200,
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
it('should not match by schema using value', () => {
|
|
407
|
+
const operator = new operators.$has(operators, {
|
|
408
|
+
$location: 'outgoing.status',
|
|
409
|
+
$value: 201,
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
it('should match by schema using valueAnyOf', () => {
|
|
416
|
+
const operator = new operators.$has(operators, {
|
|
417
|
+
$location: 'outgoing.status',
|
|
418
|
+
$valueAnyOf: [404, 200],
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
it('should not match by schema using valueAnyOf', () => {
|
|
425
|
+
const operator = new operators.$has(operators, {
|
|
426
|
+
$location: 'outgoing.status',
|
|
427
|
+
$valueAnyOf: [404, 201],
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
it('should match by schema using match', () => {
|
|
434
|
+
const operator = new operators.$has(operators, {
|
|
435
|
+
$location: 'outgoing.status',
|
|
436
|
+
$match: '2**',
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
it('should not match by schema using match', () => {
|
|
443
|
+
const operator = new operators.$has(operators, {
|
|
444
|
+
$location: 'outgoing.status',
|
|
445
|
+
$match: '2*1',
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
it('should match by schema using matchAnyOf', () => {
|
|
452
|
+
const operator = new operators.$has(operators, {
|
|
453
|
+
$location: 'outgoing.status',
|
|
454
|
+
$matchAnyOf: ['2*1', '200'],
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
it('should not match by schema using matchAnyOf', () => {
|
|
461
|
+
const operator = new operators.$has(operators, {
|
|
462
|
+
$location: 'outgoing.status',
|
|
463
|
+
$matchAnyOf: ['2*1'],
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
it('should match by schema using exec', () => {
|
|
470
|
+
const operator = new operators.$has(operators, {
|
|
471
|
+
$location: 'outgoing.status',
|
|
472
|
+
$exec: (payload) => payload === 200,
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
it('should not match by schema using exec', () => {
|
|
479
|
+
const operator = new operators.$has<any>(operators, {
|
|
480
|
+
$location: 'outgoing.status',
|
|
481
|
+
$exec: (payload) => payload === '200',
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
it('should match by schema using exec as string', () => {
|
|
488
|
+
const operator = new operators.$has(operators, {
|
|
489
|
+
$location: 'outgoing.status',
|
|
490
|
+
$exec: 'payload === 200',
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
it('should not match by schema using exec as string', () => {
|
|
497
|
+
const operator = new operators.$has(operators, {
|
|
498
|
+
$location: 'outgoing.status',
|
|
499
|
+
$exec: 'payload === 201',
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
expect(operator.match(buildExpectationContext())).toBeFalsy();
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
it('should match by schema using exec as string with utils', () => {
|
|
506
|
+
const operator = new operators.$has(operators, {
|
|
507
|
+
$location: 'outgoing.status',
|
|
508
|
+
$exec: '_.isEqual(payload, 200)',
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
expect(operator.match(buildExpectationContext())).toBeTruthy();
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
});
|