Skip to content
Snippets Groups Projects
Unverified Commit f00b83e8 authored by Carlos Rodrigues's avatar Carlos Rodrigues Committed by GitHub
Browse files

Chore: Add end-to-end tests to teams listing in the `directory` endpoint (#26347)

parent 03434244
No related branches found
No related tags found
No related merge requests found
...@@ -389,6 +389,66 @@ describe('miscellaneous', function () { ...@@ -389,6 +389,66 @@ describe('miscellaneous', function () {
}) })
.end(done); .end(done);
}); });
const teamName = `new-team-name-${Date.now()}`;
let teamCreated = {};
before((done) => {
request
.post(api('teams.create'))
.set(credentials)
.send({
name: teamName,
type: 0,
})
.expect((res) => {
teamCreated = res.body.team;
})
.end(done);
});
after((done) => {
request
.post(api('teams.delete'))
.set(credentials)
.send({
teamName,
})
.end(done);
});
it('should return an object containing rooms and totalCount from teams', (done) => {
request
.get(api('directory'))
.set(credentials)
.query({
query: JSON.stringify({
text: '',
type: 'teams',
}),
sort: JSON.stringify({
name: 1,
}),
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('result');
expect(res.body.result).to.be.an(`array`);
expect(res.body).to.have.property('total', 1);
expect(res.body.total).to.be.an('number');
expect(res.body.result[0]).to.have.property('_id', teamCreated.roomId);
expect(res.body.result[0]).to.have.property('fname');
expect(res.body.result[0]).to.have.property('teamMain');
expect(res.body.result[0]).to.have.property('name');
expect(res.body.result[0]).to.have.property('t');
expect(res.body.result[0]).to.have.property('usersCount');
expect(res.body.result[0]).to.have.property('ts');
expect(res.body.result[0]).to.have.property('teamId');
expect(res.body.result[0]).to.have.property('default');
expect(res.body.result[0]).to.have.property('roomsCount');
})
.end(done);
});
}); });
describe('[/spotlight]', () => { describe('[/spotlight]', () => {
let user; let user;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment