|
@@ -4,6 +4,16 @@ import { expect } from 'chai'
|
|
|
import * as ChatClient from './helpers/ChatClient.js'
|
|
import * as ChatClient from './helpers/ChatClient.js'
|
|
|
import * as ChatApp from './helpers/ChatApp.js'
|
|
import * as ChatApp from './helpers/ChatApp.js'
|
|
|
|
|
|
|
|
|
|
+async function getCount() {
|
|
|
|
|
+ return await ChatClient.getMetric(line => {
|
|
|
|
|
+ return (
|
|
|
|
|
+ line.includes('timer_http_request_count') &&
|
|
|
|
|
+ line.includes('path="project_{projectId}_messages"') &&
|
|
|
|
|
+ line.includes('method="POST"')
|
|
|
|
|
+ )
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
describe('Getting messages', async function () {
|
|
describe('Getting messages', async function () {
|
|
|
const userId1 = ObjectId().toString()
|
|
const userId1 = ObjectId().toString()
|
|
|
const userId2 = ObjectId().toString()
|
|
const userId2 = ObjectId().toString()
|
|
@@ -16,6 +26,7 @@ describe('Getting messages', async function () {
|
|
|
describe('globally', async function () {
|
|
describe('globally', async function () {
|
|
|
const projectId = ObjectId().toString()
|
|
const projectId = ObjectId().toString()
|
|
|
before(async function () {
|
|
before(async function () {
|
|
|
|
|
+ const previousCount = await getCount()
|
|
|
const { response } = await ChatClient.sendGlobalMessage(
|
|
const { response } = await ChatClient.sendGlobalMessage(
|
|
|
projectId,
|
|
projectId,
|
|
|
userId1,
|
|
userId1,
|
|
@@ -31,6 +42,7 @@ describe('Getting messages', async function () {
|
|
|
const { response: response3, body } = await ChatClient.checkStatus()
|
|
const { response: response3, body } = await ChatClient.checkStatus()
|
|
|
expect(response3.statusCode).to.equal(200)
|
|
expect(response3.statusCode).to.equal(200)
|
|
|
expect(body).to.equal('chat is alive')
|
|
expect(body).to.equal('chat is alive')
|
|
|
|
|
+ expect(await getCount()).to.equal(previousCount + 2)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should contain the messages and populated users when getting the messages', async function () {
|
|
it('should contain the messages and populated users when getting the messages', async function () {
|