mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-11 04:27:40 +01:00
fix failing test now we don't remove invite from collection anymore here
This commit is contained in:
parent
45837f7377
commit
15080edfa7
@ -325,28 +325,25 @@ export function tests() {
|
|||||||
assert.equal(invite.inviter.displayName, "Alice");
|
assert.equal(invite.inviter.displayName, "Alice");
|
||||||
assert.equal(invite.inviter.avatarUrl, aliceAvatarUrl);
|
assert.equal(invite.inviter.avatarUrl, aliceAvatarUrl);
|
||||||
},
|
},
|
||||||
"syncing with membership from invite removes the invite": async assert => {
|
"syncing join sets accepted": async assert => {
|
||||||
let removedEmitted = false;
|
let changeEmitCount = 0;
|
||||||
const invite = new Invite({
|
const invite = new Invite({
|
||||||
roomId,
|
roomId,
|
||||||
platform: {clock: new MockClock(1003)},
|
platform: {clock: new MockClock(1003)},
|
||||||
user: {id: "@bob:hs.tld"},
|
user: {id: "@bob:hs.tld"},
|
||||||
emitCollectionRemove: emittingInvite => {
|
|
||||||
assert.equal(emittingInvite, invite);
|
|
||||||
removedEmitted = true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
invite.on("change", () => { changeEmitCount += 1; });
|
||||||
const txn = createStorage();
|
const txn = createStorage();
|
||||||
const changes = await invite.writeSync("invite", dmInviteFixture, txn, new NullLogItem());
|
const changes = await invite.writeSync("invite", dmInviteFixture, txn, new NullLogItem());
|
||||||
assert.equal(txn.invitesMap.get(roomId).roomId, roomId);
|
assert.equal(txn.invitesMap.get(roomId).roomId, roomId);
|
||||||
invite.afterSync(changes);
|
invite.afterSync(changes);
|
||||||
const joinChanges = await invite.writeSync("join", null, txn, new NullLogItem());
|
const joinChanges = await invite.writeSync("join", null, txn, new NullLogItem());
|
||||||
assert(!removedEmitted);
|
assert.strictEqual(changeEmitCount, 0);
|
||||||
invite.afterSync(joinChanges);
|
invite.afterSync(joinChanges);
|
||||||
|
assert.strictEqual(changeEmitCount, 1);
|
||||||
assert.equal(txn.invitesMap.get(roomId), undefined);
|
assert.equal(txn.invitesMap.get(roomId), undefined);
|
||||||
assert.equal(invite.rejected, false);
|
assert.equal(invite.rejected, false);
|
||||||
assert.equal(invite.accepted, true);
|
assert.equal(invite.accepted, true);
|
||||||
assert(removedEmitted);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user