From 15080edfa7b00b899e63dc8fc6f491453efb1055 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 5 May 2021 17:47:46 +0200 Subject: [PATCH] fix failing test now we don't remove invite from collection anymore here --- src/matrix/room/Invite.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/matrix/room/Invite.js b/src/matrix/room/Invite.js index 0c8601b4..ec173f50 100644 --- a/src/matrix/room/Invite.js +++ b/src/matrix/room/Invite.js @@ -325,28 +325,25 @@ export function tests() { assert.equal(invite.inviter.displayName, "Alice"); assert.equal(invite.inviter.avatarUrl, aliceAvatarUrl); }, - "syncing with membership from invite removes the invite": async assert => { - let removedEmitted = false; + "syncing join sets accepted": async assert => { + let changeEmitCount = 0; const invite = new Invite({ roomId, platform: {clock: new MockClock(1003)}, user: {id: "@bob:hs.tld"}, - emitCollectionRemove: emittingInvite => { - assert.equal(emittingInvite, invite); - removedEmitted = true; - } }); + invite.on("change", () => { changeEmitCount += 1; }); const txn = createStorage(); const changes = await invite.writeSync("invite", dmInviteFixture, txn, new NullLogItem()); assert.equal(txn.invitesMap.get(roomId).roomId, roomId); invite.afterSync(changes); const joinChanges = await invite.writeSync("join", null, txn, new NullLogItem()); - assert(!removedEmitted); + assert.strictEqual(changeEmitCount, 0); invite.afterSync(joinChanges); + assert.strictEqual(changeEmitCount, 1); assert.equal(txn.invitesMap.get(roomId), undefined); assert.equal(invite.rejected, false); assert.equal(invite.accepted, true); - assert(removedEmitted); } } }