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

Commit

Permalink
Fix the types
Browse files Browse the repository at this point in the history
  • Loading branch information
dbkr committed Apr 8, 2022
1 parent 3ecdc57 commit 54b4c6c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/TextForEvent-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { EventType, MatrixEvent } from "matrix-js-sdk/src/matrix";
import TestRenderer from 'react-test-renderer';
import { ReactElement } from "react";

import { getSenderName, textForEvent } from "../src/TextForEvent";
import SettingsStore from "../src/settings/SettingsStore";
Expand Down Expand Up @@ -80,7 +81,7 @@ describe('TextForEvent', () => {
it("mentions message when a single message was pinned, with no previously pinned messages", () => {
const event = mockPinnedEvent(['message-1']);
const plainText = textForEvent(event);
const component = TestRenderer.create(textForEvent(event, true));
const component = TestRenderer.create(textForEvent(event, true) as ReactElement);

const expectedText = "@foo:example.com pinned a message to this room. See all pinned messages.";
expect(plainText).toBe(expectedText);
Expand All @@ -90,7 +91,7 @@ describe('TextForEvent', () => {
it("mentions message when a single message was pinned, with multiple previously pinned messages", () => {
const event = mockPinnedEvent(['message-1', 'message-2', 'message-3'], ['message-1', 'message-2']);
const plainText = textForEvent(event);
const component = TestRenderer.create(textForEvent(event, true));
const component = TestRenderer.create(textForEvent(event, true) as ReactElement);

const expectedText = "@foo:example.com pinned a message to this room. See all pinned messages.";
expect(plainText).toBe(expectedText);
Expand All @@ -100,7 +101,7 @@ describe('TextForEvent', () => {
it("mentions message when a single message was unpinned, with a single message previously pinned", () => {
const event = mockPinnedEvent([], ['message-1']);
const plainText = textForEvent(event);
const component = TestRenderer.create(textForEvent(event, true));
const component = TestRenderer.create(textForEvent(event, true) as ReactElement);

const expectedText = "@foo:example.com unpinned a message from this room. See all pinned messages.";
expect(plainText).toBe(expectedText);
Expand All @@ -110,7 +111,7 @@ describe('TextForEvent', () => {
it("mentions message when a single message was unpinned, with multiple previously pinned messages", () => {
const event = mockPinnedEvent(['message-2'], ['message-1', 'message-2']);
const plainText = textForEvent(event);
const component = TestRenderer.create(textForEvent(event, true));
const component = TestRenderer.create(textForEvent(event, true) as ReactElement);

const expectedText = "@foo:example.com unpinned a message from this room. See all pinned messages.";
expect(plainText).toBe(expectedText);
Expand All @@ -120,7 +121,7 @@ describe('TextForEvent', () => {
it("shows generic text when multiple messages were pinned", () => {
const event = mockPinnedEvent(['message-1', 'message-2', 'message-3'], ['message-1']);
const plainText = textForEvent(event);
const component = TestRenderer.create(textForEvent(event, true));
const component = TestRenderer.create(textForEvent(event, true) as ReactElement);

const expectedText = "@foo:example.com changed the pinned messages for the room.";
expect(plainText).toBe(expectedText);
Expand All @@ -130,7 +131,7 @@ describe('TextForEvent', () => {
it("shows generic text when multiple messages were unpinned", () => {
const event = mockPinnedEvent(['message-3'], ['message-1', 'message-2', 'message-3']);
const plainText = textForEvent(event);
const component = TestRenderer.create(textForEvent(event, true));
const component = TestRenderer.create(textForEvent(event, true) as ReactElement);

const expectedText = "@foo:example.com changed the pinned messages for the room.";
expect(plainText).toBe(expectedText);
Expand All @@ -140,7 +141,7 @@ describe('TextForEvent', () => {
it("shows generic text when one message was pinned, and another unpinned", () => {
const event = mockPinnedEvent(['message-2'], ['message-1']);
const plainText = textForEvent(event);
const component = TestRenderer.create(textForEvent(event, true));
const component = TestRenderer.create(textForEvent(event, true) as ReactElement);

const expectedText = "@foo:example.com changed the pinned messages for the room.";
expect(plainText).toBe(expectedText);
Expand Down

0 comments on commit 54b4c6c

Please sign in to comment.