Merge pull request #66 from overleaf/jpa-bump-dev-env-3-3-2

[misc] bump the dev-env to 3.3.2
This commit is contained in:
Christopher Hoskin 2020-08-13 17:08:21 +01:00 committed by GitHub
commit 6177cf7e51
30 changed files with 496 additions and 461 deletions

View file

@ -8,7 +8,7 @@
"prettier/standard"
],
"parserOptions": {
"ecmaVersion": 2017
"ecmaVersion": 2018
},
"plugins": [
"mocha",

View file

@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
pull-request-branch-name:
# Separate sections of the branch name with a hyphen
# Docker images use the branch name and do not support slashes in tags
# https://github.com/overleaf/google-ops/issues/822
# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#pull-request-branch-nameseparator
separator: "-"
# Block informal upgrades -- security upgrades use a separate queue.
# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#open-pull-requests-limit
open-pull-requests-limit: 0

View file

@ -3,3 +3,6 @@
node_modules/*
cache/spell.cache
**/*.map
# managed by dev-environment$ bin/update_build_scripts
.npmrc

View file

@ -17,8 +17,6 @@ RUN npm ci --quiet
COPY . /app
FROM base
COPY --from=app /app /app

View file

@ -1,131 +0,0 @@
String cron_string = BRANCH_NAME == "master" ? "@daily" : ""
pipeline {
agent any
environment {
GIT_PROJECT = "spelling"
JENKINS_WORKFLOW = "spelling-sharelatex"
TARGET_URL = "${env.JENKINS_URL}blue/organizations/jenkins/${JENKINS_WORKFLOW}/detail/$BRANCH_NAME/$BUILD_NUMBER/pipeline"
GIT_API_URL = "https://api.github.com/repos/overleaf/${GIT_PROJECT}/statuses/$GIT_COMMIT"
}
triggers {
pollSCM('* * * * *')
cron(cron_string)
}
stages {
stage('Install') {
steps {
withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
sh "curl $GIT_API_URL \
--data '{ \
\"state\" : \"pending\", \
\"target_url\": \"$TARGET_URL\", \
\"description\": \"Your build is underway\", \
\"context\": \"ci/jenkins\" }' \
-u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
}
}
}
stage('Build') {
steps {
sh 'make build'
}
}
stage('Linting') {
steps {
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make format'
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make lint'
}
}
stage('Unit Tests') {
steps {
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_unit'
}
}
stage('Acceptance Tests') {
steps {
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_acceptance'
}
}
stage('Package and docker push') {
steps {
sh 'echo ${BUILD_NUMBER} > build_number.txt'
sh 'touch build.tar.gz' // Avoid tar warning about files changing during read
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make tar'
withCredentials([file(credentialsId: 'gcr.io_overleaf-ops', variable: 'DOCKER_REPO_KEY_PATH')]) {
sh 'docker login -u _json_key --password-stdin https://gcr.io/overleaf-ops < ${DOCKER_REPO_KEY_PATH}'
}
sh 'DOCKER_REPO=gcr.io/overleaf-ops make publish'
sh 'docker logout https://gcr.io/overleaf-ops'
}
}
stage('Publish to s3') {
steps {
sh 'echo ${BRANCH_NAME}-${BUILD_NUMBER} > build_number.txt'
withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") {
s3Upload(file:'build.tar.gz', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/${BUILD_NUMBER}.tar.gz")
}
withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") {
// The deployment process uses this file to figure out the latest build
s3Upload(file:'build_number.txt', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/latest")
}
}
}
}
post {
always {
sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_clean'
sh 'make clean'
}
success {
withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
sh "curl $GIT_API_URL \
--data '{ \
\"state\" : \"success\", \
\"target_url\": \"$TARGET_URL\", \
\"description\": \"Your build succeeded!\", \
\"context\": \"ci/jenkins\" }' \
-u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
}
}
failure {
mail(from: "${EMAIL_ALERT_FROM}",
to: "${EMAIL_ALERT_TO}",
subject: "Jenkins build failed: ${JOB_NAME}:${BUILD_NUMBER}",
body: "Build: ${BUILD_URL}")
withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
sh "curl $GIT_API_URL \
--data '{ \
\"state\" : \"failure\", \
\"target_url\": \"$TARGET_URL\", \
\"description\": \"Your build failed\", \
\"context\": \"ci/jenkins\" }' \
-u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
}
}
}
// The options directive is for configuration that applies to the whole job.
options {
// we'd like to make sure remove old builds, so we don't fill up our storage!
buildDiscarder(logRotator(numToKeepStr:'50'))
// And we'd really like to be sure that this build doesn't hang forever, so let's time it out after:
timeout(time: 30, unit: 'MINUTES')
}
}

View file

@ -25,13 +25,13 @@ clean:
docker rmi gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
format:
$(DOCKER_COMPOSE) run --rm test_unit npm run format
$(DOCKER_COMPOSE) run --rm test_unit npm run --silent format
format_fix:
$(DOCKER_COMPOSE) run --rm test_unit npm run format:fix
$(DOCKER_COMPOSE) run --rm test_unit npm run --silent format:fix
lint:
$(DOCKER_COMPOSE) run --rm test_unit npm run lint
$(DOCKER_COMPOSE) run --rm test_unit npm run --silent lint
test: format lint test_unit test_acceptance

View file

