mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[misc] migrate acceptance tests to the native mongo driver, drop mongojs
This commit is contained in:
parent
c630cbb4e3
commit
9dddf59a9d
11 changed files with 123 additions and 732 deletions
|
@ -1,13 +0,0 @@
|
||||||
// TODO: This file was created by bulk-decaffeinate.
|
|
||||||
// Sanity-check the conversion and remove this comment.
|
|
||||||
const Settings = require('settings-sharelatex')
|
|
||||||
const mongojs = require('mongojs')
|
|
||||||
const db = mongojs(Settings.mongo.url, [
|
|
||||||
'docHistory',
|
|
||||||
'projectHistoryMetaData',
|
|
||||||
'docHistoryIndex'
|
|
||||||
])
|
|
||||||
module.exports = {
|
|
||||||
db,
|
|
||||||
ObjectId: mongojs.ObjectId
|
|
||||||
}
|
|
805
services/track-changes/package-lock.json
generated
805
services/track-changes/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -31,7 +31,6 @@
|
||||||
"metrics-sharelatex": "^2.6.2",
|
"metrics-sharelatex": "^2.6.2",
|
||||||
"mongo-uri": "^0.1.2",
|
"mongo-uri": "^0.1.2",
|
||||||
"mongodb": "^3.6.0",
|
"mongodb": "^3.6.0",
|
||||||
"mongojs": "3.1.0",
|
|
||||||
"redis": "~0.10.1",
|
"redis": "~0.10.1",
|
||||||
"redis-sharelatex": "^1.0.13",
|
"redis-sharelatex": "^1.0.13",
|
||||||
"request": "~2.88.2",
|
"request": "~2.88.2",
|
||||||
|
|
|
@ -14,8 +14,7 @@ const sinon = require('sinon')
|
||||||
const chai = require('chai')
|
const chai = require('chai')
|
||||||
chai.should()
|
chai.should()
|
||||||
const { expect } = chai
|
const { expect } = chai
|
||||||
const mongojs = require('../../../app/js/mongojs')
|
const { ObjectId } = require('../../../app/js/mongodb')
|
||||||
const { ObjectId } = mongojs
|
|
||||||
const Settings = require('settings-sharelatex')
|
const Settings = require('settings-sharelatex')
|
||||||
const request = require('request')
|
const request = require('request')
|
||||||
const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now
|
const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now
|
||||||
|
|
|
@ -18,9 +18,7 @@ const sinon = require('sinon')
|
||||||
const chai = require('chai')
|
const chai = require('chai')
|
||||||
chai.should()
|
chai.should()
|
||||||
const { expect } = chai
|
const { expect } = chai
|
||||||
const mongojs = require('../../../app/js/mongojs')
|
const { db, ObjectId } = require('../../../app/js/mongodb')
|
||||||
const { db } = mongojs
|
|
||||||
const { ObjectId } = mongojs
|
|
||||||
const Settings = require('settings-sharelatex')
|
const Settings = require('settings-sharelatex')
|
||||||
const request = require('request')
|
const request = require('request')
|
||||||
const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now
|
const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now
|
||||||
|
@ -126,7 +124,7 @@ describe('Archiving updates', function () {
|
||||||
|
|
||||||
after(function (done) {
|
after(function (done) {
|
||||||
MockWebApi.getUserInfo.restore()
|
MockWebApi.getUserInfo.restore()
|
||||||
return db.docHistory.remove(
|
return db.docHistory.deleteMany(
|
||||||
{ project_id: ObjectId(this.project_id) },
|
{ project_id: ObjectId(this.project_id) },
|
||||||
() => {
|
() => {
|
||||||
return db.docHistoryIndex.remove(
|
return db.docHistoryIndex.remove(
|
||||||
|
@ -172,7 +170,7 @@ describe('Archiving updates', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should have one remaining pack after cache is expired', function (done) {
|
it('should have one remaining pack after cache is expired', function (done) {
|
||||||
return db.docHistory.remove(
|
return db.docHistory.deleteMany(
|
||||||
{
|
{
|
||||||
doc_id: ObjectId(this.doc_id),
|
doc_id: ObjectId(this.doc_id),
|
||||||
expiresAt: { $exists: true }
|
expiresAt: { $exists: true }
|
||||||
|
|
|
@ -14,8 +14,7 @@ const sinon = require('sinon')
|
||||||
const chai = require('chai')
|
const chai = require('chai')
|
||||||
chai.should()
|
chai.should()
|
||||||
const { expect } = chai
|
const { expect } = chai
|
||||||
const mongojs = require('../../../app/js/mongojs')
|
const { ObjectId } = require('../../../app/js/mongodb')
|
||||||
const { ObjectId } = mongojs
|
|
||||||
const Settings = require('settings-sharelatex')
|
const Settings = require('settings-sharelatex')
|
||||||
const request = require('request')
|
const request = require('request')
|
||||||
const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now
|
const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now
|
||||||
|
|
|
@ -13,9 +13,7 @@ const sinon = require('sinon')
|
||||||
const chai = require('chai')
|
const chai = require('chai')
|
||||||
chai.should()
|
chai.should()
|
||||||
const { expect } = chai
|
const { expect } = chai
|
||||||
const mongojs = require('../../../app/js/mongojs')
|
const { ObjectId } = require('../../../app/js/mongodb')
|
||||||
const { db } = mongojs
|
|
||||||
const { ObjectId } = mongojs
|
|
||||||
const Settings = require('settings-sharelatex')
|
const Settings = require('settings-sharelatex')
|
||||||
|
|
||||||
const TrackChangesApp = require('./helpers/TrackChangesApp')
|
const TrackChangesApp = require('./helpers/TrackChangesApp')
|
||||||
|
|
|
@ -14,9 +14,7 @@ const sinon = require('sinon')
|
||||||
const chai = require('chai')
|
const chai = require('chai')
|
||||||
chai.should()
|
chai.should()
|
||||||
const { expect } = chai
|
const { expect } = chai
|
||||||
const mongojs = require('../../../app/js/mongojs')
|
const { ObjectId } = require('../../../app/js/mongodb')
|
||||||
const { db } = mongojs
|
|
||||||
const { ObjectId } = mongojs
|
|
||||||
const Settings = require('settings-sharelatex')
|
const Settings = require('settings-sharelatex')
|
||||||
|
|
||||||
const TrackChangesApp = require('./helpers/TrackChangesApp')
|
const TrackChangesApp = require('./helpers/TrackChangesApp')
|
||||||
|
|
|
@ -13,8 +13,6 @@ const sinon = require('sinon')
|
||||||
const chai = require('chai')
|
const chai = require('chai')
|
||||||
chai.should()
|
chai.should()
|
||||||
const { expect } = chai
|
const { expect } = chai
|
||||||
const mongojs = require('../../../app/js/mongojs')
|
|
||||||
const { ObjectId } = mongojs
|
|
||||||
const Settings = require('settings-sharelatex')
|
const Settings = require('settings-sharelatex')
|
||||||
const LockManager = require('../../../app/js/LockManager')
|
const LockManager = require('../../../app/js/LockManager')
|
||||||
const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now
|
const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now
|
||||||
|
|
|
@ -13,9 +13,7 @@ const sinon = require('sinon')
|
||||||
const chai = require('chai')
|
const chai = require('chai')
|
||||||
chai.should()
|
chai.should()
|
||||||
const { expect } = chai
|
const { expect } = chai
|
||||||
const mongojs = require('../../../app/js/mongojs')
|
const { ObjectId } = require('../../../app/js/mongodb')
|
||||||
const { db } = mongojs
|
|
||||||
const { ObjectId } = mongojs
|
|
||||||
const Settings = require('settings-sharelatex')
|
const Settings = require('settings-sharelatex')
|
||||||
|
|
||||||
const TrackChangesApp = require('./helpers/TrackChangesApp')
|
const TrackChangesApp = require('./helpers/TrackChangesApp')
|
||||||
|
|
|
@ -19,7 +19,7 @@ const request = require('request')
|
||||||
const Settings = require('settings-sharelatex')
|
const Settings = require('settings-sharelatex')
|
||||||
const rclient = require('redis-sharelatex').createClient(Settings.redis.history) // Only works locally for now
|
const rclient = require('redis-sharelatex').createClient(Settings.redis.history) // Only works locally for now
|
||||||
const Keys = Settings.redis.history.key_schema
|
const Keys = Settings.redis.history.key_schema
|
||||||
const { db, ObjectId } = require('../../../../app/js/mongojs')
|
const { db, ObjectId } = require('../../../../app/js/mongodb')
|
||||||
|
|
||||||
const aws = require('aws-sdk')
|
const aws = require('aws-sdk')
|
||||||
const s3 = new aws.S3({
|
const s3 = new aws.S3({
|
||||||
|
@ -87,11 +87,11 @@ module.exports = TrackChangesClient = {
|
||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
callback = function (error, updates) {}
|
callback = function (error, updates) {}
|
||||||
}
|
}
|
||||||
return db.projectHistoryMetaData.find(
|
return db.projectHistoryMetaData.findOne(
|
||||||
{
|
{
|
||||||
project_id: ObjectId(project_id)
|
project_id: ObjectId(project_id)
|
||||||
},
|
},
|
||||||
(error, projects) => callback(error, projects[0])
|
callback
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ module.exports = TrackChangesClient = {
|
||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
callback = function (error) {}
|
callback = function (error) {}
|
||||||
}
|
}
|
||||||
return db.projectHistoryMetaData.update(
|
return db.projectHistoryMetaData.updateOne(
|
||||||
{
|
{
|
||||||
project_id: ObjectId(project_id)
|
project_id: ObjectId(project_id)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue