Skip to content

Commit 3e288b2

Browse files
committed
move beforeAll to individual tests
1 parent d851eeb commit 3e288b2

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

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

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,10 @@ import { SynapseClient } from '../helper/synapse-client';
403403
});
404404

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

409-
beforeAll(async () => {
410-
channelName = `federated-channel-multi-${Date.now()}`;
411-
409+
it('should create the room', async () => {
412410
// Create room with both federated users
413411
const createResponse = await createRoom({
414412
type: 'p',
@@ -429,19 +427,25 @@ import { SynapseClient } from '../helper/synapse-client';
429427
expect(federatedChannel).toHaveProperty('federated', true);
430428
expect(federatedChannel).toHaveProperty('federation');
431429
expect((federatedChannel as any).federation).toHaveProperty('version', 1);
430+
});
432431

432+
it('should accept invitation for the first user', async () => {
433433
// Accept invitations for both users
434434
const acceptedRoomId1 = await hs1AdminApp.acceptInvitationForRoomName(channelName);
435435
expect(acceptedRoomId1).not.toBe('');
436+
});
436437

438+
it('should accept invitation for the second user', async () => {
437439
const acceptedRoomId2 = await hs1User1App.acceptInvitationForRoomName(channelName);
438440
expect(acceptedRoomId2).not.toBe('');
441+
});
439442

440-
// TODO: Figure out why syncing events are not working and uncomment this when we get the state change from
441-
// invite to join
442-
// const joinedRoomId = await this.hs1App.getRoomIdByRoomNameAndMembership(channelName, KnownMembership.Join);
443-
// expect(acceptedRoomId, 'Expected to have joined the room, but joinedRoomId is different from acceptedRoomId').to.equal(joinedRoomId);
444-
}, 30000);
443+
// beforeAll(async () => {
444+
// // TODO: Figure out why syncing events are not working and uncomment this when we get the state change from
445+
// // invite to join
446+
// // const joinedRoomId = await this.hs1App.getRoomIdByRoomNameAndMembership(channelName, KnownMembership.Join);
447+
// // expect(acceptedRoomId, 'Expected to have joined the room, but joinedRoomId is different from acceptedRoomId').to.equal(joinedRoomId);
448+
// }, 30000);
445449

446450
it('It should show the room on all the involved remote Element or RC', async () => {
447451
// RC view: Check in RC
@@ -1565,14 +1569,18 @@ import { SynapseClient } from '../helper/synapse-client';
15651569
// RC view: Admin tries to accept rc1User1's invitation
15661570
const response = await acceptRoomInvite(federatedChannel._id, rc1AdminRequestConfig);
15671571
expect(response.success).toBe(false);
1568-
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+
);
15691575
});
15701576

15711577
it('It should not allow admin to reject invitation on behalf of another user', async () => {
15721578
// RC view: Admin tries to reject rc1User1's invitation
15731579
const response = await rejectRoomInvite(federatedChannel._id, rc1AdminRequestConfig);
15741580
expect(response.success).toBe(false);
1575-
expect(response.error).toBe('Failed to handle invite: No subscription found or user does not have permission to accept or reject this invite');
1581+
expect(response.error).toBe(
1582+
'Failed to handle invite: No subscription found or user does not have permission to accept or reject this invite',
1583+
);
15761584
});
15771585
});
15781586
});

0 commit comments

Comments
 (0)