mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #69 from overleaf/jpa-bulk-dependency-upgrades
[misc] bulk dependency upgrades
This commit is contained in:
commit
d571daaaa2
19 changed files with 1145 additions and 2593 deletions
|
@ -3,9 +3,9 @@
|
||||||
// https://github.com/sharelatex/sharelatex-dev-environment
|
// https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
"standard",
|
"standard",
|
||||||
"prettier",
|
"prettier"
|
||||||
"prettier/standard"
|
|
||||||
],
|
],
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 2018
|
"ecmaVersion": 2018
|
||||||
|
@ -20,6 +20,19 @@
|
||||||
"mocha": true
|
"mocha": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
// TODO(das7pad): remove overrides after fixing all the violations manually (https://github.com/overleaf/issues/issues/3882#issuecomment-878999671)
|
||||||
|
// START of temporary overrides
|
||||||
|
"array-callback-return": "off",
|
||||||
|
"no-dupe-else-if": "off",
|
||||||
|
"no-var": "off",
|
||||||
|
"no-empty": "off",
|
||||||
|
"node/handle-callback-err": "off",
|
||||||
|
"no-loss-of-precision": "off",
|
||||||
|
"node/no-callback-literal": "off",
|
||||||
|
"node/no-path-concat": "off",
|
||||||
|
"prefer-regex-literals": "off",
|
||||||
|
// END of temporary overrides
|
||||||
|
|
||||||
// Swap the no-unused-expressions rule with a more chai-friendly one
|
// Swap the no-unused-expressions rule with a more chai-friendly one
|
||||||
"no-unused-expressions": 0,
|
"no-unused-expressions": 0,
|
||||||
"chai-friendly/no-unused-expressions": "error",
|
"chai-friendly/no-unused-expressions": "error",
|
||||||
|
|
2
services/contacts/.github/dependabot.yml
vendored
2
services/contacts/.github/dependabot.yml
vendored
|
@ -20,4 +20,4 @@ updates:
|
||||||
# future if we reorganise teams
|
# future if we reorganise teams
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- "dependencies"
|
||||||
- "Team-Magma"
|
- "type:maintenance"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
12.21.0
|
12.22.3
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
{
|
{
|
||||||
|
"arrowParens": "avoid",
|
||||||
"semi": false,
|
"semi": false,
|
||||||
"singleQuote": true
|
"singleQuote": true,
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# Instead run bin/update_build_scripts from
|
# Instead run bin/update_build_scripts from
|
||||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||||
|
|
||||||
FROM node:12.21.0 as base
|
FROM node:12.22.3 as base
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
const Metrics = require('@overleaf/metrics')
|
const Metrics = require('@overleaf/metrics')
|
||||||
Metrics.initialize('contacts')
|
Metrics.initialize('contacts')
|
||||||
|
|
||||||
const Settings = require('settings-sharelatex')
|
const Settings = require('@overleaf/settings')
|
||||||
const logger = require('logger-sharelatex')
|
const logger = require('logger-sharelatex')
|
||||||
const express = require('express')
|
const express = require('express')
|
||||||
const bodyParser = require('body-parser')
|
const bodyParser = require('body-parser')
|
||||||
|
@ -60,7 +60,7 @@ if (!module.parent) {
|
||||||
return logger.info(`contacts starting up, listening on ${host}:${port}`)
|
return logger.info(`contacts starting up, listening on ${host}:${port}`)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(err => {
|
||||||
logger.fatal({ err }, 'Cannot connect to mongo. Exiting.')
|
logger.fatal({ err }, 'Cannot connect to mongo. Exiting.')
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
|
|
|
@ -33,11 +33,11 @@ module.exports = ContactManager = {
|
||||||
|
|
||||||
db.contacts.updateOne(
|
db.contacts.updateOne(
|
||||||
{
|
{
|
||||||
user_id
|
user_id,
|
||||||
},
|
},
|
||||||
update,
|
update,
|
||||||
{
|
{
|
||||||
upsert: true
|
upsert: true,
|
||||||
},
|
},
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
|
@ -56,7 +56,7 @@ module.exports = ContactManager = {
|
||||||
|
|
||||||
return db.contacts.findOne(
|
return db.contacts.findOne(
|
||||||
{
|
{
|
||||||
user_id
|
user_id,
|
||||||
},
|
},
|
||||||
function (error, user) {
|
function (error, user) {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
|
@ -65,9 +65,9 @@ module.exports = ContactManager = {
|
||||||
return callback(null, user != null ? user.contacts : undefined)
|
return callback(null, user != null ? user.contacts : undefined)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
;['touchContact', 'getContacts'].map((method) =>
|
;['touchContact', 'getContacts'].map(method =>
|
||||||
metrics.timeAsyncMethod(
|
metrics.timeAsyncMethod(
|
||||||
ContactManager,
|
ContactManager,
|
||||||
method,
|
method,
|
||||||
|
|
|
@ -64,16 +64,16 @@ module.exports = HttpController = {
|
||||||
contacts.push({
|
contacts.push({
|
||||||
user_id,
|
user_id,
|
||||||
n: data.n,
|
n: data.n,
|
||||||
ts: data.ts
|
ts: data.ts,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpController._sortContacts(contacts)
|
HttpController._sortContacts(contacts)
|
||||||
contacts = contacts.slice(0, limit)
|
contacts = contacts.slice(0, limit)
|
||||||
const contact_ids = contacts.map((contact) => contact.user_id)
|
const contact_ids = contacts.map(contact => contact.user_id)
|
||||||
|
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
contact_ids
|
contact_ids,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -96,5 +96,5 @@ module.exports = HttpController = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const Settings = require('settings-sharelatex')
|
const Settings = require('@overleaf/settings')
|
||||||
const { MongoClient, ObjectId } = require('mongodb')
|
const { MongoClient, ObjectId } = require('mongodb')
|
||||||
|
|
||||||
const clientPromise = MongoClient.connect(
|
const clientPromise = MongoClient.connect(
|
||||||
|
@ -24,5 +24,5 @@ async function setupDb() {
|
||||||
module.exports = {
|
module.exports = {
|
||||||
db,
|
db,
|
||||||
ObjectId,
|
ObjectId,
|
||||||
waitForDb
|
waitForDb,
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,6 @@ contacts
|
||||||
--docker-repos=gcr.io/overleaf-ops
|
--docker-repos=gcr.io/overleaf-ops
|
||||||
--env-add=
|
--env-add=
|
||||||
--env-pass-through=
|
--env-pass-through=
|
||||||
--node-version=12.21.0
|
--node-version=12.22.3
|
||||||
--public-repo=False
|
--public-repo=False
|
||||||
--script-version=3.8.0
|
--script-version=3.11.0
|
||||||
|
|
|
@ -5,17 +5,17 @@ module.exports = {
|
||||||
internal: {
|
internal: {
|
||||||
contacts: {
|
contacts: {
|
||||||
port: 3036,
|
port: 3036,
|
||||||
host: process.env.LISTEN_ADDRESS || 'localhost'
|
host: process.env.LISTEN_ADDRESS || 'localhost',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
mongo: {
|
mongo: {
|
||||||
options: {
|
options: {
|
||||||
useUnifiedTopology:
|
useUnifiedTopology:
|
||||||
(process.env.MONGO_USE_UNIFIED_TOPOLOGY || 'true') === 'true'
|
(process.env.MONGO_USE_UNIFIED_TOPOLOGY || 'true') === 'true',
|
||||||
},
|
},
|
||||||
url:
|
url:
|
||||||
process.env.MONGO_CONNECTION_STRING ||
|
process.env.MONGO_CONNECTION_STRING ||
|
||||||
`mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`
|
`mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ version: "2.3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
test_unit:
|
test_unit:
|
||||||
image: node:12.21.0
|
image: node:12.22.3
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
|
@ -18,7 +18,7 @@ services:
|
||||||
user: node
|
user: node
|
||||||
|
|
||||||
test_acceptance:
|
test_acceptance:
|
||||||
image: node:12.21.0
|
image: node:12.22.3
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
|
|
3556
services/contacts/package-lock.json
generated
3556
services/contacts/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -14,43 +14,38 @@
|
||||||
"test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js",
|
"test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js",
|
||||||
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
|
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
|
||||||
"nodemon": "nodemon --config nodemon.json",
|
"nodemon": "nodemon --config nodemon.json",
|
||||||
"lint": "node_modules/.bin/eslint --max-warnings 0 .",
|
"lint": "eslint --max-warnings 0 --format unix .",
|
||||||
"format": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --list-different",
|
"format": "prettier --list-different $PWD/'**/*.js'",
|
||||||
"format:fix": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --write"
|
"format:fix": "prettier --write $PWD/'**/*.js'",
|
||||||
|
"lint:fix": "eslint --fix ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@overleaf/metrics": "^3.5.1",
|
"@overleaf/metrics": "^3.5.1",
|
||||||
|
"@overleaf/settings": "^2.1.1",
|
||||||
"async": "^2.6.3",
|
"async": "^2.6.3",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
|
"bunyan": "^1.8.15",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"logger-sharelatex": "^2.2.0",
|
"logger-sharelatex": "^2.2.0",
|
||||||
"mongodb": "^3.6.0",
|
"mongodb": "^3.6.0",
|
||||||
"request": "~2.88.2",
|
"request": "~2.88.2",
|
||||||
"settings-sharelatex": "^1.1.0",
|
|
||||||
"underscore": "~1.13.1"
|
"underscore": "~1.13.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-eslint": "^10.1.0",
|
"chai": "^4.2.0",
|
||||||
"bunyan": "~1.8.12",
|
"chai-as-promised": "^7.1.1",
|
||||||
"chai": "~4.2.0",
|
"eslint": "^7.21.0",
|
||||||
"eslint": "^6.8.0",
|
"eslint-config-prettier": "^8.1.0",
|
||||||
"eslint-config-prettier": "^6.10.0",
|
"eslint-config-standard": "^16.0.2",
|
||||||
"eslint-config-standard": "^14.1.0",
|
"eslint-plugin-chai-expect": "^2.2.0",
|
||||||
"eslint-config-standard-jsx": "^8.1.0",
|
"eslint-plugin-chai-friendly": "^0.6.0",
|
||||||
"eslint-config-standard-react": "^9.2.0",
|
"eslint-plugin-import": "^2.22.1",
|
||||||
"eslint-plugin-chai-expect": "^2.1.0",
|
"eslint-plugin-mocha": "^8.0.0",
|
||||||
"eslint-plugin-chai-friendly": "^0.5.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint-plugin-import": "^2.20.1",
|
|
||||||
"eslint-plugin-jsx-a11y": "^6.2.3",
|
|
||||||
"eslint-plugin-mocha": "^6.3.0",
|
|
||||||
"eslint-plugin-node": "^11.0.0",
|
|
||||||
"eslint-plugin-prettier": "^3.1.2",
|
"eslint-plugin-prettier": "^3.1.2",
|
||||||
"eslint-plugin-promise": "^4.2.1",
|
"eslint-plugin-promise": "^4.2.1",
|
||||||
"eslint-plugin-react": "^7.19.0",
|
"mocha": "^8.3.2",
|
||||||
"eslint-plugin-standard": "^4.0.1",
|
"prettier": "^2.2.1",
|
||||||
"mocha": "^7.1.1",
|
|
||||||
"prettier": "^2.0.0",
|
|
||||||
"prettier-eslint-cli": "^5.0.0",
|
|
||||||
"sandboxed-module": "~2.0.3",
|
"sandboxed-module": "~2.0.3",
|
||||||
"sinon": "~9.0.1",
|
"sinon": "~9.0.1",
|
||||||
"timekeeper": "2.2.0"
|
"timekeeper": "2.2.0"
|
||||||
|
|
|
@ -31,7 +31,7 @@ module.exports = {
|
||||||
this.initing = true
|
this.initing = true
|
||||||
this.callbacks.push(callback)
|
this.callbacks.push(callback)
|
||||||
waitForDb().then(() => {
|
waitForDb().then(() => {
|
||||||
return app.listen(3036, 'localhost', (error) => {
|
return app.listen(3036, 'localhost', error => {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
|
@ -45,5 +45,5 @@ module.exports = {
|
||||||
})()
|
})()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ describe('Getting Contacts', function () {
|
||||||
{
|
{
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: `${HOST}/user/${this.user_id}/contacts`,
|
url: `${HOST}/user/${this.user_id}/contacts`,
|
||||||
json: true
|
json: true,
|
||||||
},
|
},
|
||||||
(error, response, body) => {
|
(error, response, body) => {
|
||||||
response.statusCode.should.equal(200)
|
response.statusCode.should.equal(200)
|
||||||
|
@ -57,8 +57,8 @@ describe('Getting Contacts', function () {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: `${HOST}/user/${user_id}/contacts`,
|
url: `${HOST}/user/${user_id}/contacts`,
|
||||||
json: {
|
json: {
|
||||||
contact_id
|
contact_id,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
cb
|
cb
|
||||||
)
|
)
|
||||||
|
@ -66,11 +66,11 @@ describe('Getting Contacts', function () {
|
||||||
return async.series(
|
return async.series(
|
||||||
[
|
[
|
||||||
// 2 is preferred since touched twice, then 3 since most recent, then 1
|
// 2 is preferred since touched twice, then 3 since most recent, then 1
|
||||||
(cb) => ContactsApp.ensureRunning(cb),
|
cb => ContactsApp.ensureRunning(cb),
|
||||||
(cb) => touchContact(this.user_id, this.contact_id_1, cb),
|
cb => touchContact(this.user_id, this.contact_id_1, cb),
|
||||||
(cb) => touchContact(this.user_id, this.contact_id_2, cb),
|
cb => touchContact(this.user_id, this.contact_id_2, cb),
|
||||||
(cb) => touchContact(this.user_id, this.contact_id_2, cb),
|
cb => touchContact(this.user_id, this.contact_id_2, cb),
|
||||||
(cb) => touchContact(this.user_id, this.contact_id_3, cb)
|
cb => touchContact(this.user_id, this.contact_id_3, cb),
|
||||||
],
|
],
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
|
@ -81,14 +81,14 @@ describe('Getting Contacts', function () {
|
||||||
{
|
{
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: `${HOST}/user/${this.user_id}/contacts`,
|
url: `${HOST}/user/${this.user_id}/contacts`,
|
||||||
json: true
|
json: true,
|
||||||
},
|
},
|
||||||
(error, response, body) => {
|
(error, response, body) => {
|
||||||
response.statusCode.should.equal(200)
|
response.statusCode.should.equal(200)
|
||||||
body.contact_ids.should.deep.equal([
|
body.contact_ids.should.deep.equal([
|
||||||
this.contact_id_2,
|
this.contact_id_2,
|
||||||
this.contact_id_3,
|
this.contact_id_3,
|
||||||
this.contact_id_1
|
this.contact_id_1,
|
||||||
])
|
])
|
||||||
return done()
|
return done()
|
||||||
}
|
}
|
||||||
|
@ -100,13 +100,13 @@ describe('Getting Contacts', function () {
|
||||||
{
|
{
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: `${HOST}/user/${this.user_id}/contacts?limit=2`,
|
url: `${HOST}/user/${this.user_id}/contacts?limit=2`,
|
||||||
json: true
|
json: true,
|
||||||
},
|
},
|
||||||
(error, response, body) => {
|
(error, response, body) => {
|
||||||
response.statusCode.should.equal(200)
|
response.statusCode.should.equal(200)
|
||||||
body.contact_ids.should.deep.equal([
|
body.contact_ids.should.deep.equal([
|
||||||
this.contact_id_2,
|
this.contact_id_2,
|
||||||
this.contact_id_3
|
this.contact_id_3,
|
||||||
])
|
])
|
||||||
return done()
|
return done()
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ const SandboxedModule = require('sandboxed-module')
|
||||||
SandboxedModule.configure({
|
SandboxedModule.configure({
|
||||||
requires: {
|
requires: {
|
||||||
'logger-sharelatex': { log() {} },
|
'logger-sharelatex': { log() {} },
|
||||||
'@overleaf/metrics': { timeAsyncMethod() {} }
|
'@overleaf/metrics': { timeAsyncMethod() {} },
|
||||||
},
|
},
|
||||||
globals: { Buffer, console, process }
|
globals: { Buffer, console, process },
|
||||||
})
|
})
|
||||||
|
|
|
@ -25,9 +25,9 @@ describe('ContactManager', function () {
|
||||||
requires: {
|
requires: {
|
||||||
'./mongodb': {
|
'./mongodb': {
|
||||||
db: (this.db = { contacts: {} }),
|
db: (this.db = { contacts: {} }),
|
||||||
ObjectId
|
ObjectId,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
this.user_id = ObjectId().toString()
|
this.user_id = ObjectId().toString()
|
||||||
this.contact_id = ObjectId().toString()
|
this.contact_id = ObjectId().toString()
|
||||||
|
@ -57,19 +57,19 @@ describe('ContactManager', function () {
|
||||||
.calledWith(
|
.calledWith(
|
||||||
{
|
{
|
||||||
user_id: sinon.match(
|
user_id: sinon.match(
|
||||||
(o) => o.toString() === this.user_id.toString()
|
o => o.toString() === this.user_id.toString()
|
||||||
)
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
$inc: {
|
$inc: {
|
||||||
'contacts.mock_contact.n': 1
|
'contacts.mock_contact.n': 1,
|
||||||
},
|
},
|
||||||
$set: {
|
$set: {
|
||||||
'contacts.mock_contact.ts': new Date()
|
'contacts.mock_contact.ts': new Date(),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
upsert: true
|
upsert: true,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
|
@ -98,7 +98,7 @@ describe('ContactManager', function () {
|
||||||
return describe('getContacts', function () {
|
return describe('getContacts', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
this.user = {
|
this.user = {
|
||||||
contacts: ['mock', 'contacts']
|
contacts: ['mock', 'contacts'],
|
||||||
}
|
}
|
||||||
return (this.db.contacts.findOne = sinon
|
return (this.db.contacts.findOne = sinon
|
||||||
.stub()
|
.stub()
|
||||||
|
@ -113,9 +113,7 @@ describe('ContactManager', function () {
|
||||||
it("should find the user's contacts", function () {
|
it("should find the user's contacts", function () {
|
||||||
return this.db.contacts.findOne
|
return this.db.contacts.findOne
|
||||||
.calledWith({
|
.calledWith({
|
||||||
user_id: sinon.match(
|
user_id: sinon.match(o => o.toString() === this.user_id.toString()),
|
||||||
(o) => o.toString() === this.user_id.toString()
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
|
|
|
@ -21,8 +21,8 @@ describe('HttpController', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
this.HttpController = SandboxedModule.require(modulePath, {
|
this.HttpController = SandboxedModule.require(modulePath, {
|
||||||
requires: {
|
requires: {
|
||||||
'./ContactManager': (this.ContactManager = {})
|
'./ContactManager': (this.ContactManager = {}),
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
this.user_id = 'mock-user-id'
|
this.user_id = 'mock-user-id'
|
||||||
this.contact_id = 'mock-contact-id'
|
this.contact_id = 'mock-contact-id'
|
||||||
|
@ -87,7 +87,7 @@ describe('HttpController', function () {
|
||||||
this.contacts = {
|
this.contacts = {
|
||||||
'user-id-1': { n: 2, ts: new Date(now) },
|
'user-id-1': { n: 2, ts: new Date(now) },
|
||||||
'user-id-2': { n: 4, ts: new Date(now) },
|
'user-id-2': { n: 4, ts: new Date(now) },
|
||||||
'user-id-3': { n: 2, ts: new Date(now - 1000) }
|
'user-id-3': { n: 2, ts: new Date(now - 1000) },
|
||||||
}
|
}
|
||||||
return (this.ContactManager.getContacts = sinon
|
return (this.ContactManager.getContacts = sinon
|
||||||
.stub()
|
.stub()
|
||||||
|
@ -108,7 +108,7 @@ describe('HttpController', function () {
|
||||||
return it('should return a sorted list of contacts by count and timestamp', function () {
|
return it('should return a sorted list of contacts by count and timestamp', function () {
|
||||||
return this.res.send
|
return this.res.send
|
||||||
.calledWith({
|
.calledWith({
|
||||||
contact_ids: ['user-id-2', 'user-id-1', 'user-id-3']
|
contact_ids: ['user-id-2', 'user-id-1', 'user-id-3'],
|
||||||
})
|
})
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
|
@ -123,7 +123,7 @@ describe('HttpController', function () {
|
||||||
return it('should return the most commonly used contacts up to the limit', function () {
|
return it('should return the most commonly used contacts up to the limit', function () {
|
||||||
return this.res.send
|
return this.res.send
|
||||||
.calledWith({
|
.calledWith({
|
||||||
contact_ids: ['user-id-2', 'user-id-1']
|
contact_ids: ['user-id-2', 'user-id-1'],
|
||||||
})
|
})
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
|
@ -140,7 +140,7 @@ describe('HttpController', function () {
|
||||||
return it('should return an empty list', function () {
|
return it('should return an empty list', function () {
|
||||||
return this.res.send
|
return this.res.send
|
||||||
.calledWith({
|
.calledWith({
|
||||||
contact_ids: []
|
contact_ids: [],
|
||||||
})
|
})
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue