From b2b818a780dcf2ddf0e8bcd1bd1a9bce0bb22f6b Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 24 Mar 2022 20:11:56 -0600 Subject: [PATCH] Step 8.6: Fix TS issues introduced by using imports --- .../views/messages/DateSeparator-test.tsx | 1 + .../views/messages/MPollBody-test.tsx | 8 ++++ .../__snapshots__/DateSeparator-test.tsx.snap | 2 + .../__snapshots__/MPollBody-test.tsx.snap | 42 +++++++++++++++++++ .../rooms/MessageComposerButtons-test.tsx | 24 ++++++++--- 5 files changed, 71 insertions(+), 6 deletions(-) diff --git a/test/components/views/messages/DateSeparator-test.tsx b/test/components/views/messages/DateSeparator-test.tsx index 8e5b7ea3ca..abd809ac95 100644 --- a/test/components/views/messages/DateSeparator-test.tsx +++ b/test/components/views/messages/DateSeparator-test.tsx @@ -36,6 +36,7 @@ describe("DateSeparator", () => { const defaultProps = { ts: nowMs, now, + roomId: "!unused:example.org", }; const RealDate = global.Date; class MockDate extends Date { diff --git a/test/components/views/messages/MPollBody-test.tsx b/test/components/views/messages/MPollBody-test.tsx index 28c0ceea34..5fa55cd46f 100644 --- a/test/components/views/messages/MPollBody-test.tsx +++ b/test/components/views/messages/MPollBody-test.tsx @@ -1072,6 +1072,14 @@ function newMPollBodyFromEvent( } } } + + // We don't use any of these props, but they're required. + highlightLink="unused" + highlights={[]} + mediaEventHelper={null} + onHeightChanged={() => {}} + onMessageAllowed={() => {}} + permalinkCreator={null} />, { wrappingComponent: MatrixClientContext.Provider, wrappingComponentProps: { diff --git a/test/components/views/messages/__snapshots__/DateSeparator-test.tsx.snap b/test/components/views/messages/__snapshots__/DateSeparator-test.tsx.snap index c1ce2c860c..d848ae092f 100644 --- a/test/components/views/messages/__snapshots__/DateSeparator-test.tsx.snap +++ b/test/components/views/messages/__snapshots__/DateSeparator-test.tsx.snap @@ -3,6 +3,7 @@ exports[`DateSeparator renders the date separator correctly 1`] = `

for types because it'll annoy TS more than it helps. +const mockProps: React.ComponentProps = { + addEmoji: () => false, + haveRecording: false, + isStickerPickerOpen: false, + menuPosition: null, + onRecordStartEndClick: () => {}, + setStickerPickerOpen: () => {}, + toggleButtonMenu: () => {}, +}; + describe("MessageComposerButtons", () => { it("Renders emoji and upload buttons in wide mode", () => { const buttons = wrapAndRender( @@ -35,7 +47,7 @@ describe("MessageComposerButtons", () => { showLocationButton={true} showPollsButton={true} showStickersButton={true} - toggleButtonMenu={() => {}} + {...mockProps} />, false, ); @@ -54,7 +66,7 @@ describe("MessageComposerButtons", () => { showLocationButton={true} showPollsButton={true} showStickersButton={true} - toggleButtonMenu={() => {}} + {...mockProps} />, false, ); @@ -79,7 +91,7 @@ describe("MessageComposerButtons", () => { showLocationButton={true} showPollsButton={true} showStickersButton={true} - toggleButtonMenu={() => {}} + {...mockProps} />, true, ); @@ -97,7 +109,7 @@ describe("MessageComposerButtons", () => { showLocationButton={true} showPollsButton={true} showStickersButton={true} - toggleButtonMenu={() => {}} + {...mockProps} />, true, ); @@ -122,7 +134,7 @@ describe("MessageComposerButtons", () => { showLocationButton={true} showPollsButton={true} showStickersButton={true} - toggleButtonMenu={() => {}} + {...mockProps} />, true, ); @@ -146,7 +158,7 @@ describe("MessageComposerButtons", () => { showLocationButton={true} showPollsButton={false} // !! the change from the alternate test showStickersButton={true} - toggleButtonMenu={() => {}} + {...mockProps} />, true, );