Skip to content

Commit 1ad50d9

Browse files
sampaiodiegoricardogarim
authored andcommitted
move beforeAll to individual tests
1 parent 3a17d35 commit 1ad50d9

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

ee/packages/federation-matrix/tests/end-to-end/room.spec.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,10 @@ import { SynapseClient } from '../helper/synapse-client';
401401
});
402402

403403
describe('Add 2 or more federated users in the creation modal', () => {
404-
let channelName: string;
404+
const channelName = `federated-channel-multi-${Date.now()}`;
405405
let federatedChannel: any;
406406

407-
beforeAll(async () => {
408-
channelName = `federated-channel-multi-${Date.now()}`;
409-
407+
it('should create the room', async () => {
410408
// Create room with both federated users
411409
const createResponse = await createRoom({
412410
type: 'p',
@@ -427,19 +425,18 @@ import { SynapseClient } from '../helper/synapse-client';
427425
expect(federatedChannel).toHaveProperty('federated', true);
428426
expect(federatedChannel).toHaveProperty('federation');
429427
expect((federatedChannel as any).federation).toHaveProperty('version', 1);
428+
});
430429

430+
it('should accept invitation for the first user', async () => {
431431
// Accept invitations for both users
432432
const acceptedRoomId1 = await hs1AdminApp.acceptInvitationForRoomName(channelName);
433433
expect(acceptedRoomId1).not.toBe('');
434+
});
434435

436+
it('should accept invitation for the second user', async () => {
435437
const acceptedRoomId2 = await hs1User1App.acceptInvitationForRoomName(channelName);
436438
expect(acceptedRoomId2).not.toBe('');
437-
438-
// TODO: Figure out why syncing events are not working and uncomment this when we get the state change from
439-
// invite to join
440-
// const joinedRoomId = await this.hs1App.getRoomIdByRoomNameAndMembership(channelName, KnownMembership.Join);
441-
// expect(acceptedRoomId, 'Expected to have joined the room, but joinedRoomId is different from acceptedRoomId').to.equal(joinedRoomId);
442-
}, 15000);
439+
});
443440

444441
it('It should show the room on all the involved remote Element or RC', async () => {
445442
// RC view: Check in RC
@@ -1563,14 +1560,18 @@ import { SynapseClient } from '../helper/synapse-client';
15631560
// RC view: Admin tries to accept rc1User1's invitation
15641561
const response = await acceptRoomInvite(federatedChannel._id, rc1AdminRequestConfig);
15651562
expect(response.success).toBe(false);
1566-
expect(response.error).toBe('Failed to handle invite: No subscription found or user does not have permission to accept or reject this invite');
1563+
expect(response.error).toBe(
1564+
'Failed to handle invite: No subscription found or user does not have permission to accept or reject this invite',
1565+
);
15671566
});
15681567

15691568
it('It should not allow admin to reject invitation on behalf of another user', async () => {
15701569
// RC view: Admin tries to reject rc1User1's invitation
15711570
const response = await rejectRoomInvite(federatedChannel._id, rc1AdminRequestConfig);
15721571
expect(response.success).toBe(false);
1573-
expect(response.error).toBe('Failed to handle invite: No subscription found or user does not have permission to accept or reject this invite');
1572+
expect(response.error).toBe(
1573+
'Failed to handle invite: No subscription found or user does not have permission to accept or reject this invite',
1574+
);
15741575
});
15751576
});
15761577
});

0 commit comments

Comments
 (0)