Merge pull request #3830 from overleaf/em-upgrade-node-12

Upgrade to Node 12

GitOrigin-RevId: 19870922884b7c98e7e5f2c94df21829672d2db5
This commit is contained in:
Eric Mc Sween 2021-03-31 08:20:55 -04:00 committed by Copybot
parent c2f16621db
commit 9ddaa8c9f6
176 changed files with 695 additions and 1555 deletions

View file

@ -1,5 +1,5 @@
# the base image is suitable for running web with /app bind mounted
FROM node:10.23.1 as base
FROM node:12.21.0 as base
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:10.23.1
FROM node:12.21.0
# Install Google Chrome
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -

View file

@ -19,7 +19,7 @@ services:
user: node
test_acceptance:
image: node:10.23.1
image: node:12.21.0
volumes:
- .:/app
working_dir: /app

View file

@ -87,7 +87,7 @@ class Parser {
// check incidentals, see if we should pluck out a match
if (incidentalCommands.length > 1) {
const bestMatch = incidentalCommands.sort(
(a, b) => a[1] + a[2] < b[1] + b[2]
(a, b) => b[1] + b[2] - (a[1] + a[2])
)[0]
realCommands.push(bestMatch)
}

View file

@ -477,8 +477,10 @@ export default FileTreeManager = class FileTreeManager {
return -(aDepth - bDepth) // Deeper path == folder first
} else if (a.path < b.path) {
return -1
} else {
} else if (a.path > b.path) {
return 1
} else {
return 0
}
})
}

View file

@ -705,8 +705,10 @@ export default RangesTracker = class RangesTracker {
return result
} else if (c1.op.i != null && c2.op.d != null) {
return 1
} else {
} else if (c1.op.d != null && c2.op.i != null) {
return -1
} else {
return 0
}
})
@ -727,8 +729,10 @@ export default RangesTracker = class RangesTracker {
return result
} else if (a.i != null && b.d != null) {
return 1
} else {
} else if (a.d != null && b.i != null) {
return -1
} else {
return 0
}
})

View file

