Skip to content

Commit

Permalink
reduce amount of failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
justjanne committed Oct 21, 2022
1 parent 093d7cc commit e84b7ac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions spec/integ/matrix-client-event-timeline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ describe("MatrixClient event timelines", function() {
httpBackend.verifyNoOutstandingExpectation();
client.stopClient();
Thread.setServerSideSupport(FeatureSupport.None);
Thread.setServerSideListSupport(FeatureSupport.None);
Thread.setServerSideFwdPaginationSupport(FeatureSupport.None);
});

describe("getEventTimeline", function() {
Expand Down
10 changes: 5 additions & 5 deletions spec/integ/matrix-client-relations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe("MatrixClient relations", () => {

await httpBackend!.flushAllExpected();

expect(await response).toEqual({ "events": [], "nextBatch": "NEXT" });
expect(await response).toEqual({ "events": [], "nextBatch": "NEXT", "originalEvent": null, "prevBatch": null });
});

it("should read related events with relation type", async () => {
Expand All @@ -72,7 +72,7 @@ describe("MatrixClient relations", () => {

await httpBackend!.flushAllExpected();

expect(await response).toEqual({ "events": [], "nextBatch": "NEXT" });
expect(await response).toEqual({ "events": [], "nextBatch": "NEXT", "originalEvent": null, "prevBatch": null });
});

it("should read related events with relation type and event type", async () => {
Expand All @@ -87,7 +87,7 @@ describe("MatrixClient relations", () => {

await httpBackend!.flushAllExpected();

expect(await response).toEqual({ "events": [], "nextBatch": "NEXT" });
expect(await response).toEqual({ "events": [], "nextBatch": "NEXT", "originalEvent": null, "prevBatch": null });
});

it("should read related events with custom options", async () => {
Expand All @@ -107,7 +107,7 @@ describe("MatrixClient relations", () => {

await httpBackend!.flushAllExpected();

expect(await response).toEqual({ "events": [], "nextBatch": "NEXT" });
expect(await response).toEqual({ "events": [], "nextBatch": "NEXT", "originalEvent": null, "prevBatch": null });
});

it('should use default direction in the fetchRelations endpoint', async () => {
Expand All @@ -122,6 +122,6 @@ describe("MatrixClient relations", () => {

await httpBackend!.flushAllExpected();

expect(await response).toEqual({ "chunk": [], "next_batch": "NEXT" });
expect(await response).toEqual({ "chunk": [], "next_batch": "NEXT", "originalEvent": null, "prevBatch": null });
});
});
8 changes: 6 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5196,6 +5196,10 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa

const mapper = this.getEventMapper();
const event = mapper(res.event);
if (event.isRelation(THREAD_RELATION_TYPE.name)) {
logger.warn("Tried loading a regular timeline at the position of a thread event");
return undefined;
}
const events = [
// Order events from most recent to oldest (reverse-chronological).
// We start with the last event, since that's the point at which we have known state.
Expand Down Expand Up @@ -6957,8 +6961,8 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
return {
originalEvent: originalEvent ?? null,
events,
nextBatch: result.next_batch,
prevBatch: result.prev_batch,
nextBatch: result.next_batch ?? null,
prevBatch: result.prev_batch ?? null,
};
}

Expand Down

0 comments on commit e84b7ac

Please sign in to comment.