mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #15261 from overleaf/csh-issue-11625-mongo-ug-5-chat
Upgrade mongodb module for chat from 4.11.0 to 6.1.0 GitOrigin-RevId: d4ce72b093fd09638a575a14f8945c8cb9ec7f3d
This commit is contained in:
parent
781a827e05
commit
b3b02941c7
11 changed files with 123 additions and 116 deletions
141
package-lock.json
generated
141
package-lock.json
generated
|
@ -6030,7 +6030,6 @@
|
|||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.0.tgz",
|
||||
"integrity": "sha512-Xfijy7HvfzzqiOAhAepF4SGN5e9leLkMvg/OPOF97XemjfVCYN/oWa75wnkc6mltMSTwY+XlbhWgUOJmkFspSw==",
|
||||
"devOptional": true,
|
||||
"dependencies": {
|
||||
"sparse-bitfield": "^3.0.3"
|
||||
}
|
||||
|
@ -32173,8 +32172,7 @@
|
|||
"node_modules/memory-pager": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
|
||||
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
|
||||
"devOptional": true
|
||||
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg=="
|
||||
},
|
||||
"node_modules/mensch": {
|
||||
"version": "0.3.4",
|
||||
|
@ -38353,7 +38351,6 @@
|
|||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
|
||||
"integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=",
|
||||
"devOptional": true,
|
||||
"dependencies": {
|
||||
"memory-pager": "^1.0.2"
|
||||
}
|
||||
|
@ -42104,7 +42101,7 @@
|
|||
"body-parser": "^1.19.0",
|
||||
"exegesis-express": "^4.0.0",
|
||||
"express": "^4.18.2",
|
||||
"mongodb": "^4.11.0"
|
||||
"mongodb": "^6.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"acorn": "^7.1.1",
|
||||
|
@ -42124,54 +42121,70 @@
|
|||
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
|
||||
},
|
||||
"services/chat/node_modules/bson": {
|
||||
"version": "4.7.2",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-4.7.2.tgz",
|
||||
"integrity": "sha512-Ry9wCtIZ5kGqkJoi6aD8KjxFZEx78guTQDnpXWiNthsxzrxAK/i8E6pCHAIZTbaEFWcOCvbecMukfK7XUvyLpQ==",
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-6.1.0.tgz",
|
||||
"integrity": "sha512-yiQ3KxvpVoRpx1oD1uPz4Jit9tAVTJgjdmjDKtUErkOoL9VNoF8Dd58qtAOL5E40exx2jvAT9sqdRSK/r+SHlA==",
|
||||
"engines": {
|
||||
"node": ">=16.20.1"
|
||||
}
|
||||
},
|
||||
"services/chat/node_modules/gcp-metadata": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-5.3.0.tgz",
|
||||
"integrity": "sha512-FNTkdNEnBdlqF2oatizolQqNANMrcqJt6AAYt99B3y1aLLC8Hc5IOBb+ZnnzllodEEf6xMBp6wRcBbc16fa65w==",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"buffer": "^5.6.0"
|
||||
"gaxios": "^5.0.0",
|
||||
"json-bigint": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"services/chat/node_modules/buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"services/chat/node_modules/mongodb": {
|
||||
"version": "4.17.1",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.17.1.tgz",
|
||||
"integrity": "sha512-MBuyYiPUPRTqfH2dV0ya4dcr2E5N52ocBuZ8Sgg/M030nGF78v855B3Z27mZJnp8PxjnUquEnAtjOsphgMZOlQ==",
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.1.0.tgz",
|
||||
"integrity": "sha512-AvzNY0zMkpothZ5mJAaIo2bGDjlJQqqAbn9fvtVgwIIUPEfdrqGxqNjjbuKyrgQxg2EvCmfWdjq+4uj96c0YPw==",
|
||||
"dependencies": {
|
||||
"bson": "^4.7.2",
|
||||
"mongodb-connection-string-url": "^2.6.0",
|
||||
"socks": "^2.7.1"
|
||||
"@mongodb-js/saslprep": "^1.1.0",
|
||||
"bson": "^6.1.0",
|
||||
"mongodb-connection-string-url": "^2.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.9.0"
|
||||
"node": ">=16.20.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@aws-sdk/credential-providers": "^3.186.0",
|
||||
"@mongodb-js/saslprep": "^1.1.0"
|
||||
"peerDependencies": {
|
||||
"@aws-sdk/credential-providers": "^3.188.0",
|
||||
"@mongodb-js/zstd": "^1.1.0",
|
||||
"gcp-metadata": "^5.2.0",
|
||||
"kerberos": "^2.0.1",
|
||||
"mongodb-client-encryption": ">=6.0.0 <7",
|
||||
"snappy": "^7.2.2",
|
||||
"socks": "^2.7.1"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@aws-sdk/credential-providers": {
|
||||
"optional": true
|
||||
},
|
||||
"@mongodb-js/zstd": {
|
||||
"optional": true
|
||||
},
|
||||
"gcp-metadata": {
|
||||
"optional": true
|
||||
},
|
||||
"kerberos": {
|
||||
"optional": true
|
||||
},
|
||||
"mongodb-client-encryption": {
|
||||
"optional": true
|
||||
},
|
||||
"snappy": {
|
||||
"optional": true
|
||||
},
|
||||
"socks": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"services/clsi": {
|
||||
|
@ -49508,7 +49521,6 @@
|
|||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.0.tgz",
|
||||
"integrity": "sha512-Xfijy7HvfzzqiOAhAepF4SGN5e9leLkMvg/OPOF97XemjfVCYN/oWa75wnkc6mltMSTwY+XlbhWgUOJmkFspSw==",
|
||||
"devOptional": true,
|
||||
"requires": {
|
||||
"sparse-bitfield": "^3.0.3"
|
||||
}
|
||||
|
@ -50775,7 +50787,7 @@
|
|||
"exegesis-express": "^4.0.0",
|
||||
"express": "^4.18.2",
|
||||
"mocha": "^10.2.0",
|
||||
"mongodb": "^4.11.0",
|
||||
"mongodb": "^6.1.0",
|
||||
"request": "^2.88.2",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
|
@ -50788,32 +50800,29 @@
|
|||
"integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
|
||||
},
|
||||
"bson": {
|
||||
"version": "4.7.2",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-4.7.2.tgz",
|
||||
"integrity": "sha512-Ry9wCtIZ5kGqkJoi6aD8KjxFZEx78guTQDnpXWiNthsxzrxAK/i8E6pCHAIZTbaEFWcOCvbecMukfK7XUvyLpQ==",
|
||||
"requires": {
|
||||
"buffer": "^5.6.0"
|
||||
}
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-6.1.0.tgz",
|
||||
"integrity": "sha512-yiQ3KxvpVoRpx1oD1uPz4Jit9tAVTJgjdmjDKtUErkOoL9VNoF8Dd58qtAOL5E40exx2jvAT9sqdRSK/r+SHlA=="
|
||||
},
|
||||
"buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"gcp-metadata": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-5.3.0.tgz",
|
||||
"integrity": "sha512-FNTkdNEnBdlqF2oatizolQqNANMrcqJt6AAYt99B3y1aLLC8Hc5IOBb+ZnnzllodEEf6xMBp6wRcBbc16fa65w==",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
"gaxios": "^5.0.0",
|
||||
"json-bigint": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"mongodb": {
|
||||
"version": "4.17.1",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.17.1.tgz",
|
||||
"integrity": "sha512-MBuyYiPUPRTqfH2dV0ya4dcr2E5N52ocBuZ8Sgg/M030nGF78v855B3Z27mZJnp8PxjnUquEnAtjOsphgMZOlQ==",
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.1.0.tgz",
|
||||
"integrity": "sha512-AvzNY0zMkpothZ5mJAaIo2bGDjlJQqqAbn9fvtVgwIIUPEfdrqGxqNjjbuKyrgQxg2EvCmfWdjq+4uj96c0YPw==",
|
||||
"requires": {
|
||||
"@aws-sdk/credential-providers": "^3.186.0",
|
||||
"@mongodb-js/saslprep": "^1.1.0",
|
||||
"bson": "^4.7.2",
|
||||
"mongodb-connection-string-url": "^2.6.0",
|
||||
"socks": "^2.7.1"
|
||||
"bson": "^6.1.0",
|
||||
"mongodb-connection-string-url": "^2.6.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71374,8 +71383,7 @@
|
|||
"memory-pager": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
|
||||
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
|
||||
"devOptional": true
|
||||
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg=="
|
||||
},
|
||||
"mensch": {
|
||||
"version": "0.3.4",
|
||||
|
@ -76290,7 +76298,6 @@
|
|||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
|
||||
"integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=",
|
||||
"devOptional": true,
|
||||
"requires": {
|
||||
"memory-pager": "^1.0.2"
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ export async function updateMessage(
|
|||
room_id: roomId,
|
||||
})
|
||||
if (userId) {
|
||||
query.user_id = ObjectId(userId)
|
||||
query.user_id = new ObjectId(userId)
|
||||
}
|
||||
const res = await db.messages.updateOne(query, {
|
||||
$set: {
|
||||
|
@ -75,13 +75,13 @@ export async function deleteMessage(roomId, messageId) {
|
|||
|
||||
function _ensureIdsAreObjectIds(query) {
|
||||
if (query.user_id && !(query.user_id instanceof ObjectId)) {
|
||||
query.user_id = ObjectId(query.user_id)
|
||||
query.user_id = new ObjectId(query.user_id)
|
||||
}
|
||||
if (query.room_id && !(query.room_id instanceof ObjectId)) {
|
||||
query.room_id = ObjectId(query.room_id)
|
||||
query.room_id = new ObjectId(query.room_id)
|
||||
}
|
||||
if (query._id && !(query._id instanceof ObjectId)) {
|
||||
query._id = ObjectId(query._id)
|
||||
query._id = new ObjectId(query._id)
|
||||
}
|
||||
return query
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ export const GLOBAL_THREAD = 'GLOBAL'
|
|||
|
||||
export async function findOrCreateThread(projectId, threadId) {
|
||||
let query, update
|
||||
projectId = ObjectId(projectId.toString())
|
||||
projectId = new ObjectId(projectId.toString())
|
||||
if (threadId !== GLOBAL_THREAD) {
|
||||
threadId = ObjectId(threadId.toString())
|
||||
threadId = new ObjectId(threadId.toString())
|
||||
}
|
||||
|
||||
if (threadId === GLOBAL_THREAD) {
|
||||
|
@ -33,14 +33,14 @@ export async function findOrCreateThread(projectId, threadId) {
|
|||
{ $set: update },
|
||||
{ upsert: true, returnDocument: 'after' }
|
||||
)
|
||||
return result.value
|
||||
return result
|
||||
}
|
||||
|
||||
export async function findAllThreadRooms(projectId) {
|
||||
return db.rooms
|
||||
.find(
|
||||
{
|
||||
project_id: ObjectId(projectId.toString()),
|
||||
project_id: new ObjectId(projectId.toString()),
|
||||
thread_id: { $exists: true },
|
||||
},
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ export async function findAllThreadRoomsAndGlobalThread(projectId) {
|
|||
return db.rooms
|
||||
.find(
|
||||
{
|
||||
project_id: ObjectId(projectId.toString()),
|
||||
project_id: new ObjectId(projectId.toString()),
|
||||
},
|
||||
{
|
||||
thread_id: 1,
|
||||
|
@ -68,8 +68,8 @@ export async function findAllThreadRoomsAndGlobalThread(projectId) {
|
|||
export async function resolveThread(projectId, threadId, userId) {
|
||||
await db.rooms.updateOne(
|
||||
{
|
||||
project_id: ObjectId(projectId.toString()),
|
||||
thread_id: ObjectId(threadId.toString()),
|
||||
project_id: new ObjectId(projectId.toString()),
|
||||
thread_id: new ObjectId(threadId.toString()),
|
||||
},
|
||||
{
|
||||
$set: {
|
||||
|
@ -85,8 +85,8 @@ export async function resolveThread(projectId, threadId, userId) {
|
|||
export async function reopenThread(projectId, threadId) {
|
||||
await db.rooms.updateOne(
|
||||
{
|
||||
project_id: ObjectId(projectId.toString()),
|
||||
thread_id: ObjectId(threadId.toString()),
|
||||
project_id: new ObjectId(projectId.toString()),
|
||||
thread_id: new ObjectId(threadId.toString()),
|
||||
},
|
||||
{
|
||||
$unset: {
|
||||
|
@ -106,6 +106,6 @@ export async function deleteThread(projectId, threadId) {
|
|||
|
||||
export async function deleteAllThreadsInProject(projectId) {
|
||||
await db.rooms.deleteMany({
|
||||
project_id: ObjectId(projectId.toString()),
|
||||
project_id: new ObjectId(projectId.toString()),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"body-parser": "^1.19.0",
|
||||
"exegesis-express": "^4.0.0",
|
||||
"express": "^4.18.2",
|
||||
"mongodb": "^4.11.0"
|
||||
"mongodb": "^6.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"acorn": "^7.1.1",
|
||||
|
|
|
@ -5,9 +5,9 @@ import * as ChatClient from './helpers/ChatClient.js'
|
|||
import * as ChatApp from './helpers/ChatApp.js'
|
||||
|
||||
describe('Deleting a message', async function () {
|
||||
const projectId = ObjectId().toString()
|
||||
const userId = ObjectId().toString()
|
||||
const threadId = ObjectId().toString()
|
||||
const projectId = new ObjectId().toString()
|
||||
const userId = new ObjectId().toString()
|
||||
const threadId = new ObjectId().toString()
|
||||
|
||||
before(async function () {
|
||||
await ChatApp.ensureRunning()
|
||||
|
|
|
@ -5,14 +5,14 @@ import * as ChatClient from './helpers/ChatClient.js'
|
|||
import * as ChatApp from './helpers/ChatApp.js'
|
||||
|
||||
describe('Deleting a thread', async function () {
|
||||
const projectId = ObjectId().toString()
|
||||
const userId = ObjectId().toString()
|
||||
const projectId = new ObjectId().toString()
|
||||
const userId = new ObjectId().toString()
|
||||
before(async function () {
|
||||
await ChatApp.ensureRunning()
|
||||
})
|
||||
|
||||
describe('with a thread that is deleted', async function () {
|
||||
const threadId = ObjectId().toString()
|
||||
const threadId = new ObjectId().toString()
|
||||
const content = 'deleted thread message'
|
||||
before(async function () {
|
||||
const { response } = await ChatClient.sendMessage(
|
||||
|
|
|
@ -8,19 +8,19 @@ const db = ChatApp.db
|
|||
|
||||
async function getMessage(messageId) {
|
||||
return await db.messages.findOne({
|
||||
_id: ObjectId(messageId),
|
||||
_id: new ObjectId(messageId),
|
||||
})
|
||||
}
|
||||
|
||||
describe('Destroying a project', async function () {
|
||||
const projectId = ObjectId().toString()
|
||||
const userId = ObjectId().toString()
|
||||
const projectId = new ObjectId().toString()
|
||||
const userId = new ObjectId().toString()
|
||||
before(async function () {
|
||||
await ChatApp.ensureRunning()
|
||||
})
|
||||
|
||||
describe('with a project that has threads and messages', async function () {
|
||||
const threadId = ObjectId().toString()
|
||||
const threadId = new ObjectId().toString()
|
||||
before(async function () {
|
||||
const { response } = await ChatClient.sendMessage(
|
||||
projectId,
|
||||
|
@ -39,7 +39,7 @@ describe('Destroying a project', async function () {
|
|||
this.globalThreadMessageId = response2.body.id
|
||||
|
||||
const threadRooms = await db.rooms
|
||||
.find({ project_id: ObjectId(projectId) })
|
||||
.find({ project_id: new ObjectId(projectId) })
|
||||
.toArray()
|
||||
expect(threadRooms.length).to.equal(2)
|
||||
const threadMessage = await getMessage(this.threadMessageId)
|
||||
|
@ -55,7 +55,7 @@ describe('Destroying a project', async function () {
|
|||
|
||||
it('should remove the messages and threads from the database', async function () {
|
||||
const threadRooms = await db.rooms
|
||||
.find({ project_id: ObjectId(projectId) })
|
||||
.find({ project_id: new ObjectId(projectId) })
|
||||
.toArray()
|
||||
expect(threadRooms.length).to.equal(0)
|
||||
const threadMessage = await getMessage(this.threadMessageId)
|
||||
|
|
|
@ -15,9 +15,9 @@ describe('Editing a message', async function () {
|
|||
const newContent = 'updated thread message'
|
||||
let messageId
|
||||
beforeEach(async function () {
|
||||
projectId = ObjectId().toString()
|
||||
userId = ObjectId().toString()
|
||||
threadId = ObjectId().toString()
|
||||
projectId = new ObjectId().toString()
|
||||
userId = new ObjectId().toString()
|
||||
threadId = new ObjectId().toString()
|
||||
|
||||
const { response, body: message } = await ChatClient.sendMessage(
|
||||
projectId,
|
||||
|
@ -80,7 +80,7 @@ describe('Editing a message', async function () {
|
|||
projectId,
|
||||
threadId,
|
||||
messageId,
|
||||
ObjectId(),
|
||||
new ObjectId(),
|
||||
newContent
|
||||
)
|
||||
expect(response.statusCode).to.equal(404)
|
||||
|
|
|
@ -15,8 +15,8 @@ async function getCount() {
|
|||
}
|
||||
|
||||
describe('Getting messages', async function () {
|
||||
const userId1 = ObjectId().toString()
|
||||
const userId2 = ObjectId().toString()
|
||||
const userId1 = new ObjectId().toString()
|
||||
const userId2 = new ObjectId().toString()
|
||||
const content1 = 'foo bar'
|
||||
const content2 = 'hello world'
|
||||
before(async function () {
|
||||
|
@ -24,7 +24,7 @@ describe('Getting messages', async function () {
|
|||
})
|
||||
|
||||
describe('globally', async function () {
|
||||
const projectId = ObjectId().toString()
|
||||
const projectId = new ObjectId().toString()
|
||||
before(async function () {
|
||||
const previousCount = await getCount()
|
||||
const { response } = await ChatClient.sendGlobalMessage(
|
||||
|
@ -60,9 +60,9 @@ describe('Getting messages', async function () {
|
|||
})
|
||||
|
||||
describe('from all the threads', async function () {
|
||||
const projectId = ObjectId().toString()
|
||||
const threadId1 = ObjectId().toString()
|
||||
const threadId2 = ObjectId().toString()
|
||||
const projectId = new ObjectId().toString()
|
||||
const threadId1 = new ObjectId().toString()
|
||||
const threadId2 = new ObjectId().toString()
|
||||
|
||||
before(async function () {
|
||||
const { response } = await ChatClient.sendMessage(
|
||||
|
|
|
@ -5,14 +5,14 @@ import * as ChatClient from './helpers/ChatClient.js'
|
|||
import * as ChatApp from './helpers/ChatApp.js'
|
||||
|
||||
describe('Resolving a thread', async function () {
|
||||
const projectId = ObjectId().toString()
|
||||
const userId = ObjectId().toString()
|
||||
const projectId = new ObjectId().toString()
|
||||
const userId = new ObjectId().toString()
|
||||
before(async function () {
|
||||
await ChatApp.ensureRunning()
|
||||
})
|
||||
|
||||
describe('with a resolved thread', async function () {
|
||||
const threadId = ObjectId().toString()
|
||||
const threadId = new ObjectId().toString()
|
||||
const content = 'resolved message'
|
||||
before(async function () {
|
||||
const { response } = await ChatClient.sendMessage(
|
||||
|
@ -41,7 +41,7 @@ describe('Resolving a thread', async function () {
|
|||
})
|
||||
|
||||
describe('when a thread is not resolved', async function () {
|
||||
const threadId = ObjectId().toString()
|
||||
const threadId = new ObjectId().toString()
|
||||
const content = 'open message'
|
||||
before(async function () {
|
||||
const { response } = await ChatClient.sendMessage(
|
||||
|
@ -61,7 +61,7 @@ describe('Resolving a thread', async function () {
|
|||
})
|
||||
|
||||
describe('when a thread is resolved then reopened', async function () {
|
||||
const threadId = ObjectId().toString()
|
||||
const threadId = new ObjectId().toString()
|
||||
const content = 'resolved message'
|
||||
before(async function () {
|
||||
const { response } = await ChatClient.sendMessage(
|
||||
|
|
|
@ -10,8 +10,8 @@ describe('Sending a message', async function () {
|
|||
})
|
||||
|
||||
describe('globally', async function () {
|
||||
const projectId = ObjectId().toString()
|
||||
const userId = ObjectId().toString()
|
||||
const projectId = new ObjectId().toString()
|
||||
const userId = new ObjectId().toString()
|
||||
const content = 'global message'
|
||||
before(async function () {
|
||||
const { response, body } = await ChatClient.sendGlobalMessage(
|
||||
|
@ -36,9 +36,9 @@ describe('Sending a message', async function () {
|
|||
})
|
||||
|
||||
describe('to a thread', async function () {
|
||||
const projectId = ObjectId().toString()
|
||||
const userId = ObjectId().toString()
|
||||
const threadId = ObjectId().toString()
|
||||
const projectId = new ObjectId().toString()
|
||||
const userId = new ObjectId().toString()
|
||||
const threadId = new ObjectId().toString()
|
||||
const content = 'thread message'
|
||||
before(async function () {
|
||||
const { response, body } = await ChatClient.sendMessage(
|
||||
|
@ -70,9 +70,9 @@ describe('Sending a message', async function () {
|
|||
})
|
||||
|
||||
describe('failure cases', async function () {
|
||||
const projectId = ObjectId().toString()
|
||||
const userId = ObjectId().toString()
|
||||
const threadId = ObjectId().toString()
|
||||
const projectId = new ObjectId().toString()
|
||||
const userId = new ObjectId().toString()
|
||||
const threadId = new ObjectId().toString()
|
||||
|
||||
describe('with a malformed userId', async function () {
|
||||
it('should return a graceful error', async function () {
|
||||
|
|
Loading…
Reference in a new issue