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

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed Apr 26, 2022
1 parent eedfa13 commit d2a7bdf
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/editor/deserialize-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { createPartCreator } from "./mock";

const FOUR_SPACES = " ".repeat(4);

function htmlMessage(formattedBody, msgtype = "m.text") {
function htmlMessage(formattedBody: string, msgtype = "m.text") {
return {
getContent() {
return {
Expand All @@ -32,7 +32,7 @@ function htmlMessage(formattedBody, msgtype = "m.text") {
} as unknown as MatrixEvent;
}

function textMessage(body, msgtype = "m.text") {
function textMessage(body: string, msgtype = "m.text") {
return {
getContent() {
return {
Expand All @@ -43,6 +43,13 @@ function textMessage(body, msgtype = "m.text") {
} as unknown as MatrixEvent;
}

function textMessageReply(body: string, msgtype = "m.text") {
return {
...textMessage(body, msgtype),
replyEventId: "!foo:bar",
} as unknown as MatrixEvent;
}

function mergeAdjacentParts(parts) {
let prevPart;
for (let i = 0; i < parts.length; ++i) {
Expand Down Expand Up @@ -406,7 +413,7 @@ describe('editor/deserialize', function() {
});
it("it strips plaintext replies", () => {
const body = "> Sender: foo\n\nMessage";
const parts = normalize(parseEvent(textMessage(body), createPartCreator(), { shouldEscape: false }));
const parts = normalize(parseEvent(textMessageReply(body), createPartCreator(), { shouldEscape: false }));
expect(parts.length).toBe(1);
expect(parts[0]).toStrictEqual({
type: "plain",
Expand Down

0 comments on commit d2a7bdf

Please sign in to comment.