From cdf15af8b4c2b773e7d98dd8ef7877ba5a6a7eab Mon Sep 17 00:00:00 2001 From: Rasmus Rendal Date: Wed, 21 Oct 2026 14:43:10 +0200 Subject: [PATCH 1/2] fix: set `avatar_url` in TestRoomState test Previously the test would expect `avatar_url` to be `null`, failing on tests where the `avatar_url` would be non-present when unset. Now we set an `avatar_url` to make sure that the key is set. Signed-off-by: Rasmus Rendal --- tests/csapi/apidoc_room_state_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/csapi/apidoc_room_state_test.go b/tests/csapi/apidoc_room_state_test.go index ff085efc3..2b0594e58 100644 --- a/tests/csapi/apidoc_room_state_test.go +++ b/tests/csapi/apidoc_room_state_test.go @@ -87,6 +87,13 @@ func TestRoomState(t *testing.T) { // sytest: GET /rooms/:room_id/joined_members fetches my membership t.Run("GET /rooms/:room_id/joined_members fetches my membership", func(t *testing.T) { t.Parallel() + + avatarURL := "mxc://example.com/SEsfnsuifSDFSSEF" + reqBody := client.WithJSONBody(t, map[string]interface{}{ + "avatar_url": avatarURL, + }) + authedClient.MustDo(t, "PUT", []string{"_matrix", "client", "v3", "profile", authedClient.UserID, "avatar_url"}, reqBody) + roomID := authedClient.MustCreateRoom(t, map[string]interface{}{ "visibility": "public", "preset": "public_chat", From 92d2d3f31849c2bbbf9ff3c1e1352340af476329 Mon Sep 17 00:00:00 2001 From: Rasmus Rendal Date: Tue, 27 Oct 2026 09:16:18 +0100 Subject: [PATCH 2/2] test(TestRoomState): Use JSONKeyEqual and JSONKeyTypeEqual in membership test We know the type and the entire key in these two cases, so we might as well test it. Signed-off-by: Rasmus Rendal --- tests/csapi/apidoc_room_state_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/csapi/apidoc_room_state_test.go b/tests/csapi/apidoc_room_state_test.go index 2b0594e58..5291e97de 100644 --- a/tests/csapi/apidoc_room_state_test.go +++ b/tests/csapi/apidoc_room_state_test.go @@ -104,8 +104,8 @@ func TestRoomState(t *testing.T) { JSON: []match.JSON{ match.JSONKeyPresent("joined"), match.JSONKeyPresent("joined." + authedClient.UserID), - match.JSONKeyPresent("joined." + authedClient.UserID + ".display_name"), - match.JSONKeyPresent("joined." + authedClient.UserID + ".avatar_url"), + match.JSONKeyTypeEqual("joined."+authedClient.UserID+".display_name", gjson.String), + match.JSONKeyEqual("joined."+authedClient.UserID+".avatar_url", avatarURL), }, }) })