From bdb94178049dd2b2d4ec327bd683143bdbe48d33 Mon Sep 17 00:00:00 2001 From: Sebastian Leidig Date: Tue, 27 Feb 2024 16:23:19 +0100 Subject: [PATCH] test(e2e): mock-couch and first e2e tests --- package-lock.json | 1243 +++++++++++++++++ package.json | 1 + .../storage/couch-db-changes.service.ts | 15 +- test/mock-couch-db-client.ts | 10 - test/report.e2e-spec.ts | 143 +- 5 files changed, 1382 insertions(+), 30 deletions(-) delete mode 100644 test/mock-couch-db-client.ts diff --git a/package-lock.json b/package-lock.json index dcff0a0..9145a13 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "@sentry/node": "^7.102.1", "@sentry/tracing": "^7.102.1", "js-yaml": "4.1.0", + "mock-couch": "^0.1.11", "reflect-metadata": "^0.1.13", "rxjs": "^7.8.1", "uuid": "9.0.1" @@ -6867,6 +6868,1248 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/mock-couch": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/mock-couch/-/mock-couch-0.1.11.tgz", + "integrity": "sha512-u+3TTLeZOeayWTe5UK+vvE8zym/Aos+/N6NCOu13Vc2wAejxVZ62CL0I+lGLyfKJ/apA5jLo6AToIFd/3ORVCQ==", + "hasShrinkwrap": true, + "dependencies": { + "couch-viewkey-compare": "1.0.1", + "ramda": "0.8.0", + "restify": "^6.3.4", + "underscore": "1.8.3" + } + }, + "node_modules/mock-couch/node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/argparse": { + "version": "0.1.16", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz", + "integrity": "sha1-z9AeD7uj1srtBJ+9dY1A9lGW9Xw=", + "extraneous": true, + "dependencies": { + "underscore": "1.7.0", + "underscore.string": "2.4.0" + } + }, + "node_modules/mock-couch/node_modules/argparse/node_modules/underscore": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", + "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/argparse/node_modules/underscore.string": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz", + "integrity": "sha1-jN2PusTi0uoefi6Al8QvRCKA+Fs=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/async": { + "version": "0.1.22", + "resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz", + "integrity": "sha1-D8GqoIig4+8Ovi2IMbqw3PiEUGE=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/balanced-match": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz", + "integrity": "sha1-qRzdHr7xqGZZ5w/03vAWJfwtZ1Y=", + "optional": true + }, + "node_modules/mock-couch/node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "optional": true, + "dependencies": { + "tweetnacl": "0.14.5" + } + }, + "node_modules/mock-couch/node_modules/brace-expansion": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.3.tgz", + "integrity": "sha1-Rr/1ARXUf8mriYVKu4fZgHihCZE=", + "optional": true, + "dependencies": { + "balanced-match": "0.3.0", + "concat-map": "0.0.1" + } + }, + "node_modules/mock-couch/node_modules/buffer-shims": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "extraneous": true, + "dependencies": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "node_modules/mock-couch/node_modules/clone-regexp": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-1.0.1.tgz", + "integrity": "sha512-Fcij9IwRW27XedRIJnSOEupS7RVcXtObJXbcUOX93UCLqqOdRpkvzKywOOSizmEK/Is3S/RHX9dLdfo6R1Q1mw==", + "dependencies": { + "is-regexp": "1.0.0", + "is-supported-regexp-flag": "1.0.1" + } + }, + "node_modules/mock-couch/node_modules/coffee-script": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.3.3.tgz", + "integrity": "sha1-FQ1rTLUiiUNp7+1qIQHCC8f0pPQ=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/colors": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", + "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "optional": true + }, + "node_modules/mock-couch/node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "node_modules/mock-couch/node_modules/couch-viewkey-compare": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/couch-viewkey-compare/-/couch-viewkey-compare-1.0.1.tgz", + "integrity": "sha1-lQLqEuStON3tPGIwLmT0eS6DRMI=" + }, + "node_modules/mock-couch/node_modules/dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dependencies": { + "assert-plus": "1.0.0" + } + }, + "node_modules/mock-couch/node_modules/dashdash/node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "node_modules/mock-couch/node_modules/dateformat": { + "version": "1.0.2-1.2.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz", + "integrity": "sha1-sCIMAt6YYXQztyhRz0fePfLNvuk=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/mock-couch/node_modules/detect-node": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.3.tgz", + "integrity": "sha1-ogM8CcyOFY03dI+951B4Mr1s4Sc=" + }, + "node_modules/mock-couch/node_modules/ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "optional": true, + "dependencies": { + "jsbn": "0.1.1" + } + }, + "node_modules/mock-couch/node_modules/escape-regexp-component": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/escape-regexp-component/-/escape-regexp-component-1.0.2.tgz", + "integrity": "sha1-nGO20LJf8qiMOtvRjFthrMO5+qI=" + }, + "node_modules/mock-couch/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/esprima": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", + "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/eventemitter2": { + "version": "0.4.14", + "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", + "integrity": "sha1-j2G3XN4BKy6esoTUVFWDtWQ7Yas=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/ewma": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ewma/-/ewma-2.0.1.tgz", + "integrity": "sha512-MYYK17A76cuuyvkR7MnqLW4iFYPEi5Isl2qb8rXiWpLiwFS9dxW/rncuNnjjgSENuVqZQkIuR4+DChVL4g1lnw==", + "dependencies": { + "assert-plus": "1.0.0" + } + }, + "node_modules/mock-couch/node_modules/ewma/node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "node_modules/mock-couch/node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/extsprintf": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.2.0.tgz", + "integrity": "sha1-WtlGwi9bMrp/jNdCZxHG6KP8JSk=" + }, + "node_modules/mock-couch/node_modules/findup-sync": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", + "integrity": "sha1-fz56l7gjksZTvwZYm9hRkOk8NoM=", + "extraneous": true, + "dependencies": { + "glob": "3.2.11", + "lodash": "2.4.2" + } + }, + "node_modules/mock-couch/node_modules/findup-sync/node_modules/glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", + "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", + "extraneous": true, + "dependencies": { + "inherits": "2.0.1", + "minimatch": "0.3.0" + } + }, + "node_modules/mock-couch/node_modules/findup-sync/node_modules/lodash": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", + "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/findup-sync/node_modules/minimatch": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", + "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", + "extraneous": true, + "dependencies": { + "lru-cache": "2.7.3", + "sigmund": "1.0.1" + } + }, + "node_modules/mock-couch/node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/getobject": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz", + "integrity": "sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dependencies": { + "assert-plus": "1.0.0" + } + }, + "node_modules/mock-couch/node_modules/getpass/node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "node_modules/mock-couch/node_modules/glob": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", + "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "optional": true, + "dependencies": { + "inflight": "1.0.4", + "inherits": "2.0.1", + "minimatch": "3.0.0", + "once": "1.3.3", + "path-is-absolute": "1.0.0" + } + }, + "node_modules/mock-couch/node_modules/graceful-fs": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", + "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/grunt": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-0.4.4.tgz", + "integrity": "sha1-83+kbi5S43+aA3BUKnQoHAnHP1M=", + "extraneous": true, + "dependencies": { + "async": "0.1.22", + "coffee-script": "1.3.3", + "colors": "0.6.2", + "dateformat": "1.0.2-1.2.3", + "eventemitter2": "0.4.14", + "exit": "0.1.2", + "findup-sync": "0.1.3", + "getobject": "0.1.0", + "glob": "3.1.21", + "grunt-legacy-util": "0.1.2", + "hooker": "0.2.3", + "iconv-lite": "0.2.11", + "js-yaml": "2.0.5", + "lodash": "0.9.2", + "minimatch": "0.2.14", + "nopt": "1.0.10", + "rimraf": "2.2.8", + "underscore.string": "2.2.1", + "which": "1.0.9" + } + }, + "node_modules/mock-couch/node_modules/grunt-jasmine-nodejs": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/grunt-jasmine-nodejs/-/grunt-jasmine-nodejs-1.3.0.tgz", + "integrity": "sha1-7n5cDTW+muBInMPLJAHzhiV+wXM=", + "extraneous": true, + "dependencies": { + "chalk": "1.1.3", + "jasmine": "2.99.0", + "jasmine-reporters": "2.3.1" + } + }, + "node_modules/mock-couch/node_modules/grunt-jslint": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/grunt-jslint/-/grunt-jslint-1.1.15.tgz", + "integrity": "sha512-8r75ufVi049gYXl6WRTEoswEOnDTMGZH7vVIeSdmY6ODDCAOeYflB6QtRwhbiUYBEiqVfLFN5hzj8ZNBMnFrMw==", + "extraneous": true, + "dependencies": { + "jslint": "0.10.3" + } + }, + "node_modules/mock-couch/node_modules/grunt-legacy-util": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-0.1.2.tgz", + "integrity": "sha1-voTTN+9KATfchWYJKkZSj9iVfr0=", + "extraneous": true, + "dependencies": { + "async": "0.1.22", + "exit": "0.1.2", + "getobject": "0.1.0", + "hooker": "0.2.3", + "lodash": "0.9.2", + "underscore.string": "2.2.1", + "which": "1.0.9" + } + }, + "node_modules/mock-couch/node_modules/grunt/node_modules/glob": { + "version": "3.1.21", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", + "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", + "extraneous": true, + "dependencies": { + "graceful-fs": "1.2.3", + "inherits": "1.0.2", + "minimatch": "0.2.14" + } + }, + "node_modules/mock-couch/node_modules/grunt/node_modules/inherits": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", + "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/grunt/node_modules/minimatch": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", + "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", + "extraneous": true, + "dependencies": { + "lru-cache": "2.7.3", + "sigmund": "1.0.1" + } + }, + "node_modules/mock-couch/node_modules/grunt/node_modules/rimraf": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", + "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/handle-thing": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz", + "integrity": "sha1-/Xqtcmvxpf0W38KbL3pmAdJxOcQ=" + }, + "node_modules/mock-couch/node_modules/has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "extraneous": true, + "dependencies": { + "ansi-regex": "2.1.1" + } + }, + "node_modules/mock-couch/node_modules/hooker": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", + "integrity": "sha1-uDT3I8xKJCqmWWNFnfbZhMXT2Vk=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/hpack.js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", + "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", + "dependencies": { + "inherits": "2.0.1", + "obuf": "1.1.2", + "readable-stream": "2.3.6", + "wbuf": "1.7.3" + } + }, + "node_modules/mock-couch/node_modules/hpack.js/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "node_modules/mock-couch/node_modules/hpack.js/node_modules/readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dependencies": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "node_modules/mock-couch/node_modules/hpack.js/node_modules/readable-stream/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "node_modules/mock-couch/node_modules/hpack.js/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "5.1.2" + } + }, + "node_modules/mock-couch/node_modules/http-deceiver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=" + }, + "node_modules/mock-couch/node_modules/iconv-lite": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz", + "integrity": "sha1-HOYKOleGSiktEyH/RgnKS7llrcg=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/inflight": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz", + "integrity": "sha1-bLtFIevVHODsCpNr/XZX736bFyo=", + "optional": true, + "dependencies": { + "once": "1.3.3", + "wrappy": "1.0.1" + } + }, + "node_modules/mock-couch/node_modules/inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" + }, + "node_modules/mock-couch/node_modules/is-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", + "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=" + }, + "node_modules/mock-couch/node_modules/is-supported-regexp-flag": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-supported-regexp-flag/-/is-supported-regexp-flag-1.0.1.tgz", + "integrity": "sha512-3vcJecUUrpgCqc/ca0aWeNu64UGgxcvO60K/Fkr1N6RSvfGCTU60UKN68JDmKokgba0rFFJs12EnzOQa14ubKQ==" + }, + "node_modules/mock-couch/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/jasmine": { + "version": "2.99.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.99.0.tgz", + "integrity": "sha1-jKctEC5jm4Z8ZImFbg4YqceqQrc=", + "extraneous": true, + "dependencies": { + "exit": "0.1.2", + "glob": "7.1.2", + "jasmine-core": "2.99.1" + } + }, + "node_modules/mock-couch/node_modules/jasmine-core": { + "version": "2.99.1", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", + "integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/jasmine-reporters": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/jasmine-reporters/-/jasmine-reporters-2.3.1.tgz", + "integrity": "sha1-9C1XjplmlhY0MdkRwxZ5cZ+0Ozs=", + "extraneous": true, + "dependencies": { + "mkdirp": "0.5.1", + "xmldom": "0.1.27" + } + }, + "node_modules/mock-couch/node_modules/jasmine/node_modules/balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/jasmine/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "extraneous": true, + "dependencies": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/mock-couch/node_modules/jasmine/node_modules/glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "extraneous": true, + "dependencies": { + "fs.realpath": "1.0.0", + "inflight": "1.0.4", + "inherits": "2.0.1", + "minimatch": "3.0.4", + "once": "1.3.3", + "path-is-absolute": "1.0.0" + } + }, + "node_modules/mock-couch/node_modules/jasmine/node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "extraneous": true, + "dependencies": { + "brace-expansion": "1.1.11" + } + }, + "node_modules/mock-couch/node_modules/js-yaml": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-2.0.5.tgz", + "integrity": "sha1-olrmUJmZ6X3yeMZxnaEb0Gh3Q6g=", + "extraneous": true, + "dependencies": { + "argparse": "0.1.16", + "esprima": "1.0.4" + } + }, + "node_modules/mock-couch/node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "node_modules/mock-couch/node_modules/jslint": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/jslint/-/jslint-0.10.3.tgz", + "integrity": "sha1-iQ2j55ky7fBsX0tSp7W6ZDaGdDY=", + "extraneous": true, + "dependencies": { + "exit": "0.1.2", + "glob": "7.1.2", + "nopt": "3.0.6", + "readable-stream": "2.1.5" + } + }, + "node_modules/mock-couch/node_modules/jslint/node_modules/balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/jslint/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "extraneous": true, + "dependencies": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/mock-couch/node_modules/jslint/node_modules/glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "extraneous": true, + "dependencies": { + "fs.realpath": "1.0.0", + "inflight": "1.0.4", + "inherits": "2.0.1", + "minimatch": "3.0.4", + "once": "1.3.3", + "path-is-absolute": "1.0.0" + } + }, + "node_modules/mock-couch/node_modules/jslint/node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "extraneous": true, + "dependencies": { + "brace-expansion": "1.1.11" + } + }, + "node_modules/mock-couch/node_modules/jslint/node_modules/nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "extraneous": true, + "dependencies": { + "abbrev": "1.1.1" + } + }, + "node_modules/mock-couch/node_modules/json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "node_modules/mock-couch/node_modules/jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "node_modules/mock-couch/node_modules/jsprim/node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "node_modules/mock-couch/node_modules/jsprim/node_modules/extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "node_modules/mock-couch/node_modules/jsprim/node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dependencies": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + } + }, + "node_modules/mock-couch/node_modules/lodash": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz", + "integrity": "sha1-jzSZxSRdNG1oLlsNO0B2fgnxqSw=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" + }, + "node_modules/mock-couch/node_modules/lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/mock-couch/node_modules/minimatch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz", + "integrity": "sha1-UjYVelHk8ATBd/s8Un/33Xjw74M=", + "optional": true, + "dependencies": { + "brace-expansion": "1.1.3" + } + }, + "node_modules/mock-couch/node_modules/minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "optional": true + }, + "node_modules/mock-couch/node_modules/mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "optional": true, + "dependencies": { + "minimist": "0.0.8" + } + }, + "node_modules/mock-couch/node_modules/moment": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.12.0.tgz", + "integrity": "sha1-3CVg0Zg41sBzGxpq+gRnUmTTYNY=", + "optional": true + }, + "node_modules/mock-couch/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node_modules/mock-couch/node_modules/mv": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/mv/-/mv-2.1.1.tgz", + "integrity": "sha1-rmzg1vbV4KT32JN5jQPB6pVZtqI=", + "optional": true, + "dependencies": { + "mkdirp": "0.5.1", + "ncp": "2.0.0", + "rimraf": "2.4.5" + } + }, + "node_modules/mock-couch/node_modules/ncp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", + "integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=", + "optional": true + }, + "node_modules/mock-couch/node_modules/nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "extraneous": true, + "dependencies": { + "abbrev": "1.1.1" + } + }, + "node_modules/mock-couch/node_modules/obuf": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==" + }, + "node_modules/mock-couch/node_modules/once": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", + "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", + "optional": true, + "dependencies": { + "wrappy": "1.0.1" + } + }, + "node_modules/mock-couch/node_modules/path-is-absolute": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz", + "integrity": "sha1-Jj2tpmqz8vsQv3+dJN2PPlcO+RI=", + "optional": true + }, + "node_modules/mock-couch/node_modules/pidusage": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pidusage/-/pidusage-1.2.0.tgz", + "integrity": "sha512-OGo+iSOk44HRJ8q15AyG570UYxcm5u+R99DI8Khu8P3tKGkVu5EZX4ywHglWSTMNNXQ274oeGpYrvFEhDIFGPg==" + }, + "node_modules/mock-couch/node_modules/process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" + }, + "node_modules/mock-couch/node_modules/pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" + }, + "node_modules/mock-couch/node_modules/ramda": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.8.0.tgz", + "integrity": "sha1-FB3buAaVtpKfKF7+oUEF2R5rM8w=" + }, + "node_modules/mock-couch/node_modules/readable-stream": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz", + "integrity": "sha1-ZvqLcg4UOLNkaB8q0aY8YYRIydA=", + "extraneous": true, + "dependencies": { + "buffer-shims": "1.0.0", + "core-util-is": "1.0.2", + "inherits": "2.0.1", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", + "util-deprecate": "1.0.2" + } + }, + "node_modules/mock-couch/node_modules/readable-stream/node_modules/process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/restify": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/restify/-/restify-6.4.0.tgz", + "integrity": "sha512-p92TXaSuvDWxpmHd7Y5ex1vjFifhNzNZQy99EOPynV/V75fJN5ybHv5mXTD+c1Ffo9fvRv2Yb1FLnfDMpaffPA==", + "dependencies": { + "assert-plus": "1.0.0", + "bunyan": "1.8.12", + "clone-regexp": "1.0.1", + "csv": "1.2.1", + "escape-regexp-component": "1.0.2", + "ewma": "2.0.1", + "formidable": "1.2.1", + "http-signature": "1.2.0", + "lodash": "4.17.10", + "lru-cache": "4.1.3", + "mime": "1.6.0", + "negotiator": "0.6.1", + "once": "1.4.0", + "pidusage": "1.2.0", + "qs": "6.5.2", + "restify-errors": "5.0.0", + "semver": "5.5.0", + "spdy": "3.4.7", + "uuid": "3.3.2", + "vasync": "1.6.4", + "verror": "1.10.0" + }, + "optionalDependencies": { + "dtrace-provider": "0.8.7" + } + }, + "node_modules/mock-couch/node_modules/restify-errors": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/restify-errors/-/restify-errors-5.0.0.tgz", + "integrity": "sha512-+vby9Kxf7qlzvbZSTIEGkIixkeHG+pVCl34dk6eKnL+ua4pCezpdLT/1/eabzPZb65ADrgoc04jeWrrF1E1pvQ==", + "dependencies": { + "assert-plus": "1.0.0", + "lodash": "4.17.10", + "verror": "1.10.0" + }, + "optionalDependencies": { + "safe-json-stringify": "1.0.3" + } + }, + "node_modules/mock-couch/node_modules/restify-errors/node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "node_modules/mock-couch/node_modules/restify-errors/node_modules/lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" + }, + "node_modules/mock-couch/node_modules/restify-errors/node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dependencies": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.2.0" + } + }, + "node_modules/mock-couch/node_modules/restify/node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "node_modules/mock-couch/node_modules/restify/node_modules/bunyan": { + "version": "1.8.12", + "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.12.tgz", + "integrity": "sha1-8VDw9nSKvdcq6uhPBEA74u8RN5c=", + "optionalDependencies": { + "dtrace-provider": "0.8.7", + "moment": "2.12.0", + "mv": "2.1.1", + "safe-json-stringify": "1.0.3" + } + }, + "node_modules/mock-couch/node_modules/restify/node_modules/csv": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/csv/-/csv-1.2.1.tgz", + "integrity": "sha1-UjHt/BxxUlEuxFeBB2p6l/9SXAw=", + "dependencies": { + "csv-generate": "1.1.2", + "csv-parse": "1.3.3", + "csv-stringify": "1.1.2", + "stream-transform": "0.2.2" + } + }, + "node_modules/mock-couch/node_modules/restify/node_modules/csv-generate": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/csv-generate/-/csv-generate-1.1.2.tgz", + "integrity": "sha1-7GsA7a7W5ZrZwgWC9MNk4osUYkA=" + }, + "node_modules/mock-couch/node_modules/restify/node_modules/csv-parse": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-1.3.3.tgz", + "integrity": "sha1-0c/YdDwvhJoKuy/VRNtWaV0ZpJA=" + }, + "node_modules/mock-couch/node_modules/restify/node_modules/csv-stringify": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-1.1.2.tgz", + "integrity": "sha1-d6QVJlgbzjOA8SsA18W7rHDIK1g=", + "dependencies": { + "lodash.get": "4.4.2" + } + }, + "node_modules/mock-couch/node_modules/restify/node_modules/dtrace-provider": { + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.8.7.tgz", + "integrity": "sha1-3JObTT4GIM/gwc2APQ0tftBP/QQ=", + "optional": true, + "dependencies": { + "nan": "2.10.0" + } + }, + "node_modules/mock-couch/node_modules/restify/node_modules/formidable": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.1.tgz", + "integrity": "sha512-Fs9VRguL0gqGHkXS5GQiMCr1VhZBxz0JnJs4JmMp/2jL18Fmbzvv7vOFRU+U8TBkHEE/CX1qDXzJplVULgsLeg==" + }, + "node_modules/mock-couch/node_modules/restify/node_modules/http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dependencies": { + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.14.2" + } + }, + "node_modules/mock-couch/node_modules/restify/node_modules/lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" + }, + "node_modules/mock-couch/node_modules/restify/node_modules/lru-cache": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", + "dependencies": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "node_modules/mock-couch/node_modules/restify/node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + }, + "node_modules/mock-couch/node_modules/restify/node_modules/nan": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", + "optional": true + }, + "node_modules/mock-couch/node_modules/restify/node_modules/negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "node_modules/mock-couch/node_modules/restify/node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dependencies": { + "wrappy": "1.0.1" + } + }, + "node_modules/mock-couch/node_modules/restify/node_modules/qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "node_modules/mock-couch/node_modules/restify/node_modules/semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==" + }, + "node_modules/mock-couch/node_modules/restify/node_modules/spdy": { + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/spdy/-/spdy-3.4.7.tgz", + "integrity": "sha1-Qv9B7OXMD5mjpsKKq7c/XDsDrLw=", + "dependencies": { + "debug": "2.6.9", + "handle-thing": "1.2.5", + "http-deceiver": "1.2.7", + "safe-buffer": "5.1.2", + "select-hose": "2.0.0", + "spdy-transport": "2.1.0" + } + }, + "node_modules/mock-couch/node_modules/restify/node_modules/stream-transform": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/stream-transform/-/stream-transform-0.2.2.tgz", + "integrity": "sha1-dYZ0h/SVKPi/HYJJllh1PQLfeDg=" + }, + "node_modules/mock-couch/node_modules/restify/node_modules/uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "node_modules/mock-couch/node_modules/restify/node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dependencies": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.2.0" + } + }, + "node_modules/mock-couch/node_modules/rimraf": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", + "integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=", + "optional": true, + "dependencies": { + "glob": "6.0.4" + } + }, + "node_modules/mock-couch/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/mock-couch/node_modules/safe-json-stringify": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/safe-json-stringify/-/safe-json-stringify-1.0.3.tgz", + "integrity": "sha1-PLZxdmCghtB8tb2bemh1vPZ70F4=", + "optional": true + }, + "node_modules/mock-couch/node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/mock-couch/node_modules/select-hose": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=" + }, + "node_modules/mock-couch/node_modules/sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/spdy-transport": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-2.1.0.tgz", + "integrity": "sha512-bpUeGpZcmZ692rrTiqf9/2EUakI6/kXX1Rpe0ib/DyOzbiexVfXkw6GnvI9hVGvIwVaUhkaBojjCZwLNRGQg1g==", + "dependencies": { + "debug": "2.6.9", + "detect-node": "2.0.3", + "hpack.js": "2.1.6", + "obuf": "1.1.2", + "readable-stream": "2.3.6", + "safe-buffer": "5.1.2", + "wbuf": "1.7.3" + } + }, + "node_modules/mock-couch/node_modules/spdy-transport/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "node_modules/mock-couch/node_modules/spdy-transport/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "node_modules/mock-couch/node_modules/spdy-transport/node_modules/readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dependencies": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "node_modules/mock-couch/node_modules/spdy-transport/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "5.1.2" + } + }, + "node_modules/mock-couch/node_modules/sshpk": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "dependencies": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "dashdash": "1.14.1", + "getpass": "0.1.7", + "safer-buffer": "2.1.2" + }, + "optionalDependencies": { + "bcrypt-pbkdf": "1.0.2", + "ecc-jsbn": "0.1.1", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + } + }, + "node_modules/mock-couch/node_modules/sshpk/node_modules/asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" + }, + "node_modules/mock-couch/node_modules/sshpk/node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "node_modules/mock-couch/node_modules/string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "extraneous": true, + "dependencies": { + "ansi-regex": "2.1.1" + } + }, + "node_modules/mock-couch/node_modules/supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "node_modules/mock-couch/node_modules/underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "node_modules/mock-couch/node_modules/underscore.string": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz", + "integrity": "sha1-18D6KvXVoaZ/QlPa7pgTLnM/Dxk=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "node_modules/mock-couch/node_modules/vasync": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/vasync/-/vasync-1.6.4.tgz", + "integrity": "sha1-3+k2Fq0OeugBszKp2Iv8XNyOHR8=", + "dependencies": { + "verror": "1.6.0" + } + }, + "node_modules/mock-couch/node_modules/vasync/node_modules/verror": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.6.0.tgz", + "integrity": "sha1-fROyex+swuLakEBetepuW90lLqU=", + "dependencies": { + "extsprintf": "1.2.0" + } + }, + "node_modules/mock-couch/node_modules/wbuf": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "dependencies": { + "minimalistic-assert": "1.0.1" + } + }, + "node_modules/mock-couch/node_modules/which": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/which/-/which-1.0.9.tgz", + "integrity": "sha1-RgwdoPgQED0DIam2M6+eV15kSG8=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/wrappy": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz", + "integrity": "sha1-HmWWmWXMvC20VIxrhKbyxa7dRzk=" + }, + "node_modules/mock-couch/node_modules/xmldom": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz", + "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk=", + "extraneous": true + }, + "node_modules/mock-couch/node_modules/yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", diff --git a/package.json b/package.json index 29ad9e6..fc75ed8 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "@sentry/node": "^7.102.1", "@sentry/tracing": "^7.102.1", "js-yaml": "4.1.0", + "mock-couch": "^0.1.11", "reflect-metadata": "^0.1.13", "rxjs": "^7.8.1", "uuid": "9.0.1" diff --git a/src/report-changes/storage/couch-db-changes.service.ts b/src/report-changes/storage/couch-db-changes.service.ts index 4d27494..bdde54f 100644 --- a/src/report-changes/storage/couch-db-changes.service.ts +++ b/src/report-changes/storage/couch-db-changes.service.ts @@ -2,6 +2,7 @@ import { ForbiddenException, InternalServerErrorException, NotFoundException, + OnModuleDestroy, UnauthorizedException, } from '@nestjs/common'; import { @@ -17,8 +18,10 @@ import { of, repeat, ReplaySubject, + Subject, Subscription, switchMap, + takeUntil, tap, } from 'rxjs'; import { CouchDbClient } from '../../couchdb/couch-db-client.service'; @@ -37,7 +40,10 @@ export class CouchDbChangesConfig { /** * Access _changes from a CouchDB */ -export class CouchDbChangesService extends DatabaseChangesService { +export class CouchDbChangesService + extends DatabaseChangesService + implements OnModuleDestroy +{ constructor( private couchdbClient: CouchDbClient, private config: CouchDbChangesConfig, @@ -45,6 +51,12 @@ export class CouchDbChangesService extends DatabaseChangesService { super(); } + private _onModuleDestroy = new Subject(); + + onModuleDestroy() { + this._onModuleDestroy.next(); + } + private _changesSubj = new ReplaySubject(1); private _changesSubscription: Subscription | undefined; @@ -61,6 +73,7 @@ export class CouchDbChangesService extends DatabaseChangesService { repeat({ delay: Number.parseInt(this.config.POLL_INTERVAL), }), + takeUntil(this._onModuleDestroy), ); this._changesSubscription = changesFeed diff --git a/test/mock-couch-db-client.ts b/test/mock-couch-db-client.ts deleted file mode 100644 index 39c9ac4..0000000 --- a/test/mock-couch-db-client.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { CouchDbClient } from '../src/couchdb/couch-db-client.service'; -import { of } from 'rxjs'; - -export function mockCouchDbClient() { - return { - getDatabaseDocument: jest - .spyOn(CouchDbClient.prototype, 'getDatabaseDocument') - .mockImplementation(() => of({})), - }; -} diff --git a/test/report.e2e-spec.ts b/test/report.e2e-spec.ts index 926b71f..574bd62 100644 --- a/test/report.e2e-spec.ts +++ b/test/report.e2e-spec.ts @@ -1,46 +1,151 @@ -import { Test, TestingModule } from '@nestjs/testing'; +import { Test } from '@nestjs/testing'; import { INestApplication } from '@nestjs/common'; import * as request from 'supertest'; import jestOpenAPI from 'jest-openapi'; import { AppModule } from '../src/app.module'; -import { ReportChangesService } from '../src/report-changes/core/report-changes.service'; -import { CouchSqsClient } from '../src/report/sqs/couch-sqs.client'; -import { of } from 'rxjs'; -import { mockCouchDbClient } from './mock-couch-db-client'; +import { ReportDoc } from '../src/report/repository/report-repository.service'; + +// eslint-disable-next-line @typescript-eslint/no-var-requires +const mockCouch = require('mock-couch'); jestOpenAPI(__dirname + '/../docs/api-specs/reporting-api-v1.yaml'); describe('Report (e2e)', () => { - const API_PREFIX = '/api/v1/reporting'; + const API_REPORTING_PREFIX = '/api/v1/reporting'; + const API_NOTIFICATION_PREFIX = '/api/v1/notifications'; let app: INestApplication; + let couchdb: MockCouch; + beforeEach(async () => { - mockCouchDbClient(); + couchdb = mockCouch.createServer(); + couchdb.listen(5984); + couchdb.addDB('app', [ + { name: 'one name', lastname: 'one lastname' }, + { + _id: '4568797890', + name: 'second name', + lastname: 'other lastname', + }, + ]); + couchdb.addDB('notification-webhook', []); + couchdb.addDB('report-calculation', []); - const moduleFixture: TestingModule = await Test.createTestingModule({ + const moduleFixture = await Test.createTestingModule({ imports: [AppModule], - }) - // TODO: use overrideModule? - .overrideProvider(ReportChangesService) - .useValue({}) - .overrideProvider(CouchSqsClient) - .useValue({ executeQuery: jest.fn().mockReturnValue(of('')) }) - .compile(); + }).compile(); app = moduleFixture.createNestApplication(); await app.init(); }); afterEach(async () => { - // shut down to stop cronjobs await app.close(); + couchdb.close(); }); - it('/report (GET)', () => { + it('should list all available reports [GET /report]', () => { + const report: Partial = { + _id: 'ReportConfig:1', + _rev: '1-123', + title: 'Test Report', + mode: 'sql', + aggregationDefinitions: [], + }; + couchdb.addDoc('app', report); + return request(app.getHttpServer()) - .get(API_PREFIX + '/report') + .get(API_REPORTING_PREFIX + '/report') .expect(200) - .expect([]) + .expect([ + { + id: 'ReportConfig:1', + name: report.title, + calculationPending: false, + schema: { fields: [] }, + }, + ]) .then((res) => expect(res).toSatisfyApiSpec()); }); + + it('should get details of one report [GET /report/:reportId]', () => { + const reportId = 'ReportConfig:1'; + const report: Partial = { + _id: reportId, + _rev: '1-123', + title: 'Test Report', + mode: 'sql', + aggregationDefinitions: ['SELECT prop1 as a, prop2 as b FROM Events'], + }; + couchdb.addDoc('app', report); + + return request(app.getHttpServer()) + .get(API_REPORTING_PREFIX + '/report/' + reportId) + .expect(200) + .expect({ + id: reportId, + name: report.title, + calculationPending: false, + schema: { fields: [['a', 'b']] }, // TODO: this should be a flat array? + }) + .then((res) => expect(res).toSatisfyApiSpec()); + }); + + it('should trigger a calculation for the report [POST /report-calculation/:reportId]', () => {}); + + it('should get status of calculation [GET /report-calculation/:calculationId]', () => {}); + + it('should get data of report results for completed calculation [GET /report-calculation/:calculationId/data]', () => {}); + + it('should return 404 when trying to get data of pending calculation [GET /report-calculation/:calculationId/data]', () => {}); + + // TODO: MOVE TO SEPARATE FILE + + it('should register a webhook [POST /webhook]', () => {}); + + it('should get details for registered webhook [GET /webhook/:webhookId]', () => {}); + + it('should subscribe to report events for webhook and receive an initial event [POST /webhook/:webhookId/subscribe/report/:reportId]', () => {}); + + it('should receive an event after data changed', () => {}); + + it('should receive an event for each affected subscribed report', () => { + const reportId1 = 'ReportConfig:1'; + const report1: Partial = { + _id: reportId1, + _rev: '1-123', + title: 'Test 1', + mode: 'sql', + aggregationDefinitions: ['SELECT prop1 as a, prop2 as b FROM Events'], + }; + couchdb.addDoc('app', report1); + const reportId2 = 'ReportConfig:2'; + const report2: Partial = { + _id: reportId2, + _rev: '1-123', + title: 'Test 2', + mode: 'sql', + aggregationDefinitions: ['SELECT prop3 as c FROM Events'], + }; + couchdb.addDoc('app', report2); + + return request(app.getHttpServer()).post( + API_NOTIFICATION_PREFIX + '/webhook', + ); + }); + + it('should stop receiving events after unsubscribe [DELETE /webhook/:webhookId/subscribe/report/:reportId]', () => {}); }); + +/** + * see https://chris-l.github.io/mock-couch/ + */ +interface MockCouch { + listen(port: number): void; + + close(): void; + + addDB(dbName: string, docs: any[]): any; + + addDoc(dbName: string, doc: any): any; +}