-
-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test inserting edit events into the thread timeline "on demand" #3410
Test inserting edit events into the thread timeline "on demand" #3410
Conversation
While attempting to test a new change, I discovered that the test "should allow edits to be added to thread timeline" did not actually fail if its assertions failed. Further, those assertions were incorrect. So this change fixes the test to create the thread, wait for it to be initialised, and then add events to it. This simplifies the flow and ensures the test fails if something unexpected happens.
Modifies fetchEditsWhereNeeded to allow edits of threaded messages. The code before prevented any relations from fetching edits, but of course events in threads are relations. We definitely want thread messages to get their edits fetched, and I assume this is working in the real code, probably because the event being looked at is some kind of eventmapped thing that doesn't have proper relations visible on it. In tests, if we don't make this change, we can't see edits getting fetched.
This test demonstrates the current behaviour, which contains a bug - we don't actually add the right event to the timeline.
I suggest we bypass the coverage check since this change adds a test, so can't be bad :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, I hit the button after reading only the first commit, but just a small comment anyways
@@ -510,6 +510,45 @@ describe("Thread", () => { | |||
// And the first message has been edited | |||
expect(secondLastEvent.getContent().body).toEqual("edit"); | |||
}); | |||
|
|||
it("Adds edits fetched on demand to the thread timeline and applies them", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it("Adds edits fetched on demand to the thread timeline and applies them", async () => { | |
it("applies edits fetched on demand", async () => { |
I'd be more comfortable if this test's title were honest about what it's really testing at the moment ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please forgive me for not doing this.. I promise I'll merge #3398 very very soon.
It was going to topple my tower of PRs :-)
Force merging because the coverage check is not relevant a change that is pure tests. |
I suggest reviewing commit by commit.
The main point of this change is to get a test in place that will allow us to fix a bug we inserted in #3384 where we added the wrong event to the timeline. This change doesn't fix the bug, but does add a test we can use to validate the fix later.
In order to do this, I had to fix a small problem where fetchEditsWhenNeeded ignored threaded messages. I assume they are not ignored in production, but I am not at all sure. Maybe I've misunderstood what this line of code is for:
Part of element-hq/element-web#10954
This change is marked as an internal change (Task), so will not be included in the changelog.