@@ -130,42 +130,36 @@ describe('Conversation.vue', () => {
130130 describe ( 'author name' , ( ) => {
131131 test ( 'displays last chat message with shortened author name' , ( ) => {
132132 testConversationLabel ( item , 'Alice: hello' )
133- expect ( messagesMock ) . toHaveBeenCalledWith ( TOKEN )
134133 } )
135134
136135 test ( 'displays last chat message with author name if no space in name' , ( ) => {
137136 item . lastMessage . actorDisplayName = 'Bob'
138137 testConversationLabel ( item , 'Bob: hello' )
139- expect ( messagesMock ) . toHaveBeenCalledWith ( TOKEN )
140138 } )
141139
142140 test ( 'displays own last chat message with "You" as author' , ( ) => {
143141 item . lastMessage . actorId = 'user-id-self'
144142
145143 testConversationLabel ( item , 'You: hello' )
146- expect ( messagesMock ) . toHaveBeenCalledWith ( TOKEN )
147144 } )
148145
149146 test ( 'displays last system message without author' , ( ) => {
150147 item . lastMessage . message = 'Alice has joined the call'
151148 item . lastMessage . systemMessage = 'call_joined'
152149
153150 testConversationLabel ( item , 'Alice has joined the call' )
154- expect ( messagesMock ) . toHaveBeenCalledWith ( TOKEN )
155151 } )
156152
157153 test ( 'displays last message without author in one to one conversations' , ( ) => {
158154 item . type = CONVERSATION . TYPE . ONE_TO_ONE
159155 testConversationLabel ( item , 'hello' )
160- expect ( messagesMock ) . toHaveBeenCalledWith ( TOKEN )
161156 } )
162157
163158 test ( 'displays own last message with "You" author in one to one conversations' , ( ) => {
164159 item . type = CONVERSATION . TYPE . ONE_TO_ONE
165160 item . lastMessage . actorId = 'user-id-self'
166161
167162 testConversationLabel ( item , 'You: hello' )
168- expect ( messagesMock ) . toHaveBeenCalledWith ( TOKEN )
169163 } )
170164
171165 test ( 'displays last guest message with default author when none set' , ( ) => {
@@ -174,14 +168,12 @@ describe('Conversation.vue', () => {
174168 item . lastMessage . actorType = ATTENDEE . ACTOR_TYPE . GUESTS
175169
176170 testConversationLabel ( item , 'Guest: hello' )
177- expect ( messagesMock ) . toHaveBeenCalledWith ( TOKEN )
178171 } )
179172
180173 test ( 'displays last message for search results' , ( ) => {
181174 // search results have no actor id
182175 item . actorId = null
183176 testConversationLabel ( item , 'Alice: hello' , true )
184- expect ( messagesMock ) . toHaveBeenCalledWith ( TOKEN )
185177 } )
186178 } )
187179
@@ -194,80 +186,6 @@ describe('Conversation.vue', () => {
194186 }
195187
196188 testConversationLabel ( item , 'Alice: filename.jpg' )
197- expect ( messagesMock ) . toHaveBeenCalledWith ( TOKEN )
198- } )
199-
200- describe ( 'last message from messages store' , ( ) => {
201- // see Conversation.lastChatMessage() description for the reasoning
202- let displayedLastStoreMessage
203- let lastMessageFromConversation
204-
205- beforeEach ( ( ) => {
206- displayedLastStoreMessage = {
207- id : 100 ,
208- actorId : 'user-id-alice' ,
209- actorDisplayName : 'Alice Wonderland' ,
210- actorType : ATTENDEE . ACTOR_TYPE . USERS ,
211- message : 'hello from store' ,
212- messageParameters : { } ,
213- systemMessage : '' ,
214- timestamp : 100 ,
215- }
216-
217- lastMessageFromConversation = {
218- id : 110 ,
219- actorId : 'user-id-alice' ,
220- actorDisplayName : 'Alice Wonderland' ,
221- actorType : ATTENDEE . ACTOR_TYPE . USERS ,
222- message : 'hello from conversation' ,
223- messageParameters : { } ,
224- systemMessage : '' ,
225- timestamp : 100 ,
226- }
227-
228- item . lastMessage = lastMessageFromConversation
229-
230- messagesMock . mockClear ( ) . mockReturnValue ( {
231- 100 : displayedLastStoreMessage ,
232- } )
233- } )
234-
235- test ( 'displays store message when more recent' , ( ) => {
236- displayedLastStoreMessage . timestamp = 2000
237-
238- testConversationLabel ( item , 'Alice: hello from store' )
239- expect ( messagesMock ) . toHaveBeenCalledWith ( TOKEN )
240- } )
241-
242- test ( 'displays conversation message when last one is a temporary command message' , ( ) => {
243- messagesMock . mockClear ( ) . mockReturnValue ( {
244- 'temp-100' : displayedLastStoreMessage ,
245- } )
246-
247- displayedLastStoreMessage . timestamp = 2000
248- displayedLastStoreMessage . id = 'temp-100'
249- displayedLastStoreMessage . message = '/me doing things'
250-
251- testConversationLabel ( item , 'Alice: hello from conversation' )
252- expect ( messagesMock ) . toHaveBeenCalledWith ( TOKEN )
253- } )
254-
255- test ( 'displays conversation message when last one is a bot message' , ( ) => {
256- displayedLastStoreMessage . timestamp = 2000
257- displayedLastStoreMessage . actorType = ATTENDEE . ACTOR_TYPE . BOTS
258-
259- testConversationLabel ( item , 'Alice: hello from conversation' )
260- expect ( messagesMock ) . toHaveBeenCalledWith ( TOKEN )
261- } )
262-
263- test ( 'displays store message when last one is a changelog bot message' , ( ) => {
264- displayedLastStoreMessage . timestamp = 2000
265- displayedLastStoreMessage . actorType = ATTENDEE . ACTOR_TYPE . BOTS
266- displayedLastStoreMessage . actorId = ATTENDEE . CHANGELOG_BOT_ID
267-
268- testConversationLabel ( item , 'Alice: hello from store' )
269- expect ( messagesMock ) . toHaveBeenCalledWith ( TOKEN )
270- } )
271189 } )
272190 } )
273191
0 commit comments