From ea82dad657f398ec730fc893e82cf8cbb026cba6 Mon Sep 17 00:00:00 2001 From: Matheus Barbosa Silva <36537004+matheusbsilva137@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:55:56 -0300 Subject: [PATCH] regression: Fix `teams.listAll` end-to-end tests (#32586) --- apps/meteor/tests/end-to-end/api/25-teams.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/meteor/tests/end-to-end/api/25-teams.js b/apps/meteor/tests/end-to-end/api/25-teams.js index 2d6bfc7cd6841..1ec550e2f6466 100644 --- a/apps/meteor/tests/end-to-end/api/25-teams.js +++ b/apps/meteor/tests/end-to-end/api/25-teams.js @@ -560,18 +560,17 @@ describe('[Teams]', () => { }); describe('/teams.listAll', () => { + let teamName; before(async () => { await updatePermission('view-all-teams', ['admin']); - const teamName = `test-team-${Date.now()}`; + teamName = `test-team-${Date.now()}`; await request.post(api('teams.create')).set(credentials).send({ name: teamName, type: 0, }); }); - after(async () => { - return updatePermission('view-all-teams', ['admin']); - }); + after(() => Promise.all([deleteTeam(credentials, teamName), updatePermission('view-all-teams', ['admin'])])); it('should list all teams', async () => { await request @@ -585,7 +584,7 @@ describe('[Teams]', () => { expect(res.body).to.have.property('offset', 0); expect(res.body).to.have.property('total'); expect(res.body).to.have.property('teams'); - expect(res.body.teams).to.have.length.greaterThan(1); + expect(res.body.teams).to.be.an('array').that.is.not.empty; expect(res.body.teams[0]).to.include.property('_id'); expect(res.body.teams[0]).to.include.property('_updatedAt'); expect(res.body.teams[0]).to.include.property('name');