@@ -20,7 +20,7 @@ import { createPartCreator } from "./mock";
20
20
21
21
const FOUR_SPACES = " " . repeat ( 4 ) ;
22
22
23
- function htmlMessage ( formattedBody , msgtype = "m.text" ) {
23
+ function htmlMessage ( formattedBody : string , msgtype = "m.text" ) {
24
24
return {
25
25
getContent ( ) {
26
26
return {
@@ -32,7 +32,7 @@ function htmlMessage(formattedBody, msgtype = "m.text") {
32
32
} as unknown as MatrixEvent ;
33
33
}
34
34
35
- function textMessage ( body , msgtype = "m.text" ) {
35
+ function textMessage ( body : string , msgtype = "m.text" ) {
36
36
return {
37
37
getContent ( ) {
38
38
return {
@@ -43,6 +43,13 @@ function textMessage(body, msgtype = "m.text") {
43
43
} as unknown as MatrixEvent ;
44
44
}
45
45
46
+ function textMessageReply ( body : string , msgtype = "m.text" ) {
47
+ return {
48
+ ...textMessage ( body , msgtype ) ,
49
+ replyEventId : "!foo:bar" ,
50
+ } as unknown as MatrixEvent ;
51
+ }
52
+
46
53
function mergeAdjacentParts ( parts ) {
47
54
let prevPart ;
48
55
for ( let i = 0 ; i < parts . length ; ++ i ) {
@@ -406,7 +413,7 @@ describe('editor/deserialize', function() {
406
413
} ) ;
407
414
it ( "it strips plaintext replies" , ( ) => {
408
415
const body = "> Sender: foo\n\nMessage" ;
409
- const parts = normalize ( parseEvent ( textMessage ( body ) , createPartCreator ( ) , { shouldEscape : false } ) ) ;
416
+ const parts = normalize ( parseEvent ( textMessageReply ( body ) , createPartCreator ( ) , { shouldEscape : false } ) ) ;
410
417
expect ( parts . length ) . toBe ( 1 ) ;
411
418
expect ( parts [ 0 ] ) . toStrictEqual ( {
412
419
type : "plain" ,
0 commit comments