@ -12,7 +12,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
require('chai').should()
const { expect } = require('chai')
const sinon = require('sinon')
const modulePath = require('path').join(
@ -31,17 +30,8 @@ describe('LaunchpadController', function() {
this.User = {}
this.LaunchpadController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'settings-sharelatex': (this.Settings = {}),
'logger-sharelatex': (this.Logger = {
log() {},
warn() {},
err() {},
error() {}
}),
'@overleaf/metrics': (this.Metrics = {}),
'../../../../app/src/Features/User/UserRegistrationHandler': (this.UserRegistrationHandler = {}),
'../../../../app/src/Features/Email/EmailHandler': (this.EmailHandler = {}),

View file

@ -19,9 +19,6 @@ describe('UserActivateController', function() {
this.UserGetter = { getUser: sinon.stub() }
this.ErrorController = { notFound: sinon.stub() }
this.UserActivateController = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'../../../../app/src/Features/User/UserGetter': this.UserGetter,
'../../../../app/src/Features/Errors/ErrorController': this

View file

@ -3401,9 +3401,9 @@
},
"dependencies": {
"core-js": {
"version": "3.8.3",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.8.3.tgz",
"integrity": "sha512-KPYXeVZYemC2TkNEkX/01I+7yd+nX3KddKwZ1Ww7SKWdI2wQprSgLmrTddT8nw92AjEklTsPBoSdQBhbI1bQ6Q=="
"version": "3.9.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.9.1.tgz",
"integrity": "sha512-gSjRvzkxQc1zjM/5paAmL4idJBFzuJoo+jDjF1tStYFMV2ERfD02HhahhCGXUyHxQRG4yFKVSdO6g62eoRMcDg=="
}
}
},
@ -6000,6 +6000,12 @@
"cuid": "^2.1.1"
}
},
"@ungap/promise-all-settled": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
"integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==",
"dev": true
},
"@webassemblyjs/ast": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz",
@ -14928,21 +14934,10 @@
}
},
"flat": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz",
"integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==",
"dev": true,
"requires": {
"is-buffer": "~2.0.3"
},
"dependencies": {
"is-buffer": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz",
"integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==",
"dev": true
}
}
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
"integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",
"dev": true
},
"flat-cache": {
"version": "3.0.4",
@ -15440,7 +15435,7 @@
"functional-red-black-tree": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==",
"dev": true
},
"functions-have-names": {
@ -20718,128 +20713,369 @@
}
},
"mocha": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.2.tgz",
"integrity": "sha512-FgDS9Re79yU1xz5d+C4rv1G7QagNGHZ+iXF81hO8zY35YZZcLEsJVfFolfsqKFWunATEvNzMK0r/CwWd/szO9A==",
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-8.3.2.tgz",
"integrity": "sha512-UdmISwr/5w+uXLPKspgoV7/RXZwKRTiTjJ2/AC5ZiEztIoOYdfKb19+9jNmEInzx5pBsCyJQzarAxqIGBNYJhg==",
"dev": true,
"requires": {
"ansi-colors": "3.2.3",
"@ungap/promise-all-settled": "1.1.2",
"ansi-colors": "4.1.1",
"browser-stdout": "1.3.1",
"debug": "3.2.6",
"diff": "3.5.0",
"escape-string-regexp": "1.0.5",
"find-up": "3.0.0",
"glob": "7.1.3",
"chokidar": "3.5.1",
"debug": "4.3.1",
"diff": "5.0.0",
"escape-string-regexp": "4.0.0",
"find-up": "5.0.0",
"glob": "7.1.6",
"growl": "1.10.5",
"he": "1.2.0",
"js-yaml": "3.13.1",
"log-symbols": "2.2.0",
"js-yaml": "4.0.0",
"log-symbols": "4.0.0",
"minimatch": "3.0.4",
"mkdirp": "0.5.1",
"ms": "2.1.1",
"node-environment-flags": "1.0.5",
"object.assign": "4.1.0",
"strip-json-comments": "2.0.1",
"supports-color": "6.0.0",
"which": "1.3.1",
"ms": "2.1.3",
"nanoid": "3.1.20",
"serialize-javascript": "5.0.1",
"strip-json-comments": "3.1.1",
"supports-color": "8.1.1",
"which": "2.0.2",
"wide-align": "1.1.3",
"yargs": "13.3.0",
"yargs-parser": "13.1.1",
"yargs-unparser": "1.6.0"
"workerpool": "6.1.0",
"yargs": "16.2.0",
"yargs-parser": "20.2.4",
"yargs-unparser": "2.0.0"
},
"dependencies": {
"ansi-colors": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz",
"integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==",
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
"dev": true
},
"camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
"dev": true
},
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
"anymatch": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
"integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==",
"dev": true,
"requires": {
"ms": "^2.1.1"
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
}
},
"argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
},
"binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"dev": true
},
"braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"requires": {
"fill-range": "^7.0.1"
}
},
"chokidar": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz",
"integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==",
"dev": true,
"requires": {
"anymatch": "~3.1.1",
"braces": "~3.0.2",
"fsevents": "~2.3.1",
"glob-parent": "~5.1.0",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.5.0"
}
},
"cliui": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
"dev": true,
"requires": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^7.0.0"
}
},
"debug": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
"dev": true,
"requires": {
"ms": "2.1.2"
},
"dependencies": {
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
}
}
},
"diff": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
"integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==",
"dev": true
},
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true
},
"escape-string-regexp": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
"dev": true
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"requires": {
"to-regex-range": "^5.0.1"
}
},
"find-up": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
"integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
"dev": true,
"requires": {
"locate-path": "^3.0.0"
"locate-path": "^6.0.0",
"path-exists": "^4.0.0"
}
},
"glob": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
"integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
"glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
"is-glob": "^4.0.1"
}
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true
},
"is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true,
"requires": {
"binary-extensions": "^2.0.0"
}
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
},
"is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
"js-yaml": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz",
"integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==",
"dev": true,
"requires": {
"argparse": "^2.0.1"
}
},
"locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
"integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
"dev": true,
"requires": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
"p-locate": "^5.0.0"
}
},
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha512-miQKw5Hv4NS1Psg2517mV4e4dYNaO3++hjAvLOAzKqZ61rH8NS1SK+vbfBWZ5PY/Me/bEWhUwqMghEW5Fb9T7Q=="
"log-symbols": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz",
"integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==",
"dev": true,
"requires": {
"chalk": "^4.0.0"
}
},
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"dev": true
},
"p-locate": {
"normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"dev": true
},
"p-limit": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
"integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
"dev": true,
"requires": {
"p-limit": "^2.0.0"
"yocto-queue": "^0.1.0"
}
},
"supports-color": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz",
"integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==",
"p-locate": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
"integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
"p-limit": "^3.0.2"
}
},
"path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
"dev": true
},
"readdirp": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz",
"integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==",
"dev": true,
"requires": {
"picomatch": "^2.2.1"
}
},
"serialize-javascript": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz",
"integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==",
"dev": true,
"requires": {
"randombytes": "^2.1.0"
}
},
"string-width": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz",
"integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==",
"dev": true,
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.0"
}
},
"strip-ansi": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
"dev": true,
"requires": {
"ansi-regex": "^5.0.0"
}
},
"strip-json-comments": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
"integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
"dev": true
},
"supports-color": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
"dev": true,
"requires": {
"has-flag": "^4.0.0"
}
},
"to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"requires": {
"is-number": "^7.0.0"
}
},
"which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"requires": {
"isexe": "^2.0.0"
}
},
"wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
"requires": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
}
},
"y18n": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz",
"integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==",
"dev": true
},
"yargs": {
"version": "16.2.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
"integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
"dev": true,
"requires": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.0",
"y18n": "^5.0.5",
"yargs-parser": "^20.2.2"
}
},
"yargs-parser": {
"version": "13.1.1",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz",
"integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==",
"dev": true,
"requires": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
}
"version": "20.2.4",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz",
"integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==",
"dev": true
}
}
},
@ -21147,6 +21383,12 @@
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
"integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw=="
},
"nanoid": {
"version": "3.1.20",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz",
"integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==",
"dev": true
},
"nanomatch": {
"version": "1.2.9",
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.9.tgz",
@ -21185,7 +21427,7 @@
"natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
"integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
"dev": true
},
"ncp": {
@ -21334,24 +21576,6 @@
"resolved": "https://registry.npmjs.org/node-ensure/-/node-ensure-0.0.0.tgz",
"integrity": "sha512-DRI60hzo2oKN1ma0ckc6nQWlHU69RH6xN0sjQTjMpChPfTYvKZdcQFfdYK2RWbJcKyUizSIy/l8OTGxMAM1QDw=="
},
"node-environment-flags": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz",
"integrity": "sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ==",
"dev": true,
"requires": {
"object.getownpropertydescriptors": "^2.0.3",
"semver": "^5.7.0"
},
"dependencies": {
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
}
}
},
"node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
@ -27008,7 +27232,7 @@
"require-like": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/require-like/-/require-like-0.1.2.tgz",
"integrity": "sha512-oyrU88skkMtDdauHDuKVrgR+zuItqr6/c//FXzvmxRGMexSDc6hNvJInGW3LL46n+8b50RykrvwSUIIQH2LQ5A==",
"integrity": "sha1-rW8wwTvs15cBDEaK+ndcDAprR/o=",
"dev": true
},
"require-main-filename": {
@ -27410,19 +27634,19 @@
}
},
"sandboxed-module": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/sandboxed-module/-/sandboxed-module-0.3.0.tgz",
"integrity": "sha1-8fvvvYCaT2kHO9B8rm/H2y6vX2o=",
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/sandboxed-module/-/sandboxed-module-2.0.4.tgz",
"integrity": "sha512-AwEPOdO8mg/wJjr876yCHP2DHqVN0MaggEXhp6IIf3bcI5cYoQl9QrrCHSrvToHjvdEiS5x4TVZRgjD2bEmNTA==",
"dev": true,
"requires": {
"require-like": "0.1.2",
"stack-trace": "0.0.6"
"stack-trace": "0.0.9"
},
"dependencies": {
"stack-trace": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.6.tgz",
"integrity": "sha1-HnGb1qJin/CcGJ4Xqe+QKpT8XbA=",
"version": "0.0.9",
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz",
"integrity": "sha1-qPbq7KkGdMMz58Q5U/J1tFFRBpU=",
"dev": true
}
}
@ -32922,6 +33146,12 @@
"microevent.ts": "~0.1.1"
}
},
"workerpool": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz",
"integrity": "sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg==",
"dev": true
},
"wrap-ansi": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
@ -33274,14 +33504,35 @@
}
},
"yargs-unparser": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz",
"integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz",
"integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==",
"dev": true,
"requires": {
"flat": "^4.1.0",
"lodash": "^4.17.15",
"yargs": "^13.3.0"
"camelcase": "^6.0.0",
"decamelize": "^4.0.0",
"flat": "^5.0.2",
"is-plain-obj": "^2.1.0"
},
"dependencies": {
"camelcase": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
"integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==",
"dev": true
},
"decamelize": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
"integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",
"dev": true
},
"is-plain-obj": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
"integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",
"dev": true
}
}
},
"yauzl": {

View file

@ -14,7 +14,7 @@
"scripts": {
"test:acceptance:run_dir": "mocha --recursive --timeout 25000 --exit --grep=$MOCHA_GREP --require test/acceptance/bootstrap.js",
"test:acceptance:app": "npm run test:acceptance:run_dir -- test/acceptance/src",
"test:unit:run_dir": "mocha --recursive --timeout 25000 --exit --grep=$MOCHA_GREP --file test/unit/bootstrap.js",
"test:unit:run_dir": "mocha --recursive --timeout 25000 --exit --grep=$MOCHA_GREP --require test/unit/bootstrap.js",
"test:unit:all": "npm run test:unit:run_dir -- test/unit/src modules/*/test/unit/src",
"test:unit:all:silent": "npm run test:unit:all -- --reporter dot",
"test:unit:app": "npm run test:unit:run_dir -- test/unit/src",
@ -223,7 +223,7 @@
"mathjax": "^2.7.9",
"mini-css-extract-plugin": "^0.8.0",
"mkdirp": "0.5.1",
"mocha": "^6.2.2",
"mocha": "^8.3.2",
"mock-fs": "^4.11.0",
"node-fetch": "^2.6.1",
"nodemon": "^2.0.6",
@ -233,7 +233,7 @@
"prettier": "^1.19.1",
"requirejs": "^2.3.6",
"samlp": "^3.4.1",
"sandboxed-module": "0.3.0",
"sandboxed-module": "^2.0.4",
"sinon": "^7.5.0",
"sinon-chai": "^3.5.0",
"sinon-mongoose": "^2.3.0",

View file

@ -1,6 +1,8 @@
const chai = require('chai')
chai.should()
chai.use(require('chai-as-promised'))
chai.use(require('chaid'))
chai.use(require('sinon-chai'))
// Do not truncate assertion errors
chai.config.truncateThreshold = 0

View file

@ -11,7 +11,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const Settings = require('settings-sharelatex')
const chai = require('chai')
const request = require('./helpers/request')
describe('siteIsOpen', function() {

View file

@ -1,7 +1,4 @@
const chai = require('chai')
const expect = chai.expect
const chaiAsPromised = require('chai-as-promised')
chai.use(chaiAsPromised)
const { expect } = require('chai')
const { User } = require('../../../app/src/models/User')
const { Subscription } = require('../../../app/src/models/Subscription')

View file

@ -9,14 +9,13 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const should = require('chai').should()
const { assert } = require('chai')
const { assert, expect } = require('chai')
const async = require('async')
const request = require('./helpers/request')
const assertResponse = (path, expectedStatusCode, expectedBody, cb) =>
request.get(path, (error, response) => {
should.not.exist(error)
expect(error).not.to.exist
response.statusCode.should.equal(expectedStatusCode)
if (expectedBody) {
assert.deepEqual(JSON.parse(response.body), expectedBody)

View file

@ -9,14 +9,13 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const should = require('chai').should()
const { assert } = require('chai')
const { assert, expect } = require('chai')
const async = require('async')
const request = require('./helpers/request')
const assertRedirect = (method, path, expectedStatusCode, destination, cb) =>
request[method](path, (error, response) => {
should.not.exist(error)
expect(error).not.to.exist
response.statusCode.should.equal(expectedStatusCode)
response.headers.location.should.equal(destination)
return cb()
@ -85,7 +84,7 @@ describe('RedirectUrls', function() {
return request.get(
{ url: '/redirect/one', headers: { 'x-skip-redirects': 'true' } },
(error, response) => {
should.not.exist(error)
expect(error).not.to.exist
response.statusCode.should.equal(404)
return done()
}

View file

@ -2,8 +2,7 @@
handle-callback-err
*/
const { expect } = require('chai')
const { assert } = require('chai')
const { assert, expect } = require('chai')
const async = require('async')
const User = require('./helpers/User')
const redis = require('./helpers/redis')

View file

@ -8,7 +8,7 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const should = require('chai').should()
const { expect } = require('chai')
const async = require('async')
const User = require('./helpers/User')
const MockV1ApiClass = require('./mocks/MockV1Api')
@ -56,7 +56,7 @@ describe('SettingsPage', function() {
it('update main email address', function(done) {
const newEmail = 'foo@bar.com'
return this.user.updateSettings({ email: newEmail }, error => {
should.not.exist(error)
expect(error).not.to.exist
return this.user.get((error, user) => {
user.email.should.equal(newEmail)
user.emails.length.should.equal(1)
@ -77,7 +77,7 @@ describe('SettingsPage', function() {
it('should be able to update settings', function(done) {
const newName = 'third-party-references'
this.user.updateSettings({ first_name: newName }, error => {
should.not.exist(error)
expect(error).not.to.exist
this.user.get((error, user) => {
user.first_name.should.equal(newName)
done()

View file

@ -1,12 +1,7 @@
const AuthenticationManager = require('../../../app/src/Features/Authentication/AuthenticationManager')
const UserHelper = require('./helpers/UserHelper')
const chai = require('chai')
const chaiAsPromised = require('chai-as-promised')
const Features = require('../../../app/src/infrastructure/Features')
const expect = chai.expect
chai.should()
chai.use(chaiAsPromised)
const { expect } = require('chai')
describe('UserHelper', function() {
// Disable all tests unless the public-registration feature is enabled

View file

@ -12,7 +12,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const { expect } = require('chai')
const should = require('chai').should()
const async = require('async')
const User = require('./helpers/User')

View file

@ -14,9 +14,7 @@ const Errors = require('../../../app/src/Features/Errors/Errors')
const Settings = require('settings-sharelatex')
const User = require('./helpers/User')
const ThirdPartyIdentityManager = require('../../../app/src/Features/User/ThirdPartyIdentityManager')
const chai = require('chai')
const { expect } = chai
const { expect } = require('chai')
describe('ThirdPartyIdentityManager', function() {
beforeEach(function(done) {

View file

@ -1,6 +1,11 @@
const Path = require('path')
const chai = require('chai')
const sinon = require('sinon')
/*
* Chai configuration
*/
// add chai.should()
chai.should()
@ -17,52 +22,108 @@ chai.config.truncateThreshold = 0
// add support for mongoose in sinon
require('sinon-mongoose')
afterEach(function() {
sinon.restore()
})
/*
* Global stubs
*/
const globalStubsSandbox = sinon.createSandbox()
const globalStubs = {
logger: {
debug: globalStubsSandbox.stub(),
info: globalStubsSandbox.stub(),
log: globalStubsSandbox.stub(),
warn: globalStubsSandbox.stub(),
err: globalStubsSandbox.stub(),
error: globalStubsSandbox.stub(),
fatal: globalStubsSandbox.stub()
}
}
/*
* Sandboxed module configuration
*/
const SandboxedModule = require('sandboxed-module')
const PromisesUtils = require('../../app/src/util/promises')
const Errors = require('../../app/src/Features/Errors/Errors')
const GLOBAL_REQUIRE_CACHE_FOR_SANDBOXED_MODULES = {
// cache p-limit for all expressify/promisifyAll users
'../../util/promises': PromisesUtils,
'../../../../app/src/util/promises': PromisesUtils,
// Errors are widely used and instance checks need the exact same prototypes
'../Errors/Errors': Errors,
'../../../../app/src/Features/Errors/Errors': Errors,
'../../../../../app/src/Features/Errors/Errors': Errors
}
const LIBRARIES = [
'@overleaf/o-error',
'async',
'lodash',
'moment',
'underscore',
'xml2js',
'json2csv',
'sanitize-html',
'marked'
]
LIBRARIES.forEach(lib => {
GLOBAL_REQUIRE_CACHE_FOR_SANDBOXED_MODULES[lib] = require(lib)
})
SandboxedModule.configure({
requires: GLOBAL_REQUIRE_CACHE_FOR_SANDBOXED_MODULES
requires: getSandboxedModuleRequires(),
globals: { Buffer, Promise, console, process },
sourceTransformers: {
coffee(source) {
if (this.filename.endsWith('.coffee')) {
// Coffeescript mucks with Error.prepareStackTrace, which, in turn,
// conflicts with OError. This is a hacky way to prevent Coffeescript
// from interfering.
//
// See https://github.com/jashkenas/coffeescript/blob/07f644c39223e016aceedd2cd71b5941579b5659/src/coffeescript.coffee#L368
const originalPrepareStackTrace = Error.prepareStackTrace
const compiled = require('coffeescript').compile(source)
Error.prepareStackTrace = originalPrepareStackTrace
return compiled
}
return source
}
}
})
function getSandboxedModuleRequires() {
const requires = {
'logger-sharelatex': globalStubs.logger
}
const internalModules = [
'../../app/src/util/promises',
'../../app/src/Features/Errors/Errors',
'../../app/src/Features/Helpers/Mongo'
]
const externalLibs = [
'async',
'json2csv',
'lodash',
'marked',
'moment',
'@overleaf/o-error',
'sanitize-html',
'sshpk',
'underscore',
'xml2js'
]
for (const modulePath of internalModules) {
requires[Path.resolve(__dirname, modulePath)] = require(modulePath)
}
for (const lib of externalLibs) {
requires[lib] = require(lib)
}
return requires
}
/*
* Mocha hooks
*/
// sandboxed-module somehow registers every fake module it creates in this
// module's children array, which uses quite a big amount of memory. We'll take
// a copy of the module children array and restore it after each test so that
// the garbage collector has a chance to reclaim the fake modules.
let initialModuleChildren
before('record initial module children', function() {
initialModuleChildren = module.children.slice()
})
afterEach('restore module children', function() {
// Delete leaking sandboxed modules
module.children = initialModuleChildren.slice()
})
exports.mochaHooks = {
beforeAll() {
// Record initial module children
initialModuleChildren = module.children.slice()
},
beforeEach() {
// Install logger stub
this.logger = globalStubs.logger
},
afterEach() {
// Delete leaking sandboxed modules
module.children = initialModuleChildren.slice()
// Reset global stubs
globalStubsSandbox.reset()
// Restore other stubs
sinon.restore()
}
}

View file

@ -24,18 +24,12 @@ describe('AnalyticsController', function() {
}
this.controller = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'./AnalyticsManager': this.AnalyticsManager,
'../Authentication/AuthenticationController': this
.AuthenticationController,
'../Institutions/InstitutionsAPI': this.InstitutionsAPI,
'../../infrastructure/Features': this.Features,
'logger-sharelatex': {
log() {}
},
'../../infrastructure/GeoIpLookup': (this.GeoIpLookup = {
getDetails: sinon.stub()
})

View file

@ -40,14 +40,8 @@ describe('AnalyticsManager', function() {
this.backgroundRequest = sinon.stub().yields()
this.request = sinon.stub().yields()
this.AnalyticsManager = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'settings-sharelatex': this.Settings,
'logger-sharelatex': {
warn() {}
},
'../../infrastructure/Queues': this.Queues
}
})

View file

@ -1,6 +1,5 @@
const sinon = require('sinon')
const chai = require('chai')
const { expect } = chai
const { expect } = require('chai')
const modulePath =
'../../../../app/src/Features/Authentication/AuthenticationController.js'
const SandboxedModule = require('sandboxed-module')
@ -19,9 +18,6 @@ describe('AuthenticationController', function() {
.slice(2)
}
this.AuthenticationController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../User/UserAuditLogHandler': (this.UserAuditLogHandler = {
addEntry: sinon.stub().yields(null)
@ -49,12 +45,6 @@ describe('AuthenticationController', function() {
identifyUser: sinon.stub()
}),
'../../infrastructure/SessionStoreManager': (this.SessionStoreManager = {}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
warn: sinon.stub(),
error: sinon.stub(),
err: sinon.stub()
}),
'settings-sharelatex': (this.Settings = {
siteUrl: 'http://www.foo.bar',
httpAuthUsers: this.httpAuthUsers

View file

@ -1,11 +1,9 @@
const sinon = require('sinon')
const chai = require('chai')
const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb')
const AuthenticationErrors = require('../../../../app/src/Features/Authentication/AuthenticationErrors')
chai.should()
const { expect } = chai
const modulePath =
'../../../../app/src/Features/Authentication/AuthenticationManager.js'
@ -13,9 +11,6 @@ describe('AuthenticationManager', function() {
beforeEach(function() {
this.settings = { security: { bcryptRounds: 4 } }
this.AuthenticationManager = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../../models/User': {
User: (this.User = {})

View file

@ -12,9 +12,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath =
'../../../../app/src/Features/Authorization/AuthorizationManager.js'
const SandboxedModule = require('sandboxed-module')
@ -24,9 +22,6 @@ const { ObjectId } = require('mongodb')
describe('AuthorizationManager', function() {
beforeEach(function() {
this.AuthorizationManager = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
mongodb: { ObjectId },
'../Collaborators/CollaboratorsGetter': (this.CollaboratorsGetter = {}),

View file

@ -30,12 +30,8 @@ describe('AuthorizationMiddleware', function() {
}
this.AuthorizationManager = {}
this.AuthorizationMiddleware = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'./AuthorizationManager': this.AuthorizationManager,
'logger-sharelatex': { log() {} },
mongodb: {
ObjectId: this.ObjectId
},

View file

@ -1,4 +1,3 @@
require('chai').should()
const SandboxedModule = require('sandboxed-module')
const path = require('path')
const sinon = require('sinon')
@ -23,9 +22,6 @@ describe('BetaProgramController', function() {
}
}
this.BetaProgramController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'./BetaProgramHandler': (this.BetaProgramHandler = {
optIn: sinon.stub(),
@ -37,12 +33,6 @@ describe('BetaProgramController', function() {
'settings-sharelatex': (this.settings = {
languages: {}
}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
warn: sinon.stub(),
err: sinon.stub(),
error: sinon.stub()
}),
'../Authentication/AuthenticationController': (this.AuthenticationController = {
getLoggedInUserId: sinon.stub().returns(this.user._id)
})

View file

@ -18,13 +18,10 @@ describe('BetaProgramHandler', function() {
save: sinon.stub().callsArgWith(0, null)
}
this.handler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'@overleaf/metrics': (this.logger = {
'@overleaf/metrics': {
inc: sinon.stub()
}),
},
'../User/UserUpdater': (this.UserUpdater = {
promises: {
updateUser: sinon.stub().resolves()

View file

@ -11,12 +11,11 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
let { expect } = require('chai')
const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
const path = require('path')
const sinon = require('sinon')
;({ expect } = require('chai'))
const modulePath = path.join(
__dirname,
'../../../../app/src/Features/BrandVariations/BrandVariationsHandler'
@ -31,19 +30,10 @@ describe('BrandVariationsHandler', function() {
}
}
}
this.logger = {
warn() {},
err() {},
log() {}
}
this.V1Api = { request: sinon.stub() }
this.BrandVariationsHandler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'settings-sharelatex': this.settings,
'logger-sharelatex': this.logger,
'../V1/V1Api': this.V1Api
}
})

View file

@ -10,7 +10,6 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const should = require('chai').should()
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
const path = require('path')
@ -32,16 +31,8 @@ describe('ChatApiHandler', function() {
}
this.request = sinon.stub()
this.ChatApiHandler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'settings-sharelatex': this.settings,
'logger-sharelatex': {
log: sinon.stub(),
warn: sinon.stub(),
error: sinon.stub()
},
request: this.request
}
})

View file

@ -12,7 +12,6 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const should = require('chai').should()
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
const path = require('path')
@ -33,21 +32,14 @@ describe('ChatController', function() {
getLoggedInUserId: sinon.stub().returns(this.user_id)
}
this.ChatController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'settings-sharelatex': this.settings,
'logger-sharelatex': {
log() {}
},
'./ChatApiHandler': this.ChatApiHandler,
'../Editor/EditorRealTimeController': this.EditorRealTimeController,
'../Authentication/AuthenticationController': this
.AuthenticationController,
'../User/UserInfoManager': (this.UserInfoManager = {}),
'../User/UserInfoController': (this.UserInfoController = {}),
'../Comments/CommentsController': (this.CommentsController = {})
'../User/UserInfoController': (this.UserInfoController = {})
}
})
this.req = {

View file

@ -50,16 +50,8 @@ describe('CollaboratorsController', function() {
transferOwnership: sinon.stub().resolves()
}
}
this.logger = {
err: sinon.stub(),
warn: sinon.stub(),
log: sinon.stub()
}
this.CollaboratorsController = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
mongodb: { ObjectId },
'./CollaboratorsHandler': this.CollaboratorsHandler,
@ -69,8 +61,7 @@ describe('CollaboratorsController', function() {
'../../Features/Errors/HttpErrorHandler': this.HttpErrorHandler,
'../Tags/TagsHandler': this.TagsHandler,
'../Authentication/AuthenticationController': this
.AuthenticationController,
'logger-sharelatex': this.logger
.AuthenticationController
}
})
})

View file

@ -47,9 +47,6 @@ describe('CollaboratorsGetter', function() {
buildOwnerAndMembersViews: sinon.stub()
}
this.CollaboratorsGetter = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
mongodb: { ObjectId },
'../User/UserGetter': this.UserGetter,

View file

@ -16,11 +16,6 @@ const sleep = promisify(setTimeout)
describe('CollaboratorsHandler', function() {
beforeEach(function() {
this.logger = {
log: sinon.stub(),
warn: sinon.stub(),
err: sinon.stub()
}
this.userId = ObjectId()
this.addingUserId = ObjectId()
this.project = {
@ -66,11 +61,7 @@ describe('CollaboratorsHandler', function() {
}
}
this.CollaboratorsHandler = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'logger-sharelatex': this.logger,
'../User/UserGetter': this.UserGetter,
'../Contacts/ContactManager': this.ContactManager,
'../../models/Project': { Project },

View file

@ -12,9 +12,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath =
'../../../../app/src/Features/Collaborators/CollaboratorsInviteController.js'
const SandboxedModule = require('sandboxed-module')
@ -44,21 +42,12 @@ describe('CollaboratorsInviteController', function() {
}
this.CollaboratorsInviteController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../Project/ProjectGetter': (this.ProjectGetter = {}),
'../Subscription/LimitationsManager': this.LimitationsManager,
'../User/UserGetter': this.UserGetter,
'./CollaboratorsGetter': (this.CollaboratorsGetter = {}),
'./CollaboratorsInviteHandler': (this.CollaboratorsInviteHandler = {}),
'logger-sharelatex': (this.logger = {
err: sinon.stub(),
error: sinon.stub(),
warn: sinon.stub(),
log: sinon.stub()
}),
'../Editor/EditorRealTimeController': (this.EditorRealTimeController = {
emitToRoom: sinon.stub()
}),

View file

@ -15,9 +15,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath =
'../../../../app/src/Features/Collaborators/CollaboratorsInviteHandler.js'
const SandboxedModule = require('sandboxed-module')
@ -55,18 +53,9 @@ describe('CollaboratorsInviteHandler', function() {
})()
this.Crypto = Crypto
this.CollaboratorsInviteHandler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'settings-sharelatex': (this.settings = {}),
'../../models/ProjectInvite': { ProjectInvite: this.ProjectInvite },
'logger-sharelatex': (this.logger = {
err: sinon.stub(),
error: sinon.stub(),
warn: sinon.stub(),
log: sinon.stub()
}),
'./CollaboratorsEmailHandler': (this.CollaboratorsEmailHandler = {}),
'./CollaboratorsHandler': (this.CollaboratorsHandler = {
addUserIdToProject: sinon.stub()

View file

@ -60,9 +60,6 @@ describe('OwnershipTransferHandler', function() {
}
}
this.handler = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'../Project/ProjectGetter': this.ProjectGetter,
'../../models/Project': {
@ -72,12 +69,7 @@ describe('OwnershipTransferHandler', function() {
'../ThirdPartyDataStore/TpdsProjectFlusher': this.TpdsProjectFlusher,
'../Project/ProjectAuditLogHandler': this.ProjectAuditLogHandler,
'../Email/EmailHandler': this.EmailHandler,
'./CollaboratorsHandler': this.CollaboratorsHandler,
'logger-sharelatex': {
log() {},
warn() {},
err() {}
}
'./CollaboratorsHandler': this.CollaboratorsHandler
}
})
})

View file

@ -12,10 +12,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const { assert } = chai
const should = chai.should()
const { expect } = chai
const { assert, expect } = require('chai')
const modulePath = '../../../../app/src/Features/Compile/ClsiCookieManager.js'
const SandboxedModule = require('sandboxed-module')
const realRequst = require('request')
@ -56,18 +53,9 @@ describe('ClsiCookieManager', function() {
client: () => this.redis
}),
'settings-sharelatex': this.settings,
request: this.request,
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub(),
warn: sinon.stub()
})
request: this.request
}
return (this.ClsiCookieManager = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: this.requires
})())
})

View file

@ -12,25 +12,15 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath = '../../../../app/src/Features/Compile/ClsiFormatChecker.js'
const SandboxedModule = require('sandboxed-module')
describe('ClsiFormatChecker', function() {
beforeEach(function() {
this.ClsiFormatChecker = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'settings-sharelatex': (this.settings = { compileBodySizeLimitMb: 5 }),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub(),
warn: sinon.stub()
})
'settings-sharelatex': (this.settings = { compileBodySizeLimitMb: 5 })
}
})
return (this.project_id = 'project-id')

View file

@ -1,6 +1,5 @@
const sinon = require('sinon')
const chai = require('chai')
const { expect } = chai
const { expect } = require('chai')
const modulePath = '../../../../app/src/Features/Compile/ClsiManager.js'
const SandboxedModule = require('sandboxed-module')
@ -25,12 +24,6 @@ describe('ClsiManager', function() {
this.DocumentUpdaterHandler = {
getProjectDocsIfMatch: sinon.stub().callsArgWith(2, null, null)
}
this.logger = {
log: sinon.stub(),
error: sinon.stub(),
err: sinon.stub(),
warn: sinon.stub()
}
this.request = sinon.stub()
this.Metrics = {
Timer: class Metrics {
@ -41,9 +34,6 @@ describe('ClsiManager', function() {
inc: sinon.stub()
}
this.ClsiManager = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'settings-sharelatex': (this.settings = {
apis: {
@ -68,7 +58,6 @@ describe('ClsiManager', function() {
.DocumentUpdaterHandler,
'./ClsiCookieManager': () => this.ClsiCookieManager,
'./ClsiStateManager': this.ClsiStateManager,
'logger-sharelatex': this.logger,
request: this.request,
'./ClsiFormatChecker': this.ClsiFormatChecker,
'@overleaf/metrics': this.Metrics

View file

@ -13,26 +13,16 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath = '../../../../app/src/Features/Compile/ClsiStateManager.js'
const SandboxedModule = require('sandboxed-module')
describe('ClsiStateManager', function() {
beforeEach(function() {
this.ClsiStateManager = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'settings-sharelatex': (this.settings = {}),
'../Project/ProjectEntityHandler': (this.ProjectEntityHandler = {}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub(),
warn: sinon.stub()
})
'../Project/ProjectEntityHandler': (this.ProjectEntityHandler = {})
}
})
this.project = 'project'

View file

@ -12,10 +12,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { assert } = require('chai')
const { expect } = chai
const { assert, expect } = require('chai')
const modulePath = '../../../../app/src/Features/Compile/CompileController.js'
const SandboxedModule = require('sandboxed-module')
const MockRequest = require('../helpers/MockRequest')
@ -61,17 +58,10 @@ describe('CompileController', function() {
isUserLoggedIn: sinon.stub().returns(true)
}
this.CompileController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'settings-sharelatex': this.settings,
request: (this.request = sinon.stub()),
'../Project/ProjectGetter': (this.ProjectGetter = {}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub()
}),
'@overleaf/metrics': (this.Metrics = { inc: sinon.stub() }),
'./CompileManager': this.CompileManager,
'../User/UserGetter': this.UserGetter,

View file

@ -13,11 +13,8 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { assert, expect } = require('chai')
const modulePath = '../../../../app/src/Features/Compile/CompileManager.js'
const { assert } = require('chai')
const SandboxedModule = require('sandboxed-module')
describe('CompileManager', function() {
@ -27,9 +24,6 @@ describe('CompileManager', function() {
const { rateLimitGetStub } = this
this.ratelimiter = { addCount: sinon.stub() }
this.CompileManager = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'settings-sharelatex': (this.settings = {
redis: { web: { host: 'localhost', port: 42 } },
@ -56,10 +50,6 @@ describe('CompileManager', function() {
return Timer
})()),
inc: sinon.stub()
}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
warn: sinon.stub()
})
}
})

View file

@ -12,10 +12,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { assert } = chai
const { expect } = chai
const { assert, expect } = require('chai')
const modulePath = '../../../../app/src/Features/Contacts/ContactController.js'
const SandboxedModule = require('sandboxed-module')
@ -23,14 +20,7 @@ describe('ContactController', function() {
beforeEach(function() {
this.AuthenticationController = { getLoggedInUserId: sinon.stub() }
this.ContactController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub()
}),
'../User/UserGetter': (this.UserGetter = {}),
'./ContactManager': (this.ContactManager = {}),
'../Authentication/AuthenticationController': (this.AuthenticationController = {}),

View file

@ -9,8 +9,6 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const chai = require('chai')
chai.should()
const sinon = require('sinon')
const modulePath = '../../../../app/src/Features/Contacts/ContactManager'
const SandboxedModule = require('sandboxed-module')
@ -18,9 +16,6 @@ const SandboxedModule = require('sandboxed-module')
describe('ContactManager', function() {
beforeEach(function() {
this.ContactManager = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
request: (this.request = sinon.stub()),
'settings-sharelatex': (this.settings = {

View file

@ -12,7 +12,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const { expect } = require('chai')
const modulePath = require('path').join(
__dirname,
@ -25,12 +24,8 @@ describe('CooldownManager', function() {
this.rclient = { set: sinon.stub(), get: sinon.stub() }
this.RedisWrapper = { client: () => this.rclient }
return (this.CooldownManager = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../../infrastructure/RedisWrapper': this.RedisWrapper,
'logger-sharelatex': { log: sinon.stub() }
'../../infrastructure/RedisWrapper': this.RedisWrapper
}
}))
})

View file

@ -11,7 +11,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const { expect } = require('chai')
const modulePath = require('path').join(
__dirname,
@ -22,12 +21,8 @@ describe('CooldownMiddleware', function() {
beforeEach(function() {
this.CooldownManager = { isProjectOnCooldown: sinon.stub() }
return (this.CooldownMiddleware = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'./CooldownManager': this.CooldownManager,
'logger-sharelatex': { log: sinon.stub() }
'./CooldownManager': this.CooldownManager
}
}))
})

View file

@ -9,8 +9,6 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const chai = require('chai')
chai.should()
const sinon = require('sinon')
const modulePath = '../../../../app/src/Features/Docstore/DocstoreManager'
const SandboxedModule = require('sandboxed-module')
@ -20,9 +18,6 @@ describe('DocstoreManager', function() {
beforeEach(function() {
this.requestDefaults = sinon.stub().returns((this.request = sinon.stub()))
this.DocstoreManager = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
request: {
defaults: this.requestDefaults
@ -33,12 +28,6 @@ describe('DocstoreManager', function() {
url: 'docstore.sharelatex.com'
}
}
}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
warn: sinon.stub(),
error: sinon.stub(),
err() {}
})
}
})

View file

@ -32,9 +32,6 @@ describe('DocumentUpdaterHandler', function() {
this.callback = sinon.stub()
this.handler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
request: {
defaults: () => {
@ -42,7 +39,6 @@ describe('DocumentUpdaterHandler', function() {
}
},
'settings-sharelatex': this.settings,
'logger-sharelatex': { log() {}, error() {}, warn() {} },
'../Project/ProjectEntityHandler': this.projectEntityHandler,
'../../models/Project': {
Project: (this.Project = {})

View file

@ -11,9 +11,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath =
'../../../../app/src/Features/Documents/DocumentController.js'
const SandboxedModule = require('sandboxed-module')
@ -25,15 +23,7 @@ const Errors = require('../../../../app/src/Features/Errors/Errors')
describe('DocumentController', function() {
beforeEach(function() {
this.DocumentController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': {
log() {},
warn() {},
err() {}
},
'../Project/ProjectGetter': (this.ProjectGetter = {}),
'../Project/ProjectLocator': (this.ProjectLocator = {}),
'../Project/ProjectEntityHandler': (this.ProjectEntityHandler = {}),

View file

@ -11,9 +11,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath = '../../../../app/src/Features/Documents/DocumentHelper.js'
const SandboxedModule = require('sandboxed-module')

View file

@ -11,9 +11,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath =
'../../../../app/src/Features/Downloads/ProjectDownloadsController.js'
const SandboxedModule = require('sandboxed-module')
@ -30,14 +28,10 @@ describe('ProjectDownloadsController', function() {
return (this.ProjectDownloadsController = SandboxedModule.require(
modulePath,
{
globals: {
console: console
},
requires: {
'./ProjectZipStreamManager': (this.ProjectZipStreamManager = {}),
'../Project/ProjectGetter': (this.ProjectGetter = {}),
'@overleaf/metrics': (this.metrics = {}),
'logger-sharelatex': (this.logger = { log: sinon.stub() }),
'../DocumentUpdater/DocumentUpdaterHandler': this
.DocumentUpdaterHandler
}

View file

@ -16,9 +16,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath =
'../../../../app/src/Features/Downloads/ProjectZipStreamManager.js'
const SandboxedModule = require('sandboxed-module')
@ -33,15 +31,8 @@ describe('ProjectZipStreamManager', function() {
append: sinon.stub()
}
return (this.ProjectZipStreamManager = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
archiver: (this.archiver = sinon.stub().returns(this.archive)),
'logger-sharelatex': (this.logger = {
error: sinon.stub(),
log: sinon.stub()
}),
'../Project/ProjectEntityHandler': (this.ProjectEntityHandler = {}),
'../FileStore/FileStoreHandler': (this.FileStoreHandler = {}),
'../Project/ProjectGetter': (this.ProjectGetter = {})

View file

@ -13,7 +13,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const { expect } = require('chai')
const modulePath = require('path').join(
@ -47,9 +46,6 @@ describe('EditorController', function() {
this.callback = sinon.stub()
return (this.EditorController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../Project/ProjectEntityUpdateHandler': (this.ProjectEntityUpdateHandler = {}),
'../Project/ProjectOptionsHandler': (this.ProjectOptionsHandler = {
@ -70,11 +66,7 @@ describe('EditorController', function() {
'./EditorRealTimeController': (this.EditorRealTimeController = {
emitToRoom: sinon.stub()
}),
'@overleaf/metrics': (this.Metrics = { inc: sinon.stub() }),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
err: sinon.stub()
})
'@overleaf/metrics': (this.Metrics = { inc: sinon.stub() })
}
}))
})

View file

@ -106,10 +106,6 @@ describe('EditorHttpController', function() {
this.ProjectEditorHandler = {
buildProjectModelView: sinon.stub().returns(this.projectView)
}
this.logger = {
log: sinon.stub(),
error: sinon.stub()
}
this.Metrics = { inc: sinon.stub() }
this.TokenAccessHandler = {
getRequestToken: sinon.stub().returns(this.token),
@ -128,15 +124,11 @@ describe('EditorHttpController', function() {
unprocessableEntity: sinon.stub()
}
this.EditorHttpController = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'../Project/ProjectDeleter': this.ProjectDeleter,
'../Project/ProjectGetter': this.ProjectGetter,
'../Authorization/AuthorizationManager': this.AuthorizationManager,
'../Project/ProjectEditorHandler': this.ProjectEditorHandler,
'logger-sharelatex': this.logger,
'./EditorController': this.EditorController,
'@overleaf/metrics': this.Metrics,
'../Collaborators/CollaboratorsGetter': this.CollaboratorsGetter,

View file

@ -12,7 +12,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
const modulePath = require('path').join(
__dirname,
'../../../../app/src/Features/Editor/EditorRealTimeController'
@ -23,9 +22,6 @@ describe('EditorRealTimeController', function() {
this.rclient = { publish: sinon.stub() }
this.Metrics = { summary: sinon.stub() }
this.EditorRealTimeController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../../infrastructure/RedisWrapper': {
client: () => this.rclient

View file

@ -20,18 +20,12 @@ describe('EmailBuilder', function() {
siteUrl: 'https://www.overleaf.com'
}
this.EmailBuilder = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'./EmailMessageHelper': EmailMessageHelper,
'./Bodies/cta-email': ctaEmailBody,
'./Bodies/NoCTAEmailBody': NoCTAEmailBody,
'./Layouts/BaseWithHeaderEmailLayout': BaseWithHeaderEmailLayout,
'settings-sharelatex': this.settings,
'logger-sharelatex': {
log() {}
}
'settings-sharelatex': this.settings
}
})
})

View file

@ -21,16 +21,10 @@ describe('EmailHandler', function() {
}
}
this.EmailHandler = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'./EmailBuilder': this.EmailBuilder,
'./EmailSender': this.EmailSender,
'settings-sharelatex': this.Settings,
'logger-sharelatex': {
log() {}
}
'settings-sharelatex': this.Settings
}
})
})

View file

@ -9,11 +9,7 @@ const MODULE_PATH = path.join(
describe('EmailMessageHelper', function() {
beforeEach(function() {
this.EmailMessageHelper = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
}
})
this.EmailMessageHelper = SandboxedModule.require(MODULE_PATH, {})
})
describe('cleanHTML', function() {
beforeEach(function() {

View file

@ -33,20 +33,12 @@ describe('EmailSender', function() {
this.ses = { createTransport: () => this.sesClient }
this.EmailSender = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
nodemailer: this.ses,
'nodemailer-ses-transport': sinon.stub(),
'nodemailer-mandrill-transport': {},
'settings-sharelatex': this.Settings,
'../../infrastructure/RateLimiter': this.RateLimiter,
'logger-sharelatex': {
log() {},
warn() {},
err() {}
},
'@overleaf/metrics': {
inc() {}
}

View file

@ -1,5 +1,4 @@
const { expect } = require('chai')
const sinon = require('sinon')
const MockResponse = require('../helpers/MockResponse')
const MockRequest = require('../helpers/MockRequest')
const SandboxedModule = require('sandboxed-module')
@ -10,19 +9,12 @@ describe('HttpErrorHandler', function() {
this.req = new MockRequest()
this.res = new MockResponse()
this.logger = {
warn() {},
error() {}
}
this.HttpErrorHandler = SandboxedModule.require(modulePath, {
globals: { console },
requires: {
'settings-sharelatex': {
appName: 'Overleaf',
statusPageUrl: 'https://status.overlaf.com'
},
'logger-sharelatex': this.logger
}
}
})
})
@ -342,7 +334,6 @@ describe('HttpErrorHandler', function() {
it('should send the error to the logger', function() {
const error = new Error('message')
this.logger.error = sinon.stub()
this.HttpErrorHandler.legacyInternal(
this.req,
this.res,

View file

@ -14,8 +14,7 @@
*/
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
const chai = require('chai')
const { expect } = chai
const { expect } = require('chai')
const sinon = require('sinon')
const modulePath = require('path').join(
__dirname,
@ -64,15 +63,8 @@ describe('ExportsController', function() {
getLoggedInUserId: sinon.stub().returns(this.req.session.user._id)
}
return (this.controller = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'./ExportsHandler': this.handler,
'logger-sharelatex': {
log() {},
err() {}
},
'../Authentication/AuthenticationController': this
.AuthenticationController
}

View file

@ -12,9 +12,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const { expect } = chai
const { expect } = require('chai')
const modulePath = '../../../../app/src/Features/Exports/ExportsHandler.js'
const SandboxedModule = require('sandboxed-module')
@ -27,15 +25,7 @@ describe('ExportsHandler', function() {
}
}
this.ExportsHandler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': {
log() {},
warn() {},
err() {}
},
'../Project/ProjectGetter': (this.ProjectGetter = {}),
'../Project/ProjectHistoryHandler': (this.ProjectHistoryHandler = {}),
'../Project/ProjectLocator': (this.ProjectLocator = {}),

View file

@ -14,15 +14,8 @@ describe('FileStoreController', function() {
}
this.ProjectLocator = { findElement: sinon.stub() }
this.controller = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'settings-sharelatex': this.settings,
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
err: sinon.stub()
}),
'../Project/ProjectLocator': this.ProjectLocator,
'./FileStoreHandler': this.FileStoreHandler
}

View file

@ -1,6 +1,5 @@
const { assert } = require('chai')
const { assert, expect } = require('chai')
const sinon = require('sinon')
const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module')
const Errors = require('../../../../app/src/Features/Errors/Errors')
const OError = require('@overleaf/o-error')
@ -54,22 +53,13 @@ describe('FileStoreHandler', function() {
}
}
}
this.logger = {
log: sinon.stub(),
warn: sinon.stub(),
err: sinon.stub()
}
this.FileHashManager = {
computeHash: sinon.stub().callsArgWith(1, null, this.hashValue)
}
this.handler = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'settings-sharelatex': this.settings,
request: this.request,
'logger-sharelatex': this.logger,
'./FileHashManager': this.FileHashManager,
// FIXME: need to stub File object here
'../../models/File': {

View file

@ -1,14 +1,10 @@
const chai = require('chai')
const SandboxedModule = require('sandboxed-module')
const { expect } = chai
const { expect } = require('chai')
const modulePath = '../../../../app/src/Features/Helpers/AuthorizationHelper'
describe('AuthorizationHelper', function() {
beforeEach(function() {
this.AuthorizationHelper = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../../models/User': {
UserSchema: {

View file

@ -1,5 +1,4 @@
const chai = require('chai')
const { expect } = chai
const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module')
const modulePath = require('path').join(
__dirname,

View file

@ -9,8 +9,6 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const chai = require('chai')
chai.should()
const sinon = require('sinon')
const Errors = require('../../../../app/src/Features/Errors/Errors')
@ -26,17 +24,9 @@ describe('HistoryController', function() {
getLoggedInUserId: sinon.stub().returns(this.user_id)
}
this.HistoryController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
request: (this.request = sinon.stub()),
'settings-sharelatex': (this.settings = {}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
warn: sinon.stub(),
error: sinon.stub()
}),
'../Authentication/AuthenticationController': this
.AuthenticationController,
'./HistoryManager': (this.HistoryManager = {}),

View file

@ -44,9 +44,6 @@ describe('HistoryManager', function() {
}
this.HistoryManager = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'request-promise-native': this.request,
'settings-sharelatex': this.settings,

View file

@ -12,7 +12,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
require('chai').should()
const { expect } = require('chai')
const sinon = require('sinon')
const modulePath = require('path').join(
@ -27,19 +26,12 @@ describe('RestoreManager', function() {
beforeEach(function() {
tk.freeze(Date.now()) // freeze the time for these tests
this.RestoreManager = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'settings-sharelatex': {},
'../../infrastructure/FileWriter': (this.FileWriter = {}),
'../Uploads/FileSystemImportManager': (this.FileSystemImportManager = {}),
'../Project/ProjectEntityHandler': (this.ProjectEntityHandler = {}),
'../Editor/EditorController': (this.EditorController = {}),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
err: sinon.stub()
})
'../Editor/EditorController': (this.EditorController = {})
}
})
this.user_id = 'mock-user-id'

View file

@ -11,7 +11,6 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const should = require('chai').should()
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
const path = require('path')
@ -35,23 +34,13 @@ describe('InactiveProjectManager', function() {
markAsInactive: sinon.stub()
}
this.ProjectGetter = { getProject: sinon.stub() }
this.TrackChangesManager = { archiveProject: sinon.stub() }
this.InactiveProjectManager = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
mongodb: { ObjectId },
'settings-sharelatex': this.settings,
'logger-sharelatex': {
log() {},
warn() {},
err() {}
},
'../Docstore/DocstoreManager': this.DocstoreManager,
'../Project/ProjectUpdateHandler': this.ProjectUpdateHandler,
'../Project/ProjectGetter': this.ProjectGetter,
'../TrackChanges/TrackChangesManager': this.TrackChangesManager,
'../../models/Project': {}
}
})
@ -120,7 +109,6 @@ describe('InactiveProjectManager', function() {
describe('deactivateProject', function() {
it('should call unarchiveProject and markAsInactive', function(done) {
this.DocstoreManager.archiveProject.callsArgWith(1)
this.TrackChangesManager.archiveProject.callsArgWith(1)
this.ProjectUpdateHandler.markAsInactive.callsArgWith(1)
@ -130,7 +118,6 @@ describe('InactiveProjectManager', function() {
this.DocstoreManager.archiveProject
.calledWith(this.project_id)
.should.equal(true)
// @TrackChangesManager.archiveProject.calledWith(@project_id).should.equal true
this.ProjectUpdateHandler.markAsInactive
.calledWith(this.project_id)
.should.equal(true)
@ -141,7 +128,6 @@ describe('InactiveProjectManager', function() {
it('should not call markAsInactive if there was a problem archiving in docstore', function(done) {
this.DocstoreManager.archiveProject.callsArgWith(1, 'errorrr')
this.TrackChangesManager.archiveProject.callsArgWith(1)
this.ProjectUpdateHandler.markAsInactive.callsArgWith(1)

View file

@ -10,8 +10,7 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const should = require('chai').should()
let { expect } = require('chai')
const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
const path = require('path')
@ -20,23 +19,17 @@ const modulePath = path.join(
__dirname,
'../../../../app/src/Features/Institutions/InstitutionsAPI'
)
;({ expect } = require('chai'))
const Errors = require('../../../../app/src/Features/Errors/Errors')
describe('InstitutionsAPI', function() {
beforeEach(function() {
this.logger = { warn: sinon.stub(), err: sinon.stub(), log() {} }
this.settings = { apis: { v1: { url: 'v1.url', user: '', pass: '' } } }
this.request = sinon.stub()
this.ipMatcherNotification = {
read: (this.markAsReadIpMatcher = sinon.stub().callsArgWith(1, null))
}
this.InstitutionsAPI = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': this.logger,
'@overleaf/metrics': {
timeAsyncMethod: sinon.stub()
},
@ -44,9 +37,6 @@ describe('InstitutionsAPI', function() {
request: this.request,
'../Notifications/NotificationsBuilder': {
ipMatcherAffiliation: sinon.stub().returns(this.ipMatcherNotification)
},
'../../../../../app/src/Features/V1/V1Api': {
request: sinon.stub()
}
}
})
@ -67,13 +57,13 @@ describe('InstitutionsAPI', function() {
return this.InstitutionsAPI.getInstitutionAffiliations(
this.institutionId,
(err, body) => {
should.not.exist(err)
expect(err).not.to.exist
this.request.calledOnce.should.equal(true)
const requestOptions = this.request.lastCall.args[0]
const expectedUrl = `v1.url/api/v2/institutions/${this.institutionId}/affiliations`
requestOptions.url.should.equal(expectedUrl)
requestOptions.method.should.equal('GET')
should.not.exist(requestOptions.body)
expect(requestOptions.body).not.to.exist
body.should.equal(responseBody)
return done()
}
@ -86,7 +76,7 @@ describe('InstitutionsAPI', function() {
return this.InstitutionsAPI.getInstitutionAffiliations(
this.institutionId,
(err, body) => {
should.not.exist(err)
expect(err).not.to.exist
expect(body).to.be.a('Array')
body.length.should.equal(0)
return done()
@ -111,7 +101,7 @@ describe('InstitutionsAPI', function() {
endDate,
'monthly',
(err, body) => {
should.not.exist(err)
expect(err).not.to.exist
this.request.calledOnce.should.equal(true)
const requestOptions = this.request.lastCall.args[0]
const expectedUrl = `v1.url/api/v2/institutions/${this.institutionId}/institution_licences`
@ -134,13 +124,13 @@ describe('InstitutionsAPI', function() {
return this.InstitutionsAPI.getUserAffiliations(
this.stubbedUser._id,
(err, body) => {
should.not.exist(err)
expect(err).not.to.exist
this.request.calledOnce.should.equal(true)
const requestOptions = this.request.lastCall.args[0]
const expectedUrl = `v1.url/api/v2/users/${this.stubbedUser._id}/affiliations`
requestOptions.url.should.equal(expectedUrl)
requestOptions.method.should.equal('GET')
should.not.exist(requestOptions.body)
expect(requestOptions.body).not.to.exist
body.should.equal(responseBody)
return done()
}
@ -164,7 +154,7 @@ describe('InstitutionsAPI', function() {
return this.InstitutionsAPI.getUserAffiliations(
this.stubbedUser._id,
(err, body) => {
should.not.exist(err)
expect(err).not.to.exist
expect(body).to.be.a('Array')
body.length.should.equal(0)
return done()
@ -191,7 +181,7 @@ describe('InstitutionsAPI', function() {
this.newEmail,
affiliationOptions,
err => {
should.not.exist(err)
expect(err).not.to.exist
this.request.calledOnce.should.equal(true)
const requestOptions = this.request.lastCall.args[0]
const expectedUrl = `v1.url/api/v2/users/${this.stubbedUser._id}/affiliations`
@ -220,7 +210,7 @@ describe('InstitutionsAPI', function() {
this.newEmail,
{},
err => {
should.exist(err)
expect(err).to.exist
err.message.should.have.string(422)
err.message.should.have.string(body.errors)
return done()
@ -239,7 +229,7 @@ describe('InstitutionsAPI', function() {
this.stubbedUser._id,
this.newEmail,
err => {
should.not.exist(err)
expect(err).not.to.exist
this.request.calledOnce.should.equal(true)
const requestOptions = this.request.lastCall.args[0]
const expectedUrl = `v1.url/api/v2/users/${this.stubbedUser._id}/affiliations/remove`
@ -257,7 +247,7 @@ describe('InstitutionsAPI', function() {
this.stubbedUser._id,
this.newEmail,
err => {
should.exist(err)
expect(err).to.exist
err.message.should.exist
return done()
}
@ -271,7 +261,7 @@ describe('InstitutionsAPI', function() {
return this.InstitutionsAPI.deleteAffiliations(
this.stubbedUser._id,
err => {
should.not.exist(err)
expect(err).not.to.exist
this.request.calledOnce.should.equal(true)
const requestOptions = this.request.lastCall.args[0]
const expectedUrl = `v1.url/api/v2/users/${this.stubbedUser._id}/affiliations`
@ -307,7 +297,7 @@ describe('InstitutionsAPI', function() {
'Student',
'Physics',
err => {
should.not.exist(err)
expect(err).not.to.exist
this.request.calledOnce.should.equal(true)
const requestOptions = this.request.lastCall.args[0]
const expectedUrl = `v1.url/api/v2/users/${this.stubbedUser._id}/affiliations/endorse`

View file

@ -10,20 +10,18 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const should = require('chai').should()
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
const { expect } = require('chai')
const path = require('path')
const sinon = require('sinon')
const modulePath = path.join(
__dirname,
'../../../../app/src/Features/Institutions/InstitutionsController'
)
const { expect } = require('chai')
describe('InstitutionsController', function() {
beforeEach(function() {
this.logger = { err: sinon.stub(), warn: sinon.stub(), log() {} }
this.host = 'mit.edu'
.split('')
.reverse()
@ -81,11 +79,7 @@ describe('InstitutionsController', function() {
.withArgs(this.stubbedUser2._id)
.yields(null, this.stubbedUser2DecoratedEmails)
this.InstitutionsController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': this.logger,
'../User/UserGetter': {
getUsersByHostname: this.getUsersByHostname,
getUserFullEmails: this.getUserFullEmails

View file

@ -12,7 +12,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
require('chai').should()
const { expect } = require('chai')
const sinon = require('sinon')
const modulePath = require('path').join(
@ -26,18 +25,11 @@ describe('InstitutionsFeatures', function() {
this.PlansLocator = { findLocalPlanInSettings: sinon.stub() }
this.institutionPlanCode = 'institution_plan_code'
this.InstitutionsFeatures = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../User/UserGetter': this.UserGetter,
'../Subscription/PlansLocator': this.PlansLocator,
'settings-sharelatex': {
institutionPlanCode: this.institutionPlanCode
},
'logger-sharelatex': {
log() {},
err() {}
}
}
})

View file

@ -10,7 +10,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const SandboxedModule = require('sandboxed-module')
require('chai').should()
const { expect } = require('chai')
const sinon = require('sinon')
const modulePath = require('path').join(
@ -22,17 +21,10 @@ describe('InstitutionsGetter', function() {
beforeEach(function() {
this.UserGetter = { getUserFullEmails: sinon.stub() }
this.InstitutionsGetter = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../User/UserGetter': this.UserGetter,
'../UserMembership/UserMembershipsHandler': (this.UserMembershipsHandler = {}),
'../UserMembership/UserMembershipEntityConfigs': (this.UserMembershipEntityConfigs = {}),
'logger-sharelatex': {
log() {},
err() {}
}
'../UserMembership/UserMembershipEntityConfigs': (this.UserMembershipEntityConfigs = {})
}
})

View file

@ -1,17 +1,15 @@
const should = require('chai').should()
const SandboxedModule = require('sandboxed-module')
const path = require('path')
const sinon = require('sinon')
const { expect } = require('chai')
const modulePath = path.join(
__dirname,
'../../../../app/src/Features/Institutions/InstitutionsManager'
)
const { expect } = require('chai')
describe('InstitutionsManager', function() {
beforeEach(function() {
this.institutionId = 123
this.logger = { log() {} }
this.user = {}
this.getInstitutionAffiliations = sinon.stub()
this.refreshFeatures = sinon.stub().yields()
@ -54,11 +52,7 @@ describe('InstitutionsManager', function() {
this.Mongo = { ObjectId: sinon.stub().returnsArg(0) }
this.InstitutionsManager = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': this.logger,
'./InstitutionsAPI': {
getInstitutionAffiliations: this.getInstitutionAffiliations
},
@ -105,7 +99,7 @@ describe('InstitutionsManager', function() {
this.institutionId,
false,
error => {
should.not.exist(error)
expect(error).not.to.exist
sinon.assert.calledTwice(this.refreshFeatures)
// expect no notifications
@ -125,7 +119,7 @@ describe('InstitutionsManager', function() {
this.institutionId,
true,
error => {
should.not.exist(error)
expect(error).not.to.exist
sinon.assert.calledOnce(
this.NotificationsBuilder.featuresUpgradedByAffiliation
)
@ -144,7 +138,7 @@ describe('InstitutionsManager', function() {
this.institutionId,
true,
error => {
should.not.exist(error)
expect(error).not.to.exist
sinon.assert.calledOnce(
this.NotificationsBuilder.redundantPersonalSubscription
)
@ -184,7 +178,7 @@ describe('InstitutionsManager', function() {
this.InstitutionsManager.checkInstitutionUsers(
this.institutionId,
(error, usersSummary) => {
should.not.exist(error)
expect(error).not.to.exist
usersSummary.confirmedEmailUsers.total.should.equal(3)
usersSummary.confirmedEmailUsers.totalProUsers.should.equal(1)
@ -217,7 +211,7 @@ describe('InstitutionsManager', function() {
this.InstitutionsManager.getInstitutionUsersSubscriptions(
this.institutionId,
(error, subscriptions) => {
should.not.exist(error)
expect(error).not.to.exist
sinon.assert.calledOnce(this.subscriptionExec)
done()
}

View file

@ -9,9 +9,7 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const chai = require('chai')
chai.should()
const { expect } = chai
const { expect } = require('chai')
const sinon = require('sinon')
const modulePath = '../../../../app/src/Features/Metadata/MetaController'
const SandboxedModule = require('sandboxed-module')
@ -27,15 +25,7 @@ describe('MetaController', function() {
getMetaForDoc: sinon.stub()
}
return (this.MetadataController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': {
log: sinon.stub(),
warn: sinon.stub(),
err: sinon.stub()
},
'../Editor/EditorRealTimeController': this.EditorRealTimeController,
'./MetaHandler': this.MetaHandler
}

View file

@ -10,9 +10,7 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const chai = require('chai')
chai.should()
const { expect } = chai
const { expect } = require('chai')
const sinon = require('sinon')
const modulePath = '../../../../app/src/Features/Metadata/MetaHandler'
const SandboxedModule = require('sandboxed-module')
@ -54,9 +52,6 @@ describe('MetaHandler', function() {
}
return (this.MetaHandler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../Project/ProjectEntityHandler': this.ProjectEntityHandler,
'../DocumentUpdater/DocumentUpdaterHandler': this

View file

@ -27,11 +27,9 @@ describe('NewsletterManager', function() {
this.NewsletterManager = SandboxedModule.require(MODULE_PATH, {
requires: {
'logger-sharelatex': { info: sinon.stub() },
'mailchimp-api-v3': this.Mailchimp,
'settings-sharelatex': this.Settings
},
globals: { console: console }
}
}).promises
this.user = {

View file

@ -1,5 +1,4 @@
const SandboxedModule = require('sandboxed-module')
require('chai').should()
const sinon = require('sinon')
const modulePath = require('path').join(
__dirname,
@ -15,17 +14,10 @@ describe('NotificationsBuilder', function() {
this.settings = { apis: { v1: { url: 'v1.url', user: '', pass: '' } } }
this.request = sinon.stub()
this.controller = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'./NotificationsHandler': this.handler,
'settings-sharelatex': this.settings,
request: this.request,
'logger-sharelatex': {
log() {},
err() {}
}
request: this.request
}
})
})

View file

@ -13,7 +13,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
require('chai').should()
const sinon = require('sinon')
const modulePath = require('path').join(
__dirname,
@ -46,15 +45,8 @@ describe('NotificationsController', function() {
getLoggedInUserId: sinon.stub().returns(this.req.session.user._id)
}
return (this.controller = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'./NotificationsHandler': this.handler,
'logger-sharelatex': {
log() {},
err() {}
},
'../Authentication/AuthenticationController': this
.AuthenticationController
}

View file

@ -14,7 +14,6 @@
*/
const SandboxedModule = require('sandboxed-module')
const { assert } = require('chai')
require('chai').should()
const sinon = require('sinon')
const modulePath = require('path').join(
__dirname,
@ -30,18 +29,11 @@ describe('NotificationsHandler', function() {
beforeEach(function() {
this.request = sinon.stub().callsArgWith(1)
return (this.handler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'settings-sharelatex': {
apis: { notifications: { url: notificationUrl } }
},
request: this.request,
'logger-sharelatex': {
log() {},
err() {}
}
request: this.request
}
}))
})

View file

@ -50,18 +50,9 @@ describe('PasswordResetController', function() {
}
}
this.PasswordResetController = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'settings-sharelatex': this.settings,
'./PasswordResetHandler': this.PasswordResetHandler,
'logger-sharelatex': {
log() {},
warn() {},
err: sinon.stub(),
error() {}
},
'../../infrastructure/RateLimiter': this.RateLimiter,
'../Authentication/AuthenticationController': (this.AuthenticationController = {
getLoggedInUserId: sinon.stub(),

View file

@ -15,15 +15,11 @@ const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
const path = require('path')
const sinon = require('sinon')
const sinonChai = require('sinon-chai')
const chai = require('chai')
const { expect } = require('chai')
const modulePath = path.join(
__dirname,
'../../../../app/src/Features/PasswordReset/PasswordResetHandler'
)
const should = require('chai').should()
chai.use(sinonChai)
const { expect } = chai
describe('PasswordResetHandler', function() {
beforeEach(function() {
@ -45,7 +41,6 @@ describe('PasswordResetHandler', function() {
}
}
this.PasswordResetHandler = SandboxedModule.require(modulePath, {
globals: { console: console },
requires: {
'../User/UserAuditLogHandler': (this.UserAuditLogHandler = {
promises: {
@ -56,11 +51,7 @@ describe('PasswordResetHandler', function() {
'../Security/OneTimeTokenHandler': this.OneTimeTokenHandler,
'../Email/EmailHandler': this.EmailHandler,
'../Authentication/AuthenticationManager': this.AuthenticationManager,
'settings-sharelatex': this.settings,
'logger-sharelatex': {
log() {},
err() {}
}
'settings-sharelatex': this.settings
}
})
this.token = '12312321i'

View file

@ -12,21 +12,12 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const sinon = require('sinon')
const chai = require('chai')
const should = chai.should()
const modulePath = '../../../../app/src/Features/Project/DocLinesComparitor.js'
const SandboxedModule = require('sandboxed-module')
describe('doc lines comparitor', function() {
beforeEach(function() {
return (this.comparitor = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': { log() {} }
}
}))
return (this.comparitor = SandboxedModule.require(modulePath, {}))
})
it('should return true when the lines are the same', function() {

View file

@ -10,24 +10,16 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const should = require('chai').should()
const modulePath = '../../../../app/src/Features/Project/ProjectApiController'
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
require('chai').should()
describe('Project api controller', function() {
beforeEach(function() {
this.ProjectDetailsHandler = { getDetails: sinon.stub() }
this.controller = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'./ProjectDetailsHandler': this.ProjectDetailsHandler,
'logger-sharelatex': {
log() {}
}
'./ProjectDetailsHandler': this.ProjectDetailsHandler
}
})
this.project_id = '321l3j1kjkjl'

View file

@ -15,11 +15,9 @@ const { ObjectId } = require('mongodb')
const Path = require('path')
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
const chai = require('chai')
const { expect } = require('chai')
const sinon = require('sinon')
const { expect } = chai
const modulePath = Path.join(
__dirname,
'../../../../app/src/Features/Project/ProjectCollabratecDetailsHandler'
@ -34,9 +32,6 @@ describe('ProjectCollabratecDetailsHandler', function() {
this.ProjectCollabratecDetailsHandler = SandboxedModule.require(
modulePath,
{
globals: {
console: console
},
requires: {
mongodb: { ObjectId },
'../../models/Project': { Project: this.ProjectModel }

View file

@ -66,7 +66,6 @@ describe('ProjectController', function() {
this.EditorController = { renameProject: sinon.stub() }
this.InactiveProjectManager = { reactivateProjectIfRequired: sinon.stub() }
this.ProjectUpdateHandler = { markAsOpened: sinon.stub() }
this.ReferencesSearchHandler = { indexProjectReferences: sinon.stub() }
this.ProjectGetter = {
findAllUsersProjects: sinon.stub(),
getProject: sinon.stub()
@ -127,16 +126,9 @@ describe('ProjectController', function() {
}
this.ProjectController = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
mongodb: { ObjectId },
'settings-sharelatex': this.settings,
'logger-sharelatex': {
log() {},
err() {}
},
'@overleaf/metrics': this.Metrics,
'./ProjectDeleter': this.ProjectDeleter,
'./ProjectDuplicator': this.ProjectDuplicator,
@ -152,8 +144,6 @@ describe('ProjectController', function() {
'../Authorization/AuthorizationManager': this.AuthorizationManager,
'../InactiveData/InactiveProjectManager': this.InactiveProjectManager,
'./ProjectUpdateHandler': this.ProjectUpdateHandler,
'../ReferencesSearch/ReferencesSearchHandler': this
.ReferencesSearchHandler,
'./ProjectGetter': this.ProjectGetter,
'./ProjectDetailsHandler': this.ProjectDetailsHandler,
'../Authentication/AuthenticationController': this

View file

@ -61,9 +61,6 @@ describe('ProjectCreationHandler', function() {
this.AnalyticsManager = { recordEvent: sinon.stub() }
this.handler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
mongodb: { ObjectId },
'../../models/User': {
@ -76,7 +73,6 @@ describe('ProjectCreationHandler', function() {
'./ProjectDetailsHandler': this.ProjectDetailsHandler,
'settings-sharelatex': this.Settings,
'../Analytics/AnalyticsManager': this.AnalyticsManager,
'logger-sharelatex': { log() {} },
'@overleaf/metrics': {
inc() {},
timeAsyncMethod() {}

View file

@ -1,8 +1,7 @@
const modulePath = '../../../../app/src/Features/Project/ProjectDeleter'
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
const chai = require('chai')
const { expect } = chai
const { expect } = require('chai')
const tk = require('timekeeper')
const moment = require('moment')
const { Project } = require('../helpers/models/Project')
@ -93,12 +92,6 @@ describe('ProjectDeleter', function() {
}
}
this.logger = {
err: sinon.stub(),
log: sinon.stub(),
warn: sinon.stub()
}
this.ProjectDetailsHandler = {
promises: {
generateUniqueName: sinon.stub().resolves(this.project.name)
@ -150,11 +143,7 @@ describe('ProjectDeleter', function() {
'../Docstore/DocstoreManager': this.DocstoreManager,
'./ProjectDetailsHandler': this.ProjectDetailsHandler,
'../../infrastructure/mongodb': { db: this.db, ObjectId },
'../History/HistoryManager': this.HistoryManager,
'logger-sharelatex': this.logger
},
globals: {
console: console
'../History/HistoryManager': this.HistoryManager
}
})
})

View file

@ -66,9 +66,6 @@ describe('ProjectDetailsHandler', function() {
defaultFeatures: 'default-features'
}
this.handler = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'./ProjectHelper': ProjectHelper,
'./ProjectGetter': this.ProjectGetter,
@ -77,11 +74,6 @@ describe('ProjectDetailsHandler', function() {
},
'../User/UserGetter': this.UserGetter,
'../ThirdPartyDataStore/TpdsUpdateSender': this.TpdsUpdateSender,
'logger-sharelatex': {
log() {},
warn() {},
err() {}
},
'../TokenGenerator/TokenGenerator': this.TokenGenerator,
'settings-sharelatex': this.settings
}

View file

@ -200,9 +200,6 @@ describe('ProjectDuplicator', function() {
}
this.ProjectDuplicator = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'../../models/Doc': { Doc: this.Doc },
'../../models/File': { File: this.File },
@ -218,12 +215,7 @@ describe('ProjectDuplicator', function() {
'./ProjectGetter': this.ProjectGetter,
'./ProjectLocator': this.ProjectLocator,
'./ProjectOptionsHandler': this.ProjectOptionsHandler,
'../ThirdPartyDataStore/TpdsProjectFlusher': this.TpdsProjectFlusher,
'logger-sharelatex': {
log() {},
warn() {},
err() {}
}
'../ThirdPartyDataStore/TpdsProjectFlusher': this.TpdsProjectFlusher
}
})
})

View file

@ -10,9 +10,7 @@
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const chai = require('chai')
const { expect } = chai
const should = chai.should()
const { expect } = require('chai')
const modulePath = '../../../../app/src/Features/Project/ProjectEditorHandler'
const SandboxedModule = require('sandboxed-module')
@ -122,27 +120,27 @@ describe('ProjectEditorHandler', function() {
})
it('should include the id', function() {
should.exist(this.result._id)
expect(this.result._id).to.exist
return this.result._id.should.equal('project-id')
})
it('should include the name', function() {
should.exist(this.result.name)
expect(this.result.name).to.exist
return this.result.name.should.equal('Project Name')
})
it('should include the root doc id', function() {
should.exist(this.result.rootDoc_id)
expect(this.result.rootDoc_id).to.exist
return this.result.rootDoc_id.should.equal('file-id')
})
it('should include the public access level', function() {
should.exist(this.result.publicAccesLevel)
expect(this.result.publicAccesLevel).to.exist
return this.result.publicAccesLevel.should.equal('private')
})
it('should include the owner', function() {
should.exist(this.result.owner)
expect(this.result.owner).to.exist
this.result.owner._id.should.equal('owner-id')
this.result.owner.email.should.equal('owner@sharelatex.com')
this.result.owner.first_name.should.equal('Owner')
@ -151,7 +149,7 @@ describe('ProjectEditorHandler', function() {
})
it('should include the deletedDocs', function() {
should.exist(this.result.deletedDocs)
expect(this.result.deletedDocs).to.exist
this.result.deletedDocs.should.deep.equal([
{
// omit deletedAt field
@ -162,8 +160,8 @@ describe('ProjectEditorHandler', function() {
})
it('invites should not include the token', function() {
should.not.exist(this.result.invites[0].token)
should.not.exist(this.result.invites[1].token)
expect(this.result.invites[0].token).not.to.exist
expect(this.result.invites[1].token).not.to.exist
})
it('should gather readOnly_refs and collaberators_refs into a list of members', function() {
@ -178,7 +176,7 @@ describe('ProjectEditorHandler', function() {
this.result.members.length.should.equal(2)
should.exist(findMember('read-only-id'))
expect(findMember('read-only-id')).to.exist
findMember('read-only-id').privileges.should.equal('readOnly')
findMember('read-only-id').first_name.should.equal('Read')
findMember('read-only-id').last_name.should.equal('Only')
@ -186,7 +184,7 @@ describe('ProjectEditorHandler', function() {
'read-only@sharelatex.com'
)
should.exist(findMember('read-write-id'))
expect(findMember('read-write-id')).to.exist
findMember('read-write-id').privileges.should.equal('readAndWrite')
findMember('read-write-id').first_name.should.equal('Read')
findMember('read-write-id').last_name.should.equal('Write')
@ -218,9 +216,8 @@ describe('ProjectEditorHandler', function() {
this.result.rootFolder[0].folders[0].fileRefs[0].created.should.equal(
this.created
)
return should.not.exist(
this.result.rootFolder[0].folders[0].fileRefs[0].size
)
return expect(this.result.rootFolder[0].folders[0].fileRefs[0].size).not
.to.exist
})
it('should include docs in the project but not the lines', function() {
@ -228,13 +225,12 @@ describe('ProjectEditorHandler', function() {
this.result.rootFolder[0].folders[0].docs[0].name.should.equal(
'main.tex'
)
return should.not.exist(
this.result.rootFolder[0].folders[0].docs[0].lines
)
return expect(this.result.rootFolder[0].folders[0].docs[0].lines).not.to
.exist
})
it('should include invites', function() {
should.exist(this.result.invites)
expect(this.result.invites).to.exist
return this.result.invites.should.deep.equal(this.invites)
})
})

View file

@ -13,10 +13,7 @@
* DS206: Consider reworking classes to avoid initClass
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const chai = require('chai')
const { assert } = require('chai')
const should = chai.should()
const { expect } = chai
const { assert, expect } = require('chai')
const sinon = require('sinon')
const modulePath = '../../../../app/src/Features/Project/ProjectEntityHandler'
const SandboxedModule = require('sandboxed-module')
@ -60,15 +57,7 @@ describe('ProjectEntityHandler', function() {
this.callback = sinon.stub()
return (this.ProjectEntityHandler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub(),
err() {}
}),
'../Docstore/DocstoreManager': (this.DocstoreManager = {}),
'../../Features/DocumentUpdater/DocumentUpdaterHandler': this
.DocumentUpdaterHandler,

View file

@ -62,12 +62,6 @@ describe('ProjectEntityMongoUpdateHandler', function() {
rootFolder: [this.rootFolder]
}
this.logger = {
log: sinon.stub(),
warn: sinon.stub(),
error: sinon.stub(),
err() {}
}
this.Settings = { maxEntitiesPerProject: 100 }
this.CooldownManager = {}
this.LockManager = {
@ -184,12 +178,8 @@ describe('ProjectEntityMongoUpdateHandler', function() {
}
this.subject = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
mongodb: { ObjectId },
'logger-sharelatex': this.logger,
'settings-sharelatex': this.Settings,
'../Cooldown/CooldownManager': this.CooldownManager,
'../../models/Folder': { Folder: this.FolderModel },

View file

@ -1,5 +1,4 @@
const chai = require('chai')
const { expect } = chai
const { expect } = require('chai')
const sinon = require('sinon')
const Errors = require('../../../../app/src/Features/Errors/Errors')
const SandboxedModule = require('sandboxed-module')
@ -82,13 +81,6 @@ describe('ProjectEntityUpdateHandler', function() {
resyncProjectHistory: sinon.stub(),
deleteDoc: sinon.stub().yields()
}
this.logger = {
info: sinon.stub(),
log: sinon.stub(),
warn: sinon.stub(),
error: sinon.stub(),
err() {}
}
this.fs = {
unlink: sinon.stub().yields()
}
@ -152,12 +144,8 @@ describe('ProjectEntityUpdateHandler', function() {
emitToRoom: sinon.stub()
}
this.ProjectEntityUpdateHandler = SandboxedModule.require(MODULE_PATH, {
globals: {
console: console
},
requires: {
'settings-sharelatex': { validRootDocExtensions: ['tex'] },
'logger-sharelatex': this.logger,
fs: this.fs,
'../../models/Doc': { Doc: this.DocModel },
'../Docstore/DocstoreManager': this.DocstoreManager,

View file

@ -1,6 +1,5 @@
const sinon = require('sinon')
const chai = require('chai')
const { expect } = chai
const { expect } = require('chai')
const modulePath = '../../../../app/src/Features/Project/ProjectGetter.js'
const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb')
@ -43,7 +42,6 @@ describe('ProjectGetter', function() {
lockKey: sinon.stub().returnsArg(0)
}
this.ProjectGetter = SandboxedModule.require(modulePath, {
globals: { console },
requires: {
'../../infrastructure/mongodb': { db: this.db, ObjectId },
'@overleaf/metrics': {
@ -58,11 +56,7 @@ describe('ProjectGetter', function() {
'../Collaborators/CollaboratorsGetter': this.CollaboratorsGetter,
'../../infrastructure/LockManager': this.LockManager,
'./ProjectEntityMongoUpdateHandler': this
.ProjectEntityMongoUpdateHandler,
'logger-sharelatex': {
err() {},
log() {}
}
.ProjectEntityMongoUpdateHandler
}
})
})

View file

@ -1,5 +1,4 @@
const chai = require('chai')
const { expect } = chai
const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb')

View file

@ -12,10 +12,7 @@
* DS206: Consider reworking classes to avoid initClass
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const chai = require('chai')
const { assert } = require('chai')
const should = chai.should()
const { expect } = chai
const { assert, expect } = require('chai')
const sinon = require('sinon')
const modulePath = '../../../../app/src/Features/Project/ProjectHistoryHandler'
const SandboxedModule = require('sandboxed-module')
@ -46,15 +43,7 @@ describe('ProjectHistoryHandler', function() {
this.callback = sinon.stub()
return (this.ProjectHistoryHandler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
error: sinon.stub(),
err() {}
}),
'settings-sharelatex': (this.Settings = {}),
'../../models/Project': {
Project: this.ProjectModel

Some files were not shown because too many files have changed in this diff Show more