Merge pull request #16186 from overleaf/mj-mongo-object-id
[web] Use constructor for ObjectId GitOrigin-RevId: 9eb8b377ea599605b72af237d1ab12f4d8287162
This commit is contained in:
committed by
Copybot
parent
0ac514f81b
commit
c371732e6e
@@ -12,9 +12,9 @@ const MODULE_PATH =
|
||||
describe('TpdsController', function () {
|
||||
beforeEach(function () {
|
||||
this.metadata = {
|
||||
projectId: ObjectId(),
|
||||
entityId: ObjectId(),
|
||||
folderId: ObjectId(),
|
||||
projectId: new ObjectId(),
|
||||
entityId: new ObjectId(),
|
||||
folderId: new ObjectId(),
|
||||
entityType: 'doc',
|
||||
rev: 2,
|
||||
}
|
||||
@@ -46,7 +46,7 @@ describe('TpdsController', function () {
|
||||
conflict: sinon.stub(),
|
||||
}
|
||||
|
||||
this.newProject = { _id: ObjectId() }
|
||||
this.newProject = { _id: new ObjectId() }
|
||||
this.ProjectCreationHandler = {
|
||||
promises: { createBlankProject: sinon.stub().resolves(this.newProject) },
|
||||
}
|
||||
@@ -291,10 +291,10 @@ describe('TpdsController', function () {
|
||||
|
||||
it("creates a folder if it doesn't exist", function (done) {
|
||||
const metadata = {
|
||||
folderId: ObjectId(),
|
||||
projectId: ObjectId(),
|
||||
folderId: new ObjectId(),
|
||||
projectId: new ObjectId(),
|
||||
path: '/def/ghi.txt',
|
||||
parentFolderId: ObjectId(),
|
||||
parentFolderId: new ObjectId(),
|
||||
}
|
||||
this.TpdsUpdateHandler.promises.createFolder.resolves(metadata)
|
||||
this.res.json.callsFake(body => {
|
||||
@@ -311,8 +311,8 @@ describe('TpdsController', function () {
|
||||
|
||||
it('supports top level folders', function (done) {
|
||||
const metadata = {
|
||||
folderId: ObjectId(),
|
||||
projectId: ObjectId(),
|
||||
folderId: new ObjectId(),
|
||||
projectId: new ObjectId(),
|
||||
path: '/',
|
||||
parentFolderId: null,
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ const MODULE_PATH =
|
||||
|
||||
describe('TpdsProjectFlusher', function () {
|
||||
beforeEach(function () {
|
||||
this.project = { _id: ObjectId() }
|
||||
this.folder = { _id: ObjectId() }
|
||||
this.project = { _id: new ObjectId() }
|
||||
this.folder = { _id: new ObjectId() }
|
||||
this.docs = {
|
||||
'/doc/one': {
|
||||
_id: 'mock-doc-1',
|
||||
|
||||
@@ -38,8 +38,8 @@ describe('TpdsUpdateHandler', function () {
|
||||
this.update = {}
|
||||
this.folderPath = '/some/folder'
|
||||
this.folder = {
|
||||
_id: ObjectId(),
|
||||
parentFolder_id: ObjectId(),
|
||||
_id: new ObjectId(),
|
||||
parentFolder_id: new ObjectId(),
|
||||
}
|
||||
|
||||
this.CooldownManager = {
|
||||
@@ -125,7 +125,7 @@ describe('TpdsUpdateHandler', function () {
|
||||
describe('byId', function () {
|
||||
describe('with no matching project', function () {
|
||||
beforeEach(function () {
|
||||
this.projectId = ObjectId().toString()
|
||||
this.projectId = new ObjectId().toString()
|
||||
})
|
||||
receiveUpdateById()
|
||||
expectProjectNotCreated()
|
||||
@@ -222,7 +222,7 @@ describe('TpdsUpdateHandler', function () {
|
||||
describe('byId', function () {
|
||||
describe('with no matching project', function () {
|
||||
beforeEach(function () {
|
||||
this.projectId = ObjectId().toString()
|
||||
this.projectId = new ObjectId().toString()
|
||||
})
|
||||
receiveFileDeleteById()
|
||||
expectDeleteNotProcessed()
|
||||
|
||||
@@ -10,9 +10,9 @@ const modulePath = path.join(
|
||||
)
|
||||
|
||||
const projectId = 'project_id_here'
|
||||
const userId = ObjectId()
|
||||
const readOnlyRef = ObjectId()
|
||||
const collaberatorRef = ObjectId()
|
||||
const userId = new ObjectId()
|
||||
const readOnlyRef = new ObjectId()
|
||||
const collaberatorRef = new ObjectId()
|
||||
const projectName = 'project_name_here'
|
||||
|
||||
const thirdPartyDataStoreApiUrl = 'http://third-party-json-store.herokuapp.com'
|
||||
|
||||
@@ -48,17 +48,17 @@ describe('UpdateMerger :', function () {
|
||||
}
|
||||
|
||||
this.doc = {
|
||||
_id: ObjectId(),
|
||||
_id: new ObjectId(),
|
||||
rev: 2,
|
||||
}
|
||||
|
||||
this.file = {
|
||||
_id: ObjectId(),
|
||||
_id: new ObjectId(),
|
||||
rev: 6,
|
||||
}
|
||||
|
||||
this.folder = {
|
||||
_id: ObjectId(),
|
||||
_id: new ObjectId(),
|
||||
}
|
||||
|
||||
this.EditorController = {
|
||||
|
||||
Reference in New Issue
Block a user