Skip to content

Commit 3ebfc38

Browse files
test: add end-to-end tests for rejecting an invitation from Synapse
1 parent 50f76bd commit 3ebfc38

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,5 +1620,39 @@ import { SynapseClient } from '../helper/synapse-client';
16201620
});
16211621
});
16221622
});
1623+
1624+
describe('Rejecting an invitation from Synapse', () => {
1625+
let matrixRoomId: string;
1626+
let channelName: string;
1627+
let rid: string;
1628+
1629+
beforeAll(async () => {
1630+
channelName = `federated-channel-reject-from-synapse-${Date.now()}`;
1631+
matrixRoomId = await hs1AdminApp.createRoom(channelName);
1632+
1633+
await hs1AdminApp.matrixClient.invite(matrixRoomId, federationConfig.rc1.adminMatrixUserId);
1634+
1635+
const subscriptions = await getSubscriptions(rc1AdminRequestConfig);
1636+
1637+
const pendingInvitation = subscriptions.update.find((subscription) => subscription.status === 'INVITED');
1638+
1639+
expect(pendingInvitation).not.toBeUndefined();
1640+
1641+
rid = pendingInvitation?.rid!;
1642+
}, 15000);
1643+
1644+
it('It should allow RC user to reject the invite', async () => {
1645+
const rejectResponse = await rejectRoomInvite(rid, rc1AdminRequestConfig);
1646+
expect(rejectResponse.success).toBe(true);
1647+
});
1648+
1649+
it.failing('It should remove the subscription after rejection', async () => {
1650+
const subscriptions = await getSubscriptions(rc1AdminRequestConfig);
1651+
1652+
const invitedSub = subscriptions.update.find((sub) => sub.fname?.includes(channelName));
1653+
1654+
expect(invitedSub).toBeFalsy();
1655+
});
1656+
});
16231657
});
16241658
});

0 commit comments

Comments
 (0)