Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit d2a7bdf

Browse files
committed
Fix test
1 parent eedfa13 commit d2a7bdf

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/editor/deserialize-test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { createPartCreator } from "./mock";
2020

2121
const FOUR_SPACES = " ".repeat(4);
2222

23-
function htmlMessage(formattedBody, msgtype = "m.text") {
23+
function htmlMessage(formattedBody: string, msgtype = "m.text") {
2424
return {
2525
getContent() {
2626
return {
@@ -32,7 +32,7 @@ function htmlMessage(formattedBody, msgtype = "m.text") {
3232
} as unknown as MatrixEvent;
3333
}
3434

35-
function textMessage(body, msgtype = "m.text") {
35+
function textMessage(body: string, msgtype = "m.text") {
3636
return {
3737
getContent() {
3838
return {
@@ -43,6 +43,13 @@ function textMessage(body, msgtype = "m.text") {
4343
} as unknown as MatrixEvent;
4444
}
4545

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+
4653
function mergeAdjacentParts(parts) {
4754
let prevPart;
4855
for (let i = 0; i < parts.length; ++i) {
@@ -406,7 +413,7 @@ describe('editor/deserialize', function() {
406413
});
407414
it("it strips plaintext replies", () => {
408415
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 }));
410417
expect(parts.length).toBe(1);
411418
expect(parts[0]).toStrictEqual({
412419
type: "plain",

0 commit comments

Comments
 (0)