mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-24 09:26:14 -04:00
lint and timeouts for chat.js
This commit is contained in:
parent
f4eeb59b86
commit
02bb5a5b73
1 changed files with 10 additions and 4 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
function m(mod) { return `${__dirname}/../../../../src/${mod}`; }
|
function m(mod) { return `${__dirname}/../../../../src/${mod}`; }
|
||||||
|
|
||||||
const common = require('../../common');
|
const common = require('../../common');
|
||||||
|
@ -53,7 +55,9 @@ describe(__filename, function () {
|
||||||
it('Creates an author with a name set', function (done) {
|
it('Creates an author with a name set', function (done) {
|
||||||
api.get(endPoint('createAuthor'))
|
api.get(endPoint('createAuthor'))
|
||||||
.expect((res) => {
|
.expect((res) => {
|
||||||
if (res.body.code !== 0 || !res.body.data.authorID) throw new Error('Unable to create author');
|
if (res.body.code !== 0 || !res.body.data.authorID) {
|
||||||
|
throw new Error('Unable to create author');
|
||||||
|
}
|
||||||
authorID = res.body.data.authorID; // we will be this author for the rest of the tests
|
authorID = res.body.data.authorID; // we will be this author for the rest of the tests
|
||||||
})
|
})
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
|
@ -75,7 +79,7 @@ describe(__filename, function () {
|
||||||
|
|
||||||
|
|
||||||
describe('getChatHead', function () {
|
describe('getChatHead', function () {
|
||||||
this.timeout(20);
|
this.timeout(100);
|
||||||
it('Gets the head of chat', function (done) {
|
it('Gets the head of chat', function (done) {
|
||||||
api.get(`${endPoint('getChatHead')}&padID=${padID}`)
|
api.get(`${endPoint('getChatHead')}&padID=${padID}`)
|
||||||
.expect((res) => {
|
.expect((res) => {
|
||||||
|
@ -93,7 +97,9 @@ describe(__filename, function () {
|
||||||
it('Gets Chat History of a Pad', function (done) {
|
it('Gets Chat History of a Pad', function (done) {
|
||||||
api.get(`${endPoint('getChatHistory')}&padID=${padID}`)
|
api.get(`${endPoint('getChatHistory')}&padID=${padID}`)
|
||||||
.expect((res) => {
|
.expect((res) => {
|
||||||
if (res.body.data.messages.length !== 1) throw new Error('Chat History Length is wrong');
|
if (res.body.data.messages.length !== 1) {
|
||||||
|
throw new Error('Chat History Length is wrong');
|
||||||
|
}
|
||||||
if (res.body.code !== 0) throw new Error('Unable to get chat history');
|
if (res.body.code !== 0) throw new Error('Unable to get chat history');
|
||||||
})
|
})
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
|
@ -102,7 +108,7 @@ describe(__filename, function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var endPoint = function (point) {
|
const endPoint = function (point) {
|
||||||
return `/api/${apiVersion}/${point}?apikey=${apiKey}`;
|
return `/api/${apiVersion}/${point}?apikey=${apiKey}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue