@@ -9,51 +9,52 @@ import (
9
9
)
10
10
11
11
// tests/10apidoc/37room-receipts.pl
12
- func TestRoomReceiptsReadMarkers (t * testing.T ) {
12
+
13
+ // sytest: POST /rooms/:room_id/receipt can create receipts
14
+ func TestRoomReceipts (t * testing.T ) {
15
+ deployment := Deploy (t , b .BlueprintAlice )
16
+ defer deployment .Destroy (t )
17
+
18
+ alice := deployment .Client (t , "hs1" , "@alice:hs1" )
19
+ roomID := alice .CreateRoom (t , map [string ]interface {}{"preset" : "public_chat" })
20
+
21
+ eventID := ""
22
+ alice .MustSyncUntil (t , client.SyncReq {}, client .SyncTimelineHas (roomID , func (result gjson.Result ) bool {
23
+ if result .Get ("type" ).Str == "m.room.member" {
24
+ eventID = result .Get ("event_id" ).Str
25
+ return true
26
+ }
27
+ return false
28
+ }))
29
+ if eventID == "" {
30
+ t .Fatal ("did not find an event_id" )
31
+ }
32
+ alice .MustDoFunc (t , "POST" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "receipt" , "m.read" , eventID }, client .WithJSONBody (t , struct {}{}))
33
+ }
34
+
35
+ // sytest: POST /rooms/:room_id/read_markers can create read marker
36
+ func TestRoomReadMarkers (t * testing.T ) {
13
37
deployment := Deploy (t , b .BlueprintAlice )
14
38
defer deployment .Destroy (t )
15
39
16
40
alice := deployment .Client (t , "hs1" , "@alice:hs1" )
17
41
roomID := alice .CreateRoom (t , map [string ]interface {}{"preset" : "public_chat" })
18
42
19
- // sytest: POST /rooms/:room_id/receipt can create receipts
20
- t .Run ("Parallel" , func (t * testing.T ) {
21
- t .Run ("POST /rooms/:room_id/receipt can create receipts" , func (t * testing.T ) {
22
- t .Parallel ()
23
- eventID := ""
24
- alice .MustSyncUntil (t , client.SyncReq {}, client .SyncTimelineHas (roomID , func (result gjson.Result ) bool {
25
- if result .Get ("type" ).Str == "m.room.member" {
26
- eventID = result .Get ("event_id" ).Str
27
- return true
28
- }
29
- return false
30
- }))
31
- if eventID == "" {
32
- t .Fatal ("did not find an event_id" )
33
- }
34
- alice .MustDoFunc (t , "POST" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "receipt" , "m.read" , eventID }, client .WithJSONBody (t , struct {}{}))
35
- })
36
-
37
- // sytest: POST /rooms/:room_id/read_markers can create read marker
38
- t .Run ("POST /rooms/:room_id/read_markers can create read marker" , func (t * testing.T ) {
39
- t .Parallel ()
40
- eventID := ""
41
- alice .MustSyncUntil (t , client.SyncReq {}, client .SyncTimelineHas (roomID , func (result gjson.Result ) bool {
42
- if result .Get ("type" ).Str == "m.room.member" {
43
- eventID = result .Get ("event_id" ).Str
44
- return true
45
- }
46
- return false
47
- }))
48
- if eventID == "" {
49
- t .Fatal ("did not find an event_id" )
50
- }
51
-
52
- reqBody := client .WithJSONBody (t , map [string ]interface {}{
53
- "m.fully_read" : eventID ,
54
- "m.read" : eventID ,
55
- })
56
- alice .MustDoFunc (t , "POST" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "read_markers" }, reqBody )
57
- })
43
+ eventID := ""
44
+ alice .MustSyncUntil (t , client.SyncReq {}, client .SyncTimelineHas (roomID , func (result gjson.Result ) bool {
45
+ if result .Get ("type" ).Str == "m.room.member" {
46
+ eventID = result .Get ("event_id" ).Str
47
+ return true
48
+ }
49
+ return false
50
+ }))
51
+ if eventID == "" {
52
+ t .Fatal ("did not find an event_id" )
53
+ }
54
+
55
+ reqBody := client .WithJSONBody (t , map [string ]interface {}{
56
+ "m.fully_read" : eventID ,
57
+ "m.read" : eventID ,
58
58
})
59
+ alice .MustDoFunc (t , "POST" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "read_markers" }, reqBody )
59
60
}
0 commit comments