@@ -32,6 +32,7 @@ import DMRoomMap from "../../../../src/utils/DMRoomMap";
3232import dis from "../../../../src/dispatcher/dispatcher" ;
3333import { Action } from "../../../../src/dispatcher/actions" ;
3434import { IRoomState } from "../../../../src/components/structures/RoomView" ;
35+ import PinningUtils from "../../../../src/utils/PinningUtils.ts" ;
3536
3637describe ( "EventTile" , ( ) => {
3738 const ROOM_ID = "!roomId:example.org" ;
@@ -91,6 +92,10 @@ describe("EventTile", () => {
9192 } ) ;
9293 } ) ;
9394
95+ afterEach ( ( ) => {
96+ jest . spyOn ( PinningUtils , "isPinned" ) . mockReturnValue ( false ) ;
97+ } ) ;
98+
9499 describe ( "EventTile thread summary" , ( ) => {
95100 beforeEach ( ( ) => {
96101 jest . spyOn ( client , "supportsThreads" ) . mockReturnValue ( true ) ;
@@ -129,6 +134,26 @@ describe("EventTile", () => {
129134
130135 await waitFor ( ( ) => expect ( screen . queryByTestId ( "thread-summary" ) ) . toBeNull ( ) ) ;
131136 } ) ;
137+
138+ it ( "should display the pinned message badge" , async ( ) => {
139+ jest . spyOn ( PinningUtils , "isPinned" ) . mockReturnValue ( true ) ;
140+
141+ const { rootEvent } = mkThread ( {
142+ room,
143+ client,
144+ authorId : "@alice:example.org" ,
145+ participantUserIds : [ "@alice:example.org" ] ,
146+ length : 2 , // root + 1 answer
147+ } ) ;
148+ getComponent (
149+ {
150+ mxEvent : rootEvent ,
151+ } ,
152+ TimelineRenderingType . Room ,
153+ ) ;
154+
155+ expect ( screen . getByText ( "Pinned message" ) ) . toBeInTheDocument ( ) ;
156+ } ) ;
132157 } ) ;
133158
134159 describe ( "EventTile renderingType: ThreadsList" , ( ) => {
@@ -510,4 +535,10 @@ describe("EventTile", () => {
510535 } ) ;
511536 } ) ;
512537 } ) ;
538+
539+ test ( "it should render a pinned message badge" , async ( ) => {
540+ jest . spyOn ( PinningUtils , "isPinned" ) . mockReturnValue ( true ) ;
541+ getComponent ( ) ;
542+ expect ( screen . getByText ( "Pinned message" ) ) . toBeInTheDocument ( ) ;
543+ } ) ;
513544} ) ;
0 commit comments