|
|
|
|
@ -2,6 +2,7 @@ import { expect } from 'chai'; |
|
|
|
|
|
|
|
|
|
import { getCredentials, api, login, request, credentials } from '../../data/api-data.js'; |
|
|
|
|
import { updateSetting } from '../../data/permissions.helper'; |
|
|
|
|
import { createRoom } from '../../data/rooms.helper'; |
|
|
|
|
import { adminEmail, adminUsername, adminPassword, password } from '../../data/user'; |
|
|
|
|
import { createUser, login as doLogin } from '../../data/users.helper'; |
|
|
|
|
import { IS_EE } from '../../e2e/config/constants'; |
|
|
|
|
@ -215,7 +216,7 @@ describe('miscellaneous', function () { |
|
|
|
|
.end(done); |
|
|
|
|
user = undefined; |
|
|
|
|
}); |
|
|
|
|
it('create an channel', (done) => { |
|
|
|
|
it('create a channel', (done) => { |
|
|
|
|
request |
|
|
|
|
.post(api('channels.create')) |
|
|
|
|
.set(credentials) |
|
|
|
|
@ -488,17 +489,25 @@ describe('miscellaneous', function () { |
|
|
|
|
}) |
|
|
|
|
.end(done); |
|
|
|
|
}); |
|
|
|
|
after((done) => { |
|
|
|
|
request |
|
|
|
|
.post(api('users.delete')) |
|
|
|
|
.set(credentials) |
|
|
|
|
.send({ |
|
|
|
|
userId: user._id, |
|
|
|
|
let testChannelSpecialChars; |
|
|
|
|
const fnameSpecialCharsRoom = `test ГДΕληνικά`; |
|
|
|
|
before((done) => { |
|
|
|
|
updateSetting('UI_Allow_room_names_with_special_chars', true) |
|
|
|
|
.then(() => { |
|
|
|
|
createRoom({ type: 'c', name: fnameSpecialCharsRoom, credentials: userCredentials }).end((err, res) => { |
|
|
|
|
testChannelSpecialChars = res.body.channel; |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.end(done); |
|
|
|
|
.then(done); |
|
|
|
|
}); |
|
|
|
|
after(async () => { |
|
|
|
|
await request.post(api('users.delete')).set(credentials).send({ |
|
|
|
|
userId: user._id, |
|
|
|
|
}); |
|
|
|
|
user = undefined; |
|
|
|
|
await updateSetting('UI_Allow_room_names_with_special_chars', false); |
|
|
|
|
}); |
|
|
|
|
it('create an channel', (done) => { |
|
|
|
|
it('create a channel', (done) => { |
|
|
|
|
request |
|
|
|
|
.post(api('channels.create')) |
|
|
|
|
.set(userCredentials) |
|
|
|
|
@ -591,6 +600,25 @@ describe('miscellaneous', function () { |
|
|
|
|
}) |
|
|
|
|
.end(done); |
|
|
|
|
}); |
|
|
|
|
it('must return rooms when searching for a valid fname', (done) => { |
|
|
|
|
request |
|
|
|
|
.get(api('spotlight')) |
|
|
|
|
.query({ |
|
|
|
|
query: `#${fnameSpecialCharsRoom}`, |
|
|
|
|
}) |
|
|
|
|
.set(credentials) |
|
|
|
|
.expect('Content-Type', 'application/json') |
|
|
|
|
.expect(200) |
|
|
|
|
.expect((res) => { |
|
|
|
|
expect(res.body).to.have.property('success', true); |
|
|
|
|
expect(res.body).to.have.property('users').and.to.be.an('array'); |
|
|
|
|
expect(res.body).to.have.property('rooms').and.to.be.an('array'); |
|
|
|
|
expect(res.body.rooms[0]).to.have.property('_id', testChannelSpecialChars._id); |
|
|
|
|
expect(res.body.rooms[0]).to.have.property('name', testChannelSpecialChars.name); |
|
|
|
|
expect(res.body.rooms[0]).to.have.property('t', testChannelSpecialChars.t); |
|
|
|
|
}) |
|
|
|
|
.end(done); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
describe('[/instances.get]', () => { |
|
|
|
|
|