@@ -85,141 +85,5 @@ describe("ReplyChain", () => {
85
85
"$qkjmFBTEc0VvfVyzq1CJuh1QZi_xDIgNEFjZ4Pq34og" ,
86
86
) ;
87
87
} ) ;
88
-
89
- it ( "retrieves relation reply from edit event when provided" , ( ) => {
90
- const originalEvent = testUtils . mkEvent ( {
91
- event : true ,
92
- type : "m.room.message" ,
93
- content : {
94
- msgtype : "m.text" ,
95
- body : "foo" ,
96
- } ,
97
- user : "some_other_user" ,
98
- room : "room_id" ,
99
- } ) ;
100
-
101
- const editEvent = testUtils . mkEvent ( {
102
- event : true ,
103
- type : "m.room.message" ,
104
- content : {
105
- "msgtype" : "m.text" ,
106
- "body" : "> Reply to this message\n\n * foo bar" ,
107
- "m.new_content" : {
108
- "msgtype" : "m.text" ,
109
- "body" : "foo bar" ,
110
- "m.relates_to" : {
111
- "m.in_reply_to" : {
112
- event_id : "$qkjmFBTEc0VvfVyzq1CJuh1QZi_xDIgNEFjZ4Pq34og" ,
113
- } ,
114
- } ,
115
- } ,
116
- "m.relates_to" : {
117
- rel_type : "m.replace" ,
118
- event_id : originalEvent . getId ( ) ,
119
- } ,
120
- } ,
121
- user : "some_other_user" ,
122
- room : "room_id" ,
123
- } ) ;
124
-
125
- // The edit replaces the original event
126
- originalEvent . makeReplaced ( editEvent ) ;
127
-
128
- // The relation should be pulled from the edit event
129
- expect ( getParentEventId ( originalEvent ) ) . toStrictEqual ( "$qkjmFBTEc0VvfVyzq1CJuh1QZi_xDIgNEFjZ4Pq34og" ) ;
130
- } ) ;
131
-
132
- it ( "prefers relation reply from edit event over original event" , ( ) => {
133
- const originalEventWithRelation = testUtils . mkEvent ( {
134
- event : true ,
135
- type : "m.room.message" ,
136
- content : {
137
- "msgtype" : "m.text" ,
138
- "body" : "> Reply to this message\n\n foo" ,
139
- "m.relates_to" : {
140
- "m.in_reply_to" : {
141
- event_id : "$111" ,
142
- } ,
143
- } ,
144
- } ,
145
- user : "some_other_user" ,
146
- room : "room_id" ,
147
- } ) ;
148
-
149
- const editEvent = testUtils . mkEvent ( {
150
- event : true ,
151
- type : "m.room.message" ,
152
- content : {
153
- "msgtype" : "m.text" ,
154
- "body" : "> Reply to this message\n\n * foo bar" ,
155
- "m.new_content" : {
156
- "msgtype" : "m.text" ,
157
- "body" : "foo bar" ,
158
- "m.relates_to" : {
159
- "m.in_reply_to" : {
160
- event_id : "$999" ,
161
- } ,
162
- } ,
163
- } ,
164
- "m.relates_to" : {
165
- rel_type : "m.replace" ,
166
- event_id : originalEventWithRelation . getId ( ) ,
167
- } ,
168
- } ,
169
- user : "some_other_user" ,
170
- room : "room_id" ,
171
- } ) ;
172
-
173
- // The edit replaces the original event
174
- originalEventWithRelation . makeReplaced ( editEvent ) ;
175
-
176
- // The relation should be pulled from the edit event
177
- expect ( getParentEventId ( originalEventWithRelation ) ) . toStrictEqual ( "$999" ) ;
178
- } ) ;
179
-
180
- it ( "able to clear relation reply from original event by providing empty relation field" , ( ) => {
181
- const originalEventWithRelation = testUtils . mkEvent ( {
182
- event : true ,
183
- type : "m.room.message" ,
184
- content : {
185
- "msgtype" : "m.text" ,
186
- "body" : "> Reply to this message\n\n foo" ,
187
- "m.relates_to" : {
188
- "m.in_reply_to" : {
189
- event_id : "$111" ,
190
- } ,
191
- } ,
192
- } ,
193
- user : "some_other_user" ,
194
- room : "room_id" ,
195
- } ) ;
196
-
197
- const editEvent = testUtils . mkEvent ( {
198
- event : true ,
199
- type : "m.room.message" ,
200
- content : {
201
- "msgtype" : "m.text" ,
202
- "body" : "> Reply to this message\n\n * foo bar" ,
203
- "m.new_content" : {
204
- "msgtype" : "m.text" ,
205
- "body" : "foo bar" ,
206
- // Clear the relation from the original event
207
- "m.relates_to" : { } ,
208
- } ,
209
- "m.relates_to" : {
210
- rel_type : "m.replace" ,
211
- event_id : originalEventWithRelation . getId ( ) ,
212
- } ,
213
- } ,
214
- user : "some_other_user" ,
215
- room : "room_id" ,
216
- } ) ;
217
-
218
- // The edit replaces the original event
219
- originalEventWithRelation . makeReplaced ( editEvent ) ;
220
-
221
- // The relation should be pulled from the edit event
222
- expect ( getParentEventId ( originalEventWithRelation ) ) . toStrictEqual ( undefined ) ;
223
- } ) ;
224
88
} ) ;
225
89
} ) ;
0 commit comments