@ -44,7 +44,7 @@ const port = settings && settings.port ? settings.port : 3005
if (!module.parent) {
// application entry point, called directly
app.listen(port, host, function(error) {
app.listen(port, host, function (error) {
if (error != null) {
throw error
}

View file

@ -34,14 +34,14 @@ try {
}
// write the cache every 30 minutes
const cacheDump = setInterval(function() {
const cacheDump = setInterval(function () {
const dump = JSON.stringify(cache.dump())
return fs.writeFile(cacheFsPathTmp, dump, function(err) {
return fs.writeFile(cacheFsPathTmp, dump, function (err) {
if (err != null) {
logger.log(OError.tag(err, 'error writing cache file'))
fs.unlink(cacheFsPathTmp, () => {})
} else {
fs.rename(cacheFsPathTmp, cacheFsPath, err => {
fs.rename(cacheFsPathTmp, cacheFsPath, (err) => {
if (err) {
logger.error(OError.tag(err, 'error renaming cache file'))
} else {

View file

@ -65,7 +65,7 @@ class ASpellWorker {
this.callback = null
}
})
this.pipe.on('error', err => {
this.pipe.on('error', (err) => {
const previousWorkerState = this.state
if (this.state !== 'killed') {
this.state = 'error'
@ -87,7 +87,7 @@ class ASpellWorker {
logger.warn(err)
}
})
this.pipe.stdin.on('error', err => {
this.pipe.stdin.on('error', (err) => {
const previousWorkerState = this.state
if (this.state !== 'killed') {
this.state = 'error'
@ -114,7 +114,7 @@ class ASpellWorker {
this.pipe.stdout.setEncoding('utf8') // ensure utf8 output is handled correctly
var output = ''
const endMarkerRegex = new RegExp('^[a-z][a-z]', 'gm')
this.pipe.stdout.on('data', data => {
this.pipe.stdout.on('data', (data) => {
// We receive the language code from Aspell as the end of data marker in
// the data. The input is a utf8 encoded string.
const oldPos = output.length
@ -144,7 +144,7 @@ class ASpellWorker {
})
var error = ''
this.pipe.stderr.on('data', chunk => {
this.pipe.stderr.on('data', (chunk) => {
return (error = error + chunk)
})

View file

@ -56,7 +56,9 @@ class ASpellWorkerPool {
}
cleanup() {
const active = this.PROCESS_POOL.filter(worker => worker.state !== 'killed')
const active = this.PROCESS_POOL.filter(
(worker) => worker.state !== 'killed'
)
this.PROCESS_POOL = active
return metrics.gauge('aspellWorkerPool-size', this.PROCESS_POOL.length)
}
@ -66,7 +68,7 @@ class ASpellWorkerPool {
let worker
const availableWorker = _.find(
this.PROCESS_POOL,
cached => cached.language === language && cached.isReady()
(cached) => cached.language === language && cached.isReady()
)
if (availableWorker == null) {
worker = this.create(language)
@ -103,7 +105,7 @@ class ASpellWorkerPool {
return worker.shutdown(`reached limit of ${this.MAX_REQUESTS} requests`)
} else {
// queue a shutdown if worker is idle
return (worker.idleTimer = setTimeout(function() {
return (worker.idleTimer = setTimeout(function () {
worker.shutdown('idle worker')
return (worker.idleTimer = null)
}, this.MAX_IDLE_TIME))

View file

@ -13,7 +13,7 @@ module.exports = {
},
timeout: 1000 * 20
}
return request.post(opts, function(err, response, body) {
return request.post(opts, function (err, response, body) {
if (err != null) {
return res.sendStatus(500)
}

View file

@ -54,7 +54,7 @@ const LearnedWordsManager = {
metrics.inc('mongoCache', 0.1, { status: 'miss' })
logger.info({ userToken }, 'mongoCache miss')
db.spellingPreferences.findOne({ token: userToken }, function(
db.spellingPreferences.findOne({ token: userToken }, function (
error,
preferences
) {
@ -94,7 +94,7 @@ const promises = {
LearnedWordsManager.promises = promises
module.exports = LearnedWordsManager
;['learnWord', 'unlearnWord', 'getLearnedWords'].map(method =>
;['learnWord', 'unlearnWord', 'getLearnedWords'].map((method) =>
metrics.timeAsyncMethod(
LearnedWordsManager,
method,

View file

@ -21,7 +21,7 @@ module.exports = {
metrics.inc('spelling-check', 0.1)
const { token, wordCount } = extractCheckRequestData(req)
logger.info({ token, wordCount }, 'running check')
SpellingAPIManager.runRequest(token, req.body, function(error, result) {
SpellingAPIManager.runRequest(token, req.body, function (error, result) {
if (error != null) {
logger.error(
OError.tag(error, 'error processing spelling request', {
@ -39,7 +39,7 @@ module.exports = {
metrics.inc('spelling-learn', 0.1)
const { token, word } = extractLearnRequestData(req)
logger.info({ token, word }, 'learning word')
SpellingAPIManager.learnWord(token, req.body, function(error) {
SpellingAPIManager.learnWord(token, req.body, function (error) {
if (error != null) {
return next(OError.tag(error))
}
@ -51,7 +51,7 @@ module.exports = {
metrics.inc('spelling-unlearn', 0.1)
const { token, word } = extractLearnRequestData(req)
logger.info({ token, word }, 'unlearning word')
SpellingAPIManager.unlearnWord(token, req.body, function(error) {
SpellingAPIManager.unlearnWord(token, req.body, function (error) {
if (error != null) {
return next(OError.tag(error))
}
@ -62,7 +62,7 @@ module.exports = {
deleteDic(req, res, next) {
const { token, word } = extractLearnRequestData(req)
logger.log({ token, word }, 'deleting user dictionary')
SpellingAPIManager.deleteDic(token, function(error) {
SpellingAPIManager.deleteDic(token, function (error) {
if (error != null) {
return next(OError.tag(error))
}
@ -78,7 +78,7 @@ module.exports = {
},
'getting user dictionary'
)
SpellingAPIManager.getDic(token, function(error, words) {
SpellingAPIManager.getDic(token, function (error, words) {
if (error != null) {
return next(OError.tag(error))
}

View file

@ -70,7 +70,7 @@ const promises = {
const learnedWords = await LearnedWordsManager.promises.getLearnedWords(
token
)
const notLearntMisspellings = misspellings.filter(m => {
const notLearntMisspellings = misspellings.filter((m) => {
const word = wordSlice[m.index]
return (
learnedWords.indexOf(word) === -1 &&

View file

@ -1,11 +1,9 @@
spelling
--acceptance-creds=None
--data-dirs=cache
--dependencies=mongo
--docker-repos=gcr.io/overleaf-ops
--env-add=
--env-pass-through=
--language=es
--node-version=10.21.0
--public-repo=False
--script-version=2.2.0
--script-version=3.3.2

View file

@ -11,6 +11,7 @@ services:
command: npm run test:unit:_run
environment:
NODE_ENV: test
NODE_OPTIONS: "--unhandled-rejections=strict"
test_acceptance:
@ -23,6 +24,7 @@ services:
POSTGRES_HOST: postgres
MOCHA_GREP: ${MOCHA_GREP}
NODE_ENV: test
NODE_OPTIONS: "--unhandled-rejections=strict"
depends_on:
mongo:
condition: service_healthy
@ -38,4 +40,4 @@ services:
command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs .
user: root
mongo:
image: mongo:3.6
image: mongo:4.0

View file

@ -15,7 +15,8 @@ services:
environment:
MOCHA_GREP: ${MOCHA_GREP}
NODE_ENV: test
command: npm run test:unit
NODE_OPTIONS: "--unhandled-rejections=strict"
command: npm run --silent test:unit
user: node
test_acceptance:
@ -33,12 +34,13 @@ services:
MOCHA_GREP: ${MOCHA_GREP}
LOG_LEVEL: ERROR
NODE_ENV: test
NODE_OPTIONS: "--unhandled-rejections=strict"
user: node
depends_on:
mongo:
condition: service_healthy
command: npm run test:acceptance
command: npm run --silent test:acceptance
mongo:
image: mongo:3.6
image: mongo:4.0

View file

@ -8,7 +8,6 @@
"execMap": {
"js": "npm run start"
},
"watch": [
"app/js/",
"app.js",

View file

@ -181,6 +181,24 @@
"google-auth-library": "^5.5.0",
"retry-request": "^4.0.0",
"teeny-request": "^6.0.0"
},
"dependencies": {
"google-auth-library": {
"version": "5.10.1",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
"integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
"requires": {
"arrify": "^2.0.0",
"base64-js": "^1.3.0",
"ecdsa-sig-formatter": "^1.0.11",
"fast-text-encoding": "^1.0.0",
"gaxios": "^2.1.0",
"gcp-metadata": "^3.4.0",
"gtoken": "^4.1.0",
"jws": "^4.0.0",
"lru-cache": "^5.0.0"
}
}
}
},
"@google-cloud/debug-agent": {
@ -421,6 +439,22 @@
"type-fest": "^0.12.0"
},
"dependencies": {
"google-auth-library": {
"version": "5.10.1",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
"integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
"requires": {
"arrify": "^2.0.0",
"base64-js": "^1.3.0",
"ecdsa-sig-formatter": "^1.0.11",
"fast-text-encoding": "^1.0.0",
"gaxios": "^2.1.0",
"gcp-metadata": "^3.4.0",
"gtoken": "^4.1.0",
"jws": "^4.0.0",
"lru-cache": "^5.0.0"
}
},
"type-fest": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.12.0.tgz",
@ -429,12 +463,12 @@
}
},
"@google-cloud/logging-bunyan": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@google-cloud/logging-bunyan/-/logging-bunyan-2.0.3.tgz",
"integrity": "sha512-8n9MwsCRd4v8WZg17+d3m7qInud7lYTm5rpwXHY0/lzWEJYjeiztT09BiCYh56EEhHr+ynymJnzUDZKazkywlg==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@google-cloud/logging-bunyan/-/logging-bunyan-3.0.0.tgz",
"integrity": "sha512-ZLVXEejNQ27ktGcA3S/sd7GPefp7kywbn+/KoBajdb1Syqcmtc98jhXpYQBXVtNP2065iyu77s4SBaiYFbTC5A==",
"requires": {
"@google-cloud/logging": "^7.0.0",
"google-auth-library": "^5.0.0"
"google-auth-library": "^6.0.0"
}
},
"@google-cloud/paginator": {
@ -890,9 +924,9 @@
}
},
"@grpc/proto-loader": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.4.tgz",
"integrity": "sha512-HTM4QpI9B2XFkPz7pjwMyMgZchJ93TVkL3kWPW8GDMDKYxsMnmf4w2TNMJK7+KNiYHS5cJrCEAFlF+AwtXWVPA==",
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.5.tgz",
"integrity": "sha512-WwN9jVNdHRQoOBo9FDH7qU+mgfjPc8GygPYms3M+y3fbQLfnCe/Kv/E01t7JRgnrsOHH8euvSbed3mIalXhwqQ==",
"requires": {
"lodash.camelcase": "^4.3.0",
"protobufjs": "^6.8.6"
@ -1203,9 +1237,9 @@
"dev": true
},
"agent-base": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz",
"integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==",
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.1.tgz",
"integrity": "sha512-01q25QQDwLSsyfhrKbn8yuur+JNw0H+0Y4JiGIKd3z9aYk/w/2kxD/Upc+t2ZBBSUNff50VjPsSW2YxM8QYKVg==",
"requires": {
"debug": "4"
},
@ -1340,7 +1374,8 @@
"assertion-error": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw=="
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
"dev": true
},
"astral-regex": {
"version": "1.0.0",
@ -1506,6 +1541,7 @@
"version": "1.8.12",
"resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.12.tgz",
"integrity": "sha512-dmDUbGHeGcvCDLRFOscZkwx1ZO/aFz3bJOCi5nCgzdhFGPxwK+y5AcDBnqagNGlJZ7lje/l6JUEz9mQcutttdg==",
"dev": true,
"requires": {
"dtrace-provider": "~0.8",
"moment": "^2.10.6",
@ -1560,6 +1596,7 @@
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz",
"integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==",
"dev": true,
"requires": {
"assertion-error": "^1.1.0",
"check-error": "^1.0.2",
@ -1585,10 +1622,16 @@
"integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
"dev": true
},
"charenc": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
"integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc="
},
"check-error": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII="
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
"dev": true
},
"chokidar": {
"version": "3.3.0",
@ -1789,10 +1832,15 @@
"which": "^1.2.9"
}
},
"crypt": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
"integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs="
},
"d64": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/d64/-/d64-1.0.0.tgz",
"integrity": "sha512-5eNy3WZziVYnrogqgXhcdEmqcDB2IHurTqLcrgssJsfkMVCUoUaZpK6cJjxxvLV2dUm5SuJMNcYfVGoin9UIRw=="
"integrity": "sha1-QAKofoUMv8n52XBrYPymE6MzbpA="
},
"dashdash": {
"version": "1.14.1",
@ -1819,6 +1867,7 @@
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
"dev": true,
"requires": {
"type-detect": "^4.0.0"
}
@ -3089,7 +3138,8 @@
"get-func-name": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE="
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
"dev": true
},
"get-stdin": {
"version": "6.0.0",
@ -3141,19 +3191,97 @@
"integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="
},
"google-auth-library": {
"version": "5.10.1",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
"integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
"version": "6.0.6",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.0.6.tgz",
"integrity": "sha512-fWYdRdg55HSJoRq9k568jJA1lrhg9i2xgfhVIMJbskUmbDpJGHsbv9l41DGhCDXM21F9Kn4kUwdysgxSYBYJUw==",
"requires": {
"arrify": "^2.0.0",
"base64-js": "^1.3.0",
"ecdsa-sig-formatter": "^1.0.11",
"fast-text-encoding": "^1.0.0",
"gaxios": "^2.1.0",
"gcp-metadata": "^3.4.0",
"gtoken": "^4.1.0",
"gaxios": "^3.0.0",
"gcp-metadata": "^4.1.0",
"gtoken": "^5.0.0",
"jws": "^4.0.0",
"lru-cache": "^5.0.0"
"lru-cache": "^6.0.0"
},
"dependencies": {
"bignumber.js": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
"integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A=="
},
"gaxios": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-3.1.0.tgz",
"integrity": "sha512-DDTn3KXVJJigtz+g0J3vhcfbDbKtAroSTxauWsdnP57sM5KZ3d2c/3D9RKFJ86s43hfw6WULg6TXYw/AYiBlpA==",
"requires": {
"abort-controller": "^3.0.0",
"extend": "^3.0.2",
"https-proxy-agent": "^5.0.0",
"is-stream": "^2.0.0",
"node-fetch": "^2.3.0"
}
},
"gcp-metadata": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.1.4.tgz",
"integrity": "sha512-5J/GIH0yWt/56R3dNaNWPGQ/zXsZOddYECfJaqxFWgrZ9HC2Kvc5vl9upOgUUHKzURjAVf2N+f6tEJiojqXUuA==",
"requires": {
"gaxios": "^3.0.0",
"json-bigint": "^1.0.0"
}
},
"google-p12-pem": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.0.2.tgz",
"integrity": "sha512-tbjzndQvSIHGBLzHnhDs3cL4RBjLbLXc2pYvGH+imGVu5b4RMAttUTdnmW2UH0t11QeBTXZ7wlXPS7hrypO/tg==",
"requires": {
"node-forge": "^0.9.0"
}
},
"gtoken": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.0.3.tgz",
"integrity": "sha512-Nyd1wZCMRc2dj/mAD0LlfQLcAO06uKdpKJXvK85SGrF5+5+Bpfil9u/2aw35ltvEHjvl0h5FMKN5knEU+9JrOg==",
"requires": {
"gaxios": "^3.0.0",
"google-p12-pem": "^3.0.0",
"jws": "^4.0.0",
"mime": "^2.2.0"
}
},
"is-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
"integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw=="
},
"json-bigint": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
"integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
"requires": {
"bignumber.js": "^9.0.0"
}
},
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"requires": {
"yallist": "^4.0.0"
}
},
"mime": {
"version": "2.4.6",
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz",
"integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA=="
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}
}
},
"google-gax": {
@ -3178,6 +3306,22 @@
"walkdir": "^0.4.0"
},
"dependencies": {
"google-auth-library": {
"version": "5.10.1",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
"integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
"requires": {
"arrify": "^2.0.0",
"base64-js": "^1.3.0",
"ecdsa-sig-formatter": "^1.0.11",
"fast-text-encoding": "^1.0.0",
"gaxios": "^2.1.0",
"gcp-metadata": "^3.4.0",
"gtoken": "^4.1.0",
"jws": "^4.0.0",
"lru-cache": "^5.0.0"
}
},
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
@ -3878,12 +4022,12 @@
"lodash.at": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.at/-/lodash.at-4.6.0.tgz",
"integrity": "sha512-GOTh0SEp+Yosnlpjic+8cl2WM9MykorogkGA9xyIFkkObQ3H3kNZqZ+ohuq4K3FrSVo7hMcZBMataJemrxC3BA=="
"integrity": "sha1-k83OZk8KGZTqM9181A4jr9EbD/g="
},
"lodash.camelcase": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
"integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="
"integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY="
},
"lodash.flattendeep": {
"version": "4.4.0",
@ -3899,7 +4043,7 @@
"lodash.has": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/lodash.has/-/lodash.has-4.5.2.tgz",
"integrity": "sha512-rnYUdIo6xRCJnQmbVFEwcxF144erlD+M3YcJUVesflU9paQaE8p+fJDcIQrlMYbxoANFL+AB9hZrzSBBk5PL+g=="
"integrity": "sha1-0Z9NwQlQWMzL4rDN9O4P5Ko3yGI="
},
"lodash.memoize": {
"version": "4.1.2",
@ -3939,54 +4083,33 @@
}
},
"logger-sharelatex": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/logger-sharelatex/-/logger-sharelatex-2.0.0.tgz",
"integrity": "sha512-oixnfWOqLRjwHoN/cahzP1rSOge/OQ8/oLoapUV4DHdF7znT6Edv+07Y10NhzypYfO071O3CPZbw6NBJqDaFSQ==",
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/logger-sharelatex/-/logger-sharelatex-2.2.0.tgz",
"integrity": "sha512-ko+OmE25XHJJCiz1R9EgwlfM7J/5olpunUfR3WcfuqOQrcUqsdBrDA2sOytngT0ViwjCR0Fh4qZVPwEWfmrvwA==",
"requires": {
"@google-cloud/logging-bunyan": "^2.0.0",
"@google-cloud/logging-bunyan": "^3.0.0",
"@overleaf/o-error": "^3.0.0",
"bunyan": "1.8.12",
"raven": "1.1.3",
"request": "2.88.0",
"yn": "^3.1.1"
"bunyan": "^1.8.14",
"node-fetch": "^2.6.0",
"raven": "^2.6.4",
"yn": "^4.0.0"
},
"dependencies": {
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
},
"request": {
"version": "2.88.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
"integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
"bunyan": {
"version": "1.8.14",
"resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.14.tgz",
"integrity": "sha512-LlahJUxXzZLuw/hetUQJmRgZ1LF6+cr5TPpRj6jf327AsiIq2jhYEH4oqUUkVKTor+9w2BT3oxVwhzE5lw9tcg==",
"requires": {
"aws-sign2": "~0.7.0",
"aws4": "^1.8.0",
"caseless": "~0.12.0",
"combined-stream": "~1.0.6",
"extend": "~3.0.2",
"forever-agent": "~0.6.1",
"form-data": "~2.3.2",
"har-validator": "~5.1.0",
"http-signature": "~1.2.0",
"is-typedarray": "~1.0.0",
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.19",
"oauth-sign": "~0.9.0",
"performance-now": "^2.1.0",
"qs": "~6.5.2",
"safe-buffer": "^5.1.2",
"tough-cookie": "~2.4.3",
"tunnel-agent": "^0.6.0",
"uuid": "^3.3.2"
"dtrace-provider": "~0.8",
"moment": "^2.19.3",
"mv": "~2",
"safe-json-stringify": "~1"
}
},
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
"yn": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yn/-/yn-4.0.0.tgz",
"integrity": "sha512-huWiiCS4TxKc4SfgmTwW1K7JmXPPAmuXWYy4j9qjQo4+27Kni8mGhAAi1cloRWmBe2EqcLgt3IGqQoRL/MtPgg=="
}
}
},
@ -4046,11 +4169,6 @@
"yallist": "^3.0.2"
}
},
"lsmod": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/lsmod/-/lsmod-1.0.0.tgz",
"integrity": "sha512-Y+6V75r+mGWzWEPr9h6PFmStielICu5JBHLUg18jCsD2VFmEfgHbq/EgnY4inElsUD9eKL9id1qp34w46rSIKQ=="
},
"lynx": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/lynx/-/lynx-0.1.1.tgz",
@ -4100,6 +4218,23 @@
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.1.0.tgz",
"integrity": "sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g=="
},
"md5": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz",
"integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==",
"requires": {
"charenc": "0.0.2",
"crypt": "0.0.2",
"is-buffer": "~1.1.6"
},
"dependencies": {
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
}
}
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@ -4958,7 +5093,8 @@
"pathval": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA="
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=",
"dev": true
},
"performance-now": {
"version": "2.1.0",
@ -4992,9 +5128,9 @@
"dev": true
},
"prettier": {
"version": "1.18.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz",
"integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==",
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz",
"integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==",
"dev": true
},
"prettier-eslint": {
@ -5125,6 +5261,12 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"prettier": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
"dev": true
},
"strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
@ -5486,26 +5628,31 @@
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
},
"raven": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/raven/-/raven-1.1.3.tgz",
"integrity": "sha512-RYov4wAaflZasWiCrZuizd3jNXxCOkW1WrXgWsGVb8kRpdHNZ+vPY27R6RhVtqzWp+DG9a5l6iP0QUPK4EgzaQ==",
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/raven/-/raven-2.6.4.tgz",
"integrity": "sha512-6PQdfC4+DQSFncowthLf+B6Hr0JpPsFBgTVYTAOq7tCmx/kR4SXbeawtPch20+3QfUcQDoJBLjWW1ybvZ4kXTw==",
"requires": {
"cookie": "0.3.1",
"json-stringify-safe": "5.0.1",
"lsmod": "1.0.0",
"stack-trace": "0.0.9",
"uuid": "3.0.0"
"md5": "^2.2.1",
"stack-trace": "0.0.10",
"timed-out": "4.0.1",
"uuid": "3.3.2"
},
"dependencies": {
"cookie": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
"integrity": "sha512-+IJOX0OqlHCszo2mBUq+SrEbCj6w7Kpffqx60zYbPTFaO4+yYgRjHwcZNpWvaTylDHaV7PPmBHzSecZiMhtPgw=="
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
},
"stack-trace": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
"integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
},
"uuid": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.0.tgz",
"integrity": "sha512-rqE1LoOVLv3QrZMjb4NkF5UWlkurCfPyItVnFPNKDDGkHw4dQUdE4zMcLqx28+0Kcf3+bnUk4PisaiRJT4aiaQ=="
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
}
}
},
@ -5682,7 +5829,8 @@
"require-like": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/require-like/-/require-like-0.1.2.tgz",
"integrity": "sha1-rW8wwTvs15cBDEaK+ndcDAprR/o="
"integrity": "sha1-rW8wwTvs15cBDEaK+ndcDAprR/o=",
"dev": true
},
"require-main-filename": {
"version": "2.0.0",
@ -5802,6 +5950,7 @@
"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.9"
@ -6060,7 +6209,8 @@
"stack-trace": {
"version": "0.0.9",
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz",
"integrity": "sha512-vjUc6sfgtgY0dxCdnc40mK6Oftjo9+2K8H/NG81TMhgL392FtiPA9tn9RLyTxXmTLPJPjF3VyzFp6bsWFLisMQ=="
"integrity": "sha1-qPbq7KkGdMMz58Q5U/J1tFFRBpU=",
"dev": true
},
"statsd-parser": {
"version": "0.0.4",
@ -6204,7 +6354,7 @@
"stubs": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz",
"integrity": "sha512-PdHt7hHUJKxvTCgbKX9C1V/ftOcjJQgz8BZwNfV5c4B6dcGqlpelTbJ999jBGZ2jYiPAwcX5dP6oBwVlBlUbxw=="
"integrity": "sha1-6NK6H6nJBXAwPAMLaQD31fiavls="
},
"supports-color": {
"version": "5.5.0",
@ -6413,6 +6563,11 @@
"resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz",
"integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA=="
},
"timed-out": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
"integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8="
},
"tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
@ -6435,7 +6590,7 @@
"to-no-case": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/to-no-case/-/to-no-case-1.0.2.tgz",
"integrity": "sha512-Z3g735FxuZY8rodxV4gH7LxClE4H0hTIyHNIHdk+vpQxjLm0cwnKXq/OFVZ76SOQmto7txVcwSCwkU5kqp+FKg=="
"integrity": "sha1-xyKQcWTvaxeBMsjmmTAhLRtKoWo="
},
"to-regex-range": {
"version": "5.0.1",
@ -6449,7 +6604,7 @@
"to-snake-case": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/to-snake-case/-/to-snake-case-1.0.0.tgz",
"integrity": "sha512-joRpzBAk1Bhi2eGEYBjukEWHOe/IvclOkiJl3DtA91jV6NwQ3MwXA4FHYeqk8BNp/D8bmi9tcNbRu/SozP0jbQ==",
"integrity": "sha1-znRpE4l5RgGah+Yu366upMYIq4w=",
"requires": {
"to-space-case": "^1.0.0"
}
@ -6457,7 +6612,7 @@
"to-space-case": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/to-space-case/-/to-space-case-1.0.0.tgz",
"integrity": "sha512-rLdvwXZ39VOn1IxGL3V6ZstoTbwLRckQmn/U8ZDLuWwIXNpuZDhQ3AiRUlhTbOXFVE9C+dR51wM0CBDhk31VcA==",
"integrity": "sha1-sFLar7Gysp3HcM6gFj5ewOvJ/Bc=",
"requires": {
"to-no-case": "^1.0.0"
}
@ -6467,22 +6622,6 @@
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
},
"tough-cookie": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
"integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==",
"requires": {
"psl": "^1.1.24",
"punycode": "^1.4.1"
},
"dependencies": {
"punycode": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
"integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ=="
}
}
},
"tslib": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
@ -6514,7 +6653,8 @@
"type-detect": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g=="
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
"dev": true
},
"type-fest": {
"version": "0.8.1",

View file

@ -18,7 +18,7 @@
"compile:all": "npm run compile:app && npm run compile:unit_tests && npm run compile:acceptance_tests && npm run compile:smoke_tests",
"nodemon": "nodemon --config nodemon.json",
"compile:smoke_tests": "[ ! -e test/smoke/coffee ] && echo 'No smoke tests to compile' || coffee -o test/smoke/js -c test/smoke/coffee",
"lint": "node_modules/.bin/eslint .",
"lint": "node_modules/.bin/eslint --max-warnings 0 .",
"format": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --list-different",
"format:fix": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --write"
},
@ -29,7 +29,7 @@
"body-parser": "^1.19.0",
"coffee-script": "^1.12.7",
"express": "^4.17.1",
"logger-sharelatex": "^2.0.0",
"logger-sharelatex": "^2.2.0",
"lru-cache": "^5.1.1",
"metrics-sharelatex": "^2.6.2",
"mongojs": "3.1.0",
@ -40,7 +40,7 @@
},
"devDependencies": {
"bunyan": "^1.8.12",
"chai": "",
"chai": "4.2.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-config-standard": "^14.1.0",
@ -53,8 +53,9 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"mocha": "^7.1.1",
"prettier": "^2.0.0",
"prettier-eslint-cli": "^5.0.0",
"sandboxed-module": "",
"sandboxed-module": "2.0.4",
"sinon": "^9.0.1"
}
}

View file

@ -12,19 +12,19 @@ const checkWord = (words, language) =>
})
})
describe('checking words', function() {
describe('checking words', function () {
let response
describe('on successful response', function() {
beforeEach(async function() {
describe('on successful response', function () {
beforeEach(async function () {
response = await checkWord(['anather'])
})
it('should return status 200', async function() {
it('should return status 200', async function () {
expect(response.statusCode).to.equal(200)
})
it('should return the list of misspellings', async function() {
it('should return the list of misspellings', async function () {
const body = JSON.parse(response.body)
expect(body).to.deep.equal({
misspellings: [{ index: 0, suggestions: ['anther', 'another'] }]
@ -32,23 +32,23 @@ describe('checking words', function() {
})
})
describe('when multiple words are submitted', function() {
beforeEach(async function() {
describe('when multiple words are submitted', function () {
beforeEach(async function () {
response = await checkWord(['anather', 'anather', 'theorie'])
})
it('should return the misspellings for all the words', async function() {
it('should return the misspellings for all the words', async function () {
const body = JSON.parse(response.body)
expect(body.misspellings.length).to.equal(3)
})
it('should have misspelling suggestions with consecutive indexes', async function() {
it('should have misspelling suggestions with consecutive indexes', async function () {
const body = JSON.parse(response.body)
const indexes = body.misspellings.map(mspl => mspl.index)
const indexes = body.misspellings.map((mspl) => mspl.index)
expect(indexes).to.deep.equal([0, 1, 2])
})
it('should return identical suggestions for the same entry', async function() {
it('should return identical suggestions for the same entry', async function () {
const body = JSON.parse(response.body)
expect(body.misspellings[0].suggestions).to.deep.equal(
body.misspellings[1].suggestions
@ -56,8 +56,8 @@ describe('checking words', function() {
})
})
describe('when a very long list of words if submitted', function() {
beforeEach(async function() {
describe('when a very long list of words if submitted', function () {
beforeEach(async function () {
const words = []
for (let i = 0; i <= 20000; i++) {
words.push('anather')
@ -65,14 +65,14 @@ describe('checking words', function() {
response = await checkWord(words)
})
it('should return misspellings for the first 10K results only', async function() {
it('should return misspellings for the first 10K results only', async function () {
const body = JSON.parse(response.body)
expect(body.misspellings.length).to.equal(10000)
})
it('should have misspelling suggestions with consecutive indexes', async function() {
it('should have misspelling suggestions with consecutive indexes', async function () {
const body = JSON.parse(response.body)
const indexList = body.misspellings.map(mspl => mspl.index)
const indexList = body.misspellings.map((mspl) => mspl.index)
expect(indexList.length).to.equal(10000) // avoid testing over an incorrect array
for (let i = 0; i < indexList.length - 1; i++) {
expect(indexList[i] + 1).to.equal(indexList[i + 1])
@ -80,8 +80,8 @@ describe('checking words', function() {
})
})
describe('when a very long list of words with utf8 responses', function() {
beforeEach(async function() {
describe('when a very long list of words with utf8 responses', function () {
beforeEach(async function () {
const words = []
for (let i = 0; i <= 20000; i++) {
words.push('anéther')
@ -89,14 +89,14 @@ describe('checking words', function() {
response = await checkWord(words, 'bg') // use Bulgarian to generate utf8 response
})
it('should return misspellings for the first 10K results only', async function() {
it('should return misspellings for the first 10K results only', async function () {
const body = JSON.parse(response.body)
expect(body.misspellings.length).to.equal(10000)
})
it('should have misspelling suggestions with consecutive indexes', async function() {
it('should have misspelling suggestions with consecutive indexes', async function () {
const body = JSON.parse(response.body)
const indexList = body.misspellings.map(mspl => mspl.index)
const indexList = body.misspellings.map((mspl) => mspl.index)
expect(indexList.length).to.equal(10000) // avoid testing over an incorrect array
for (let i = 0; i < indexList.length - 1; i++) {
expect(indexList[i] + 1).to.equal(indexList[i + 1])
@ -104,23 +104,23 @@ describe('checking words', function() {
})
})
describe('when multiple words with utf8 are submitted', function() {
beforeEach(async function() {
describe('when multiple words with utf8 are submitted', function () {
beforeEach(async function () {
response = await checkWord(['mneá', 'meniésn', 'meônoi', 'mneá'], 'pt_BR')
})
it('should return the misspellings for all the words', async function() {
it('should return the misspellings for all the words', async function () {
const body = JSON.parse(response.body)
expect(body.misspellings.length).to.equal(4)
})
it('should have misspelling suggestions with consecutive indexes', async function() {
it('should have misspelling suggestions with consecutive indexes', async function () {
const body = JSON.parse(response.body)
const indexes = body.misspellings.map(mspl => mspl.index)
const indexes = body.misspellings.map((mspl) => mspl.index)
expect(indexes).to.deep.equal([0, 1, 2, 3])
})
it('should return identical suggestions for the same entry', async function() {
it('should return identical suggestions for the same entry', async function () {
const body = JSON.parse(response.body)
expect(body.misspellings[0].suggestions).to.deep.equal(
body.misspellings[3].suggestions

View file

@ -1,8 +1,8 @@
const { expect } = require('chai')
const request = require('./helpers/request')
describe('/health_check', function() {
it('should return 200', async function() {
describe('/health_check', function () {
it('should return 200', async function () {
const response = await request.get('/health_check')
expect(response.statusCode).to.equal(200)
})

View file

@ -1,6 +1,6 @@
const App = require('../../../app.js')
const { PORT } = require('./helpers/request')
before(function(done) {
before(function (done) {
return App.listen(PORT, 'localhost', done)
})

View file

@ -3,7 +3,7 @@ const request = require('./helpers/request')
const USER_ID = 101
const checkWord = words =>
const checkWord = (words) =>
request.post({
url: `/user/${USER_ID}/check`,
body: JSON.stringify({
@ -11,7 +11,7 @@ const checkWord = words =>
})
})
const learnWord = word =>
const learnWord = (word) =>
request.post({
url: `/user/${USER_ID}/learn`,
body: JSON.stringify({
@ -19,7 +19,7 @@ const learnWord = word =>
})
})
const unlearnWord = word =>
const unlearnWord = (word) =>
request.post({
url: `/user/${USER_ID}/unlearn`,
body: JSON.stringify({
@ -37,17 +37,17 @@ const deleteDict = () =>
url: `/user/${USER_ID}`
})
describe('learning words', function() {
afterEach(async function() {
describe('learning words', function () {
afterEach(async function () {
await deleteDict()
})
it('should return status 204 when posting a word successfully', async function() {
it('should return status 204 when posting a word successfully', async function () {
const response = await learnWord('abcd')
expect(response.statusCode).to.equal(204)
})
it('should not learn the same word twice', async function() {
it('should not learn the same word twice', async function () {
await learnWord('foobar')
const learnResponse = await learnWord('foobar')
expect(learnResponse.statusCode).to.equal(204)
@ -59,7 +59,7 @@ describe('learning words', function() {
expect(responseBody.length).to.equals(1)
})
it('should return no misspellings after a word is learnt', async function() {
it('should return no misspellings after a word is learnt', async function () {
const response = await checkWord(['abv'])
const responseBody = JSON.parse(response.body)
expect(responseBody.misspellings.length).to.equals(1)
@ -71,7 +71,7 @@ describe('learning words', function() {
expect(responseBody2.misspellings.length).to.equals(0)
})
it('should return misspellings again after a personal dictionary is deleted', async function() {
it('should return misspellings again after a personal dictionary is deleted', async function () {
await learnWord('bvc')
await deleteDict()
@ -81,13 +81,13 @@ describe('learning words', function() {
})
})
describe('unlearning words', function() {
it('should return status 204 when posting a word successfully', async function() {
describe('unlearning words', function () {
it('should return status 204 when posting a word successfully', async function () {
const response = await unlearnWord('anything')
expect(response.statusCode).to.equal(204)
})
it('should return misspellings after a word is unlearnt', async function() {
it('should return misspellings after a word is unlearnt', async function () {
await learnWord('abv')
const response = await checkWord(['abv'])

View file

@ -1,8 +1,8 @@
const { expect } = require('chai')
const request = require('./helpers/request')
describe('/status', function() {
it('should return 200', async function() {
describe('/status', function () {
it('should return 200', async function () {
const response = await request.get('/health_check')
expect(response.statusCode).to.equal(200)
})

View file

@ -24,9 +24,9 @@ const wordlist = fs
.readFileSync(WORDS)
.toString()
.split('\n')
.filter(w => w.match(/^[a-z]+$/))
.filter((w) => w.match(/^[a-z]+$/))
const generateCorrectWords = function(n) {
const generateCorrectWords = function (n) {
const words = []
const N = Math.random() > 0.5 ? wordlist.length : 10
for (
@ -40,7 +40,7 @@ const generateCorrectWords = function(n) {
return words
}
const generateIncorrectWords = function(n) {
const generateIncorrectWords = function (n) {
const words = []
const N = wordlist.length
for (
@ -54,7 +54,7 @@ const generateIncorrectWords = function(n) {
return words
}
const make_request = function(correctWords, incorrectWords, callback) {
const make_request = function (correctWords, incorrectWords, callback) {
let i, j, w
let i1
let j1
@ -73,7 +73,7 @@ const make_request = function(correctWords, incorrectWords, callback) {
bad[i + correctSet.length] = true
}
const k = full.length
full.forEach(function(e, i) {
full.forEach(function (e, i) {
let ref
j = Math.floor(k * Math.random())
;[full[i], full[j]] = Array.from([full[j], full[i]])
@ -89,7 +89,7 @@ const make_request = function(correctWords, incorrectWords, callback) {
return request.post(
'http://localhost:3005/user/1/check',
{ json: true, body: { words: full } },
function(err, req, body) {
function (err, req, body) {
let m
const { misspellings } = body
console.log(JSON.stringify({ full, misspellings }))

View file

@ -14,8 +14,8 @@ const should = chai.should()
const SandboxedModule = require('sandboxed-module')
const { assert } = require('chai')
describe('ASpell', function() {
beforeEach(function() {
describe('ASpell', function () {
beforeEach(function () {
return (this.ASpell = SandboxedModule.require('../../../app/js/ASpell', {
requires: {
'logger-sharelatex': {
@ -30,39 +30,39 @@ describe('ASpell', function() {
}
}))
})
afterEach(function() {
afterEach(function () {
clearInterval(this.ASpell.cacheDump)
})
describe('a correctly spelled word', function() {
beforeEach(function(done) {
describe('a correctly spelled word', function () {
beforeEach(function (done) {
return this.ASpell.checkWords('en', ['word'], (error, result) => {
this.result = result
return done()
})
})
return it('should not correct the word', function() {
return it('should not correct the word', function () {
return this.result.length.should.equal(0)
})
})
describe('a misspelled word', function() {
beforeEach(function(done) {
describe('a misspelled word', function () {
beforeEach(function (done) {
return this.ASpell.checkWords('en', ['bussines'], (error, result) => {
this.result = result
return done()
})
})
return it('should correct the word', function() {
return it('should correct the word', function () {
this.result.length.should.equal(1)
return this.result[0].suggestions.indexOf('business').should.not.equal(-1)
})
})
describe('multiple words', function() {
beforeEach(function(done) {
describe('multiple words', function () {
beforeEach(function (done) {
return this.ASpell.checkWords(
'en',
['bussines', 'word', 'neccesary'],
@ -73,7 +73,7 @@ describe('ASpell', function() {
)
})
return it('should correct the incorrect words', function() {
return it('should correct the incorrect words', function () {
this.result[0].index.should.equal(0)
this.result[0].suggestions.indexOf('business').should.not.equal(-1)
this.result[1].index.should.equal(2)
@ -83,8 +83,8 @@ describe('ASpell', function() {
})
})
describe('without a valid language', function() {
beforeEach(function(done) {
describe('without a valid language', function () {
beforeEach(function (done) {
return this.ASpell.checkWords('notALang', ['banana'], (error, result) => {
this.error = error
this.result = result
@ -92,13 +92,13 @@ describe('ASpell', function() {
})
})
return it('should return an error', function() {
return it('should return an error', function () {
return should.exist(this.error)
})
})
describe('when there are no suggestions', function() {
beforeEach(function(done) {
describe('when there are no suggestions', function () {
beforeEach(function (done) {
return this.ASpell.checkWords(
'en',
['asdkfjalkdjfadhfkajsdhfashdfjhadflkjadhflajsd'],
@ -110,15 +110,15 @@ describe('ASpell', function() {
)
})
return it('should return a blank array', function() {
return it('should return a blank array', function () {
this.result.length.should.equal(1)
return assert.deepEqual(this.result[0].suggestions, [])
})
})
return describe('when the request times out', function() {
beforeEach(function(done) {
const words = __range__(0, 1000, true).map(i => 'abcdefg')
return describe('when the request times out', function () {
beforeEach(function (done) {
const words = __range__(0, 1000, true).map((i) => 'abcdefg')
this.ASpell.ASPELL_TIMEOUT = 1
this.start = Date.now()
return this.ASpell.checkWords('en', words, (error, result) => {
@ -130,7 +130,7 @@ describe('ASpell', function() {
// Note that this test fails on OS X, due to differing pipe behaviour
// on killing the child process. It can be tested successfully on Travis
// or the CI server.
return it('should return in reasonable time', function() {
return it('should return in reasonable time', function () {
const delta = Date.now() - this.start
return delta.should.be.below(this.ASpell.ASPELL_TIMEOUT + 1000)
})

View file

@ -8,8 +8,8 @@ const { expect } = chai
const SandboxedModule = require('sandboxed-module')
const EventEmitter = require('events')
describe('ASpellWorker', function() {
beforeEach(function() {
describe('ASpellWorker', function () {
beforeEach(function () {
this.child_process = {}
return (this.ASpellWorker = SandboxedModule.require(
'../../../app/js/ASpellWorker',
@ -30,8 +30,8 @@ describe('ASpellWorker', function() {
))
})
describe('creating a worker', function() {
beforeEach(function() {
describe('creating a worker', function () {
beforeEach(function () {
this.pipe = {
stdout: new EventEmitter(),
stderr: { on: sinon.stub() },
@ -44,8 +44,8 @@ describe('ASpellWorker', function() {
worker = new this.ASpellWorker('en')
})
describe('with normal aspell output', function() {
beforeEach(function() {
describe('with normal aspell output', function () {
beforeEach(function () {
this.callback = worker.callback = sinon.stub()
this.pipe.stdout.emit('data', '& hello\n')
this.pipe.stdout.emit('data', '& world\n')
@ -53,7 +53,7 @@ describe('ASpellWorker', function() {
this.pipe.stdout.emit('data', '& goodbye')
})
it('should call the callback', function() {
it('should call the callback', function () {
expect(this.callback.called).to.equal(true)
expect(
this.callback.calledWith(null, '& hello\n& world\nen\n')
@ -61,8 +61,8 @@ describe('ASpellWorker', function() {
})
})
describe('with the aspell end marker split across chunks', function() {
beforeEach(function() {
describe('with the aspell end marker split across chunks', function () {
beforeEach(function () {
this.callback = worker.callback = sinon.stub()
this.pipe.stdout.emit('data', '& hello\n')
this.pipe.stdout.emit('data', '& world\ne')
@ -70,7 +70,7 @@ describe('ASpellWorker', function() {
this.pipe.stdout.emit('data', '& goodbye')
})
it('should call the callback', function() {
it('should call the callback', function () {
expect(this.callback.called).to.equal(true)
expect(
this.callback.calledWith(null, '& hello\n& world\nen\n')
@ -78,8 +78,8 @@ describe('ASpellWorker', function() {
})
})
describe('with the aspell end marker newline split across chunks', function() {
beforeEach(function() {
describe('with the aspell end marker newline split across chunks', function () {
beforeEach(function () {
this.callback = worker.callback = sinon.stub()
this.pipe.stdout.emit('data', '& hello\n')
this.pipe.stdout.emit('data', '& world\n')
@ -87,7 +87,7 @@ describe('ASpellWorker', function() {
this.pipe.stdout.emit('data', '\n& goodbye')
})
it('should call the callback', function() {
it('should call the callback', function () {
expect(this.callback.called).to.equal(true)
expect(this.callback.calledWith(null, '& hello\n& world\nen')).to.equal(
true
@ -95,15 +95,15 @@ describe('ASpellWorker', function() {
})
})
describe('with everything split across chunks', function() {
beforeEach(function() {
describe('with everything split across chunks', function () {
beforeEach(function () {
this.callback = worker.callback = sinon.stub()
'& hello\n& world\nen\n& goodbye'.split('').forEach(x => {
'& hello\n& world\nen\n& goodbye'.split('').forEach((x) => {
this.pipe.stdout.emit('data', x)
})
})
it('should call the callback', function() {
it('should call the callback', function () {
expect(this.callback.called).to.equal(true)
expect(this.callback.calledWith(null, '& hello\n& world\nen')).to.equal(
true

View file

@ -7,8 +7,8 @@ const modulePath = require('path').join(
'../../../app/js/LearnedWordsManager'
)
const { assert } = require('chai')
describe('LearnedWordsManager', function() {
beforeEach(function() {
describe('LearnedWordsManager', function () {
beforeEach(function () {
this.token = 'a6b3cd919ge'
this.callback = sinon.stub()
this.db = {
@ -41,13 +41,13 @@ describe('LearnedWordsManager', function() {
})
})
describe('learnWord', function() {
beforeEach(function() {
describe('learnWord', function () {
beforeEach(function () {
this.word = 'instanton'
this.LearnedWordsManager.learnWord(this.token, this.word, this.callback)
})
it('should insert the word in the word list in the database', function() {
it('should insert the word in the word list in the database', function () {
expect(
this.db.spellingPreferences.update.calledWith(
{
@ -63,18 +63,18 @@ describe('LearnedWordsManager', function() {
).to.equal(true)
})
it('should call the callback', function() {
it('should call the callback', function () {
expect(this.callback.called).to.equal(true)
})
})
describe('unlearnWord', function() {
beforeEach(function() {
describe('unlearnWord', function () {
beforeEach(function () {
this.word = 'instanton'
this.LearnedWordsManager.unlearnWord(this.token, this.word, this.callback)
})
it('should remove the word from the word list in the database', function() {
it('should remove the word from the word list in the database', function () {
expect(
this.db.spellingPreferences.update.calledWith(
{
@ -87,13 +87,13 @@ describe('LearnedWordsManager', function() {
).to.equal(true)
})
it('should call the callback', function() {
it('should call the callback', function () {
expect(this.callback.called).to.equal(true)
})
})
describe('getLearnedWords', function() {
beforeEach(function() {
describe('getLearnedWords', function () {
beforeEach(function () {
this.wordList = ['apples', 'bananas', 'pears']
this.wordListWithDuplicates = this.wordList.slice()
this.wordListWithDuplicates.push('bananas')
@ -104,19 +104,19 @@ describe('LearnedWordsManager', function() {
this.LearnedWordsManager.getLearnedWords(this.token, this.callback)
})
it('should get the word list for the given user', function() {
it('should get the word list for the given user', function () {
expect(
this.db.spellingPreferences.findOne.calledWith({ token: this.token })
).to.equal(true)
})
it('should return the word list in the callback without duplicates', function() {
it('should return the word list in the callback without duplicates', function () {
expect(this.callback.calledWith(null, this.wordList)).to.equal(true)
})
})
describe('caching the result', function() {
it('should use the cache first if it is primed', function(done) {
describe('caching the result', function () {
it('should use the cache first if it is primed', function (done) {
this.wordList = ['apples', 'bananas', 'pears']
this.cache.get.returns(this.wordList)
this.db.spellingPreferences.findOne = sinon.stub()
@ -128,7 +128,7 @@ describe('LearnedWordsManager', function() {
})
})
it('should set the cache after hitting the db', function(done) {
it('should set the cache after hitting the db', function (done) {
this.wordList = ['apples', 'bananas', 'pears']
this.db.spellingPreferences.findOne = sinon
.stub()
@ -139,7 +139,7 @@ describe('LearnedWordsManager', function() {
})
})
it('should break cache when update is called', function(done) {
it('should break cache when update is called', function (done) {
this.word = 'instanton'
this.LearnedWordsManager.learnWord(this.token, this.word, () => {
this.cache.del.calledWith(this.token).should.equal(true)
@ -148,12 +148,12 @@ describe('LearnedWordsManager', function() {
})
})
describe('deleteUsersLearnedWords', function() {
beforeEach(function() {
describe('deleteUsersLearnedWords', function () {
beforeEach(function () {
this.db.spellingPreferences.remove = sinon.stub().callsArgWith(1)
})
it('should get the word list for the given user', function(done) {
it('should get the word list for the given user', function (done) {
this.LearnedWordsManager.deleteUsersLearnedWords(this.token, () => {
this.db.spellingPreferences.remove
.calledWith({ token: this.token })

View file

@ -11,10 +11,10 @@ const modulePath = require('path').join(
'../../../app/js/SpellingAPIManager'
)
const promiseStub = val => new Promise(resolve => resolve(val))
const promiseStub = (val) => new Promise((resolve) => resolve(val))
describe('SpellingAPIManager', function() {
beforeEach(function() {
describe('SpellingAPIManager', function () {
beforeEach(function () {
this.token = 'user-id-123'
this.ASpell = {}
this.learnedWords = ['lerned']
@ -35,8 +35,8 @@ describe('SpellingAPIManager', function() {
})
})
describe('runRequest', function() {
beforeEach(function() {
describe('runRequest', function () {
beforeEach(function () {
this.nonLearnedWords = [
'some',
'words',
@ -64,8 +64,8 @@ describe('SpellingAPIManager', function() {
sinon.spy(this.ASpell, 'checkWords')
})
describe('with sensible JSON', function() {
beforeEach(function(done) {
describe('with sensible JSON', function () {
beforeEach(function (done) {
this.SpellingAPIManager.runRequest(
this.token,
{ words: this.allWords },
@ -76,15 +76,15 @@ describe('SpellingAPIManager', function() {
)
})
it('should return the words that are spelled incorrectly and not learned', function() {
it('should return the words that are spelled incorrectly and not learned', function () {
expect(this.result.misspellings).to.deep.equal(
this.misspellingsWithoutLearnedWords
)
})
})
describe('with a missing words array', function() {
beforeEach(function(done) {
describe('with a missing words array', function () {
beforeEach(function (done) {
this.SpellingAPIManager.runRequest(this.token, {}, (error, result) => {
this.error = error
this.result = result
@ -92,15 +92,15 @@ describe('SpellingAPIManager', function() {
})
})
it('should return an error', function() {
it('should return an error', function () {
expect(this.error).to.exist
expect(this.error).to.be.instanceof(Error)
expect(this.error.message).to.equal('malformed JSON')
})
})
describe('with a missing token', function() {
beforeEach(function(done) {
describe('with a missing token', function () {
beforeEach(function (done) {
this.SpellingAPIManager.runRequest(
null,
{ words: this.allWords },
@ -112,13 +112,13 @@ describe('SpellingAPIManager', function() {
)
})
it('should spell check without using any learned words', function() {
it('should spell check without using any learned words', function () {
this.LearnedWordsManager.getLearnedWords.called.should.equal(false)
})
})
describe('without a language', function() {
beforeEach(function(done) {
describe('without a language', function () {
beforeEach(function (done) {
this.SpellingAPIManager.runRequest(
this.token,
{ words: this.allWords },
@ -129,13 +129,13 @@ describe('SpellingAPIManager', function() {
)
})
it('should use en as the default', function() {
it('should use en as the default', function () {
this.ASpell.promises.checkWords.calledWith('en').should.equal(true)
})
})
describe('with a language', function() {
beforeEach(function(done) {
describe('with a language', function () {
beforeEach(function (done) {
this.language = 'fr'
this.SpellingAPIManager.runRequest(
this.token,
@ -150,15 +150,15 @@ describe('SpellingAPIManager', function() {
)
})
it('should use the language', function() {
it('should use the language', function () {
this.ASpell.promises.checkWords
.calledWith(this.language)
.should.equal(true)
})
})
describe('with words from the whitelist', function() {
beforeEach(function(done) {
describe('with words from the whitelist', function () {
beforeEach(function (done) {
this.whitelistWord = this.SpellingAPIManager.whitelist[0]
this.words = ['One', 'Two', this.whitelistWord]
this.SpellingAPIManager.runRequest(
@ -171,7 +171,7 @@ describe('SpellingAPIManager', function() {
)
})
it('should ignore the white-listed word', function() {
it('should ignore the white-listed word', function () {
expect(this.result.misspellings.length).to.equal(
this.misspellings.length - 1
)
@ -179,51 +179,51 @@ describe('SpellingAPIManager', function() {
})
})
describe('learnWord', function() {
describe('without a token', function() {
beforeEach(function(done) {
this.SpellingAPIManager.learnWord(null, { word: 'banana' }, error => {
describe('learnWord', function () {
describe('without a token', function () {
beforeEach(function (done) {
this.SpellingAPIManager.learnWord(null, { word: 'banana' }, (error) => {
this.error = error
done()
})
})
it('should return an error', function() {
it('should return an error', function () {
expect(this.error).to.exist
expect(this.error).to.be.instanceof(Error)
expect(this.error.message).to.equal('no token provided')
})
})
describe('without a word', function() {
beforeEach(function(done) {
this.SpellingAPIManager.learnWord(this.token, {}, error => {
describe('without a word', function () {
beforeEach(function (done) {
this.SpellingAPIManager.learnWord(this.token, {}, (error) => {
this.error = error
done()
})
})
it('should return an error', function() {
it('should return an error', function () {
expect(this.error).to.exist
expect(this.error).to.be.instanceof(Error)
expect(this.error.message).to.equal('malformed JSON')
})
})
describe('with a word and a token', function() {
beforeEach(function(done) {
describe('with a word and a token', function () {
beforeEach(function (done) {
this.word = 'banana'
this.SpellingAPIManager.learnWord(
this.token,
{ word: this.word },
error => {
(error) => {
this.error = error
done()
}
)
})
it('should call LearnedWordsManager.learnWord', function() {
it('should call LearnedWordsManager.learnWord', function () {
this.LearnedWordsManager.learnWord
.calledWith(this.token, this.word)
.should.equal(true)
@ -231,51 +231,55 @@ describe('SpellingAPIManager', function() {
})
})
describe('unlearnWord', function() {
describe('without a token', function() {
beforeEach(function(done) {
this.SpellingAPIManager.unlearnWord(null, { word: 'banana' }, error => {
this.error = error
done()
})
})
it('should return an error', function() {
expect(this.error).to.exist
expect(this.error).to.be.instanceof(Error)
expect(this.error.message).to.equal('no token provided')
})
})
describe('without a word', function() {
beforeEach(function(done) {
this.SpellingAPIManager.unlearnWord(this.token, {}, error => {
this.error = error
done()
})
})
it('should return an error', function() {
expect(this.error).to.exist
expect(this.error).to.be.instanceof(Error)
expect(this.error.message).to.equal('malformed JSON')
})
})
describe('with a word and a token', function() {
beforeEach(function(done) {
this.word = 'banana'
describe('unlearnWord', function () {
describe('without a token', function () {
beforeEach(function (done) {
this.SpellingAPIManager.unlearnWord(
this.token,
{ word: this.word },
error => {
null,
{ word: 'banana' },
(error) => {
this.error = error
done()
}
)
})
it('should call LearnedWordsManager.unlearnWord', function() {
it('should return an error', function () {
expect(this.error).to.exist
expect(this.error).to.be.instanceof(Error)
expect(this.error.message).to.equal('no token provided')
})
})
describe('without a word', function () {
beforeEach(function (done) {
this.SpellingAPIManager.unlearnWord(this.token, {}, (error) => {
this.error = error
done()
})
})
it('should return an error', function () {
expect(this.error).to.exist
expect(this.error).to.be.instanceof(Error)
expect(this.error.message).to.equal('malformed JSON')
})
})
describe('with a word and a token', function () {
beforeEach(function (done) {
this.word = 'banana'
this.SpellingAPIManager.unlearnWord(
this.token,
{ word: this.word },
(error) => {
this.error = error
done()
}
)
})
it('should call LearnedWordsManager.unlearnWord', function () {
this.LearnedWordsManager.unlearnWord
.calledWith(this.token, this.word)
.should.equal(true)