Skip to content

Commit

Permalink
test: make api teams test fully independent (#31756)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcosSpessatto authored May 27, 2024
1 parent 957ccf8 commit 88d3114
Show file tree
Hide file tree
Showing 5 changed files with 317 additions and 276 deletions.
1 change: 1 addition & 0 deletions apps/meteor/tests/end-to-end/api/00-miscellaneous.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ describe('miscellaneous', function () {
deleteTeam(normalUserCredentials, teamName),
deleteUser(user),
deleteRoom({ type: 'c', roomId: testChannel._id }),
updatePermission('create-team', ['admin', 'user']),
]);
});

Expand Down
16 changes: 1 addition & 15 deletions apps/meteor/tests/end-to-end/api/01-users.js
Original file line number Diff line number Diff line change
Expand Up @@ -3837,21 +3837,7 @@ describe('[Users]', function () {
.then(() => done());
});

after(() =>
Promise.all([
[teamName1, teamName2].map((team) =>
request
.post(api('teams.delete'))
.set(credentials)
.send({
teamName: team,
})
.expect('Content-Type', 'application/json')
.expect(200),
),
deleteUser(testUser),
]),
);
after(() => Promise.all([...[teamName1, teamName2].map((team) => deleteTeam(credentials, team)), deleteUser(testUser)]));

it('should list both channels', (done) => {
request
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/tests/end-to-end/api/02-channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { CI_MAX_ROOMS_PER_GUEST as maxRoomsPerGuest } from '../../data/constants
import { createIntegration, removeIntegration } from '../../data/integration.helper';
import { updatePermission, updateSetting } from '../../data/permissions.helper';
import { createRoom, deleteRoom } from '../../data/rooms.helper';
import { deleteTeam } from '../../data/teams.helper';
import { testFileUploads } from '../../data/uploads.helper';
import { adminUsername, password } from '../../data/user';
import { createUser, login, deleteUser } from '../../data/users.helper';
Expand Down Expand Up @@ -2036,7 +2037,7 @@ describe('[Channels]', function () {
await Promise.all([
updatePermission('create-team', ['admin', 'user']),
updatePermission('edit-room', ['admin', 'owner', 'moderator']),
deleteRoom({ type: 'c', roomId: testChannel._id }),
deleteTeam(credentials, testChannel.name),
]);
});

Expand Down
12 changes: 2 additions & 10 deletions apps/meteor/tests/end-to-end/api/03-groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { CI_MAX_ROOMS_PER_GUEST as maxRoomsPerGuest } from '../../data/constants
import { createIntegration, removeIntegration } from '../../data/integration.helper';
import { updatePermission, updateSetting } from '../../data/permissions.helper';
import { createRoom } from '../../data/rooms.helper';
import { deleteTeam } from '../../data/teams.helper';
import { testFileUploads } from '../../data/uploads.helper';
import { adminUsername, password } from '../../data/user';
import { createUser, login, deleteUser } from '../../data/users.helper';
Expand Down Expand Up @@ -1952,16 +1953,7 @@ describe('[Groups]', function () {
});
});

after(async () => {
await request
.post(api('groups.delete'))
.set(credentials)
.send({
roomName: newGroup.name,
})
.expect('Content-Type', 'application/json')
.expect(200);
});
after(() => Promise.all([deleteTeam(credentials, newGroup.name), updatePermission('create-team', ['admin', 'user'])]));

it('should fail to convert group if lacking edit-room permission', (done) => {
updatePermission('create-team', []).then(() => {
Expand Down
Loading

0 comments on commit 88d3114

Please sign in to comment.