Skip to content

Commit

Permalink
Chore: Add end-to-end tests to teams listing in the directory endpo…
Browse files Browse the repository at this point in the history
…int (#26347)
  • Loading branch information
carlosrodrigues94 authored Aug 2, 2022
1 parent 0343424 commit f00b83e
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions apps/meteor/tests/end-to-end/api/00-miscellaneous.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,66 @@ describe('miscellaneous', function () {
})
.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]', () => {
let user;
Expand Down

0 comments on commit f00b83e

Please sign in to comment.