From d0c1ddb51b41c23d234bdb0af7a4a4cf527ef48f Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 26 Aug 2021 15:16:51 +0200 Subject: [PATCH] add failing test --- src/matrix/room/timeline/persistence/MemberWriter.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/matrix/room/timeline/persistence/MemberWriter.js b/src/matrix/room/timeline/persistence/MemberWriter.js index db649f68..3d35ff47 100644 --- a/src/matrix/room/timeline/persistence/MemberWriter.js +++ b/src/matrix/room/timeline/persistence/MemberWriter.js @@ -243,6 +243,17 @@ export function tests() { assert.equal(change.member.membership, "join"); assert.equal(txn.members.get(alice).displayName, "Alice"); }, + "new join through both timeline and state": async assert => { + const writer = new MemberWriter(roomId); + const txn = createStorage(); + const aliceJoin = createMemberEvent("join", alice, "Alice"); + const change = await writer.writeStateMemberEvent(aliceJoin, false, txn); + assert(!change.hasJoined); + assert(!change.hasLeft); + const timelineChange = await writer.writeTimelineMemberEvent(aliceJoin, txn); + assert(change.hasJoined); + assert(!change.hasLeft); + }, "newly joined member causes a change with lookup done first": async assert => { const event = createMemberEvent("join", alice, "Alice"); const writer = new MemberWriter(roomId);