@@ -32,6 +32,7 @@ import DMRoomMap from "../../../../src/utils/DMRoomMap";
32
32
import dis from "../../../../src/dispatcher/dispatcher" ;
33
33
import { Action } from "../../../../src/dispatcher/actions" ;
34
34
import { IRoomState } from "../../../../src/components/structures/RoomView" ;
35
+ import PinningUtils from "../../../../src/utils/PinningUtils.ts" ;
35
36
36
37
describe ( "EventTile" , ( ) => {
37
38
const ROOM_ID = "!roomId:example.org" ;
@@ -91,6 +92,10 @@ describe("EventTile", () => {
91
92
} ) ;
92
93
} ) ;
93
94
95
+ afterEach ( ( ) => {
96
+ jest . spyOn ( PinningUtils , "isPinned" ) . mockReturnValue ( false ) ;
97
+ } ) ;
98
+
94
99
describe ( "EventTile thread summary" , ( ) => {
95
100
beforeEach ( ( ) => {
96
101
jest . spyOn ( client , "supportsThreads" ) . mockReturnValue ( true ) ;
@@ -129,6 +134,26 @@ describe("EventTile", () => {
129
134
130
135
await waitFor ( ( ) => expect ( screen . queryByTestId ( "thread-summary" ) ) . toBeNull ( ) ) ;
131
136
} ) ;
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
+ } ) ;
132
157
} ) ;
133
158
134
159
describe ( "EventTile renderingType: ThreadsList" , ( ) => {
@@ -510,4 +535,10 @@ describe("EventTile", () => {
510
535
} ) ;
511
536
} ) ;
512
537
} ) ;
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
+ } ) ;
513
544
} ) ;
0 commit comments