You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2026-01-03 23:22:30 +03:00
Better fallback for the event localTimestamp calculation. (#3900)
* better fallback to localTimestamp calculation Signed-off-by: Timo K <toger5@hotmail.de> * make `isExpired` impl simpler to read Signed-off-by: Timo K <toger5@hotmail.de> * update tests Signed-off-by: Timo K <toger5@hotmail.de> * refactor to use localTimestamp in the mocks Signed-off-by: Timo K <toger5@hotmail.de> * Update src/models/event.ts Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Update src/models/event.ts Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Update and clarify comments. So that the localTimestamp and localAge behavior is easier to understand. Signed-off-by: Timo K <toger5@hotmail.de> * Replace localTimestamp biding with binding the whole roomState Signed-off-by: Timo K <toger5@hotmail.de> --------- Signed-off-by: Timo K <toger5@hotmail.de> Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
@@ -85,7 +85,7 @@ describe("CallMembership", () => {
|
||||
|
||||
it("considers memberships expired when local age large", () => {
|
||||
const fakeEvent = makeMockEvent(1000);
|
||||
fakeEvent.getLocalAge = jest.fn().mockReturnValue(6000);
|
||||
fakeEvent.localTimestamp = Date.now() - 6000;
|
||||
const membership = new CallMembership(fakeEvent, membershipTemplate);
|
||||
expect(membership.isExpired()).toEqual(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user