@@ -18,7 +18,6 @@ import MockHttpBackend from "matrix-mock-request";
1818
1919import { MAIN_ROOM_TIMELINE , ReceiptType } from "../../src/@types/read_receipts" ;
2020import { MatrixClient } from "../../src/client" ;
21- import { Feature , ServerSupport } from "../../src/feature" ;
2221import { EventType } from "../../src/matrix" ;
2322import { synthesizeReceipt } from "../../src/models/read-receipt" ;
2423import { encodeUri } from "../../src/utils" ;
@@ -70,10 +69,6 @@ const roomEvent = utils.mkEvent({
7069 } ,
7170} ) ;
7271
73- function mockServerSideSupport ( client : MatrixClient , serverSideSupport : ServerSupport ) {
74- client . canSupport . set ( Feature . ThreadUnreadNotifications , serverSideSupport ) ;
75- }
76-
7772describe ( "Read receipt" , ( ) => {
7873 beforeEach ( ( ) => {
7974 httpBackend = new MockHttpBackend ( ) ;
@@ -101,7 +96,6 @@ describe("Read receipt", () => {
10196 } )
10297 . respond ( 200 , { } ) ;
10398
104- mockServerSideSupport ( client , ServerSupport . Stable ) ;
10599 client . sendReceipt ( threadEvent , ReceiptType . Read , { } ) ;
106100
107101 await httpBackend . flushAllExpected ( ) ;
@@ -123,7 +117,6 @@ describe("Read receipt", () => {
123117 } )
124118 . respond ( 200 , { } ) ;
125119
126- mockServerSideSupport ( client , ServerSupport . Stable ) ;
127120 client . sendReadReceipt ( threadEvent , ReceiptType . Read , true ) ;
128121
129122 await httpBackend . flushAllExpected ( ) ;
@@ -145,56 +138,11 @@ describe("Read receipt", () => {
145138 } )
146139 . respond ( 200 , { } ) ;
147140
148- mockServerSideSupport ( client , ServerSupport . Stable ) ;
149141 client . sendReceipt ( roomEvent , ReceiptType . Read , { } ) ;
150142
151143 await httpBackend . flushAllExpected ( ) ;
152144 await flushPromises ( ) ;
153145 } ) ;
154-
155- it ( "sends a room read receipt when there's no server support" , async ( ) => {
156- httpBackend
157- . when (
158- "POST" ,
159- encodeUri ( "/rooms/$roomId/receipt/$receiptType/$eventId" , {
160- $roomId : ROOM_ID ,
161- $receiptType : ReceiptType . Read ,
162- $eventId : threadEvent . getId ( ) ! ,
163- } ) ,
164- )
165- . check ( ( request ) => {
166- expect ( request . data . thread_id ) . toBeUndefined ( ) ;
167- } )
168- . respond ( 200 , { } ) ;
169-
170- mockServerSideSupport ( client , ServerSupport . Unsupported ) ;
171- client . sendReceipt ( threadEvent , ReceiptType . Read , { } ) ;
172-
173- await httpBackend . flushAllExpected ( ) ;
174- await flushPromises ( ) ;
175- } ) ;
176-
177- it ( "sends a valid room read receipt even when body omitted" , async ( ) => {
178- httpBackend
179- . when (
180- "POST" ,
181- encodeUri ( "/rooms/$roomId/receipt/$receiptType/$eventId" , {
182- $roomId : ROOM_ID ,
183- $receiptType : ReceiptType . Read ,
184- $eventId : threadEvent . getId ( ) ! ,
185- } ) ,
186- )
187- . check ( ( request ) => {
188- expect ( request . data ) . toEqual ( { } ) ;
189- } )
190- . respond ( 200 , { } ) ;
191-
192- mockServerSideSupport ( client , ServerSupport . Unsupported ) ;
193- client . sendReceipt ( threadEvent , ReceiptType . Read , undefined ) ;
194-
195- await httpBackend . flushAllExpected ( ) ;
196- await flushPromises ( ) ;
197- } ) ;
198146 } ) ;
199147
200148 describe ( "synthesizeReceipt" , ( ) => {
0 commit comments