@@ -297,14 +297,12 @@ class AgentNotificationsTest {
297297 fun severalThreadsListEveryRowWithItsStatusAndActionsFollowThePriorityThread () {
298298 lifecycle.currentState = Lifecycle .State .RESUMED
299299 val title = " A long thread title that should wrap rather than disappear"
300- val since = System .currentTimeMillis() - 4 * 60 * 1000L
301300 val data = update(" attention" , true ) + mapOf (
302301 " activity_line_0" to " Approval $title Project" ,
303302 " activity_line_1" to " Working Another thread Other project" ,
304303 " activity_phase" to " waiting_for_approval" ,
305304 " activity_active_count" to " 8" ,
306305 " activity_attention_count" to " 1" ,
307- " activity_since" to since.toString(),
308306 )
309307 AgentNotifications .receive(context, data)
310308 val card = manager.activeNotifications.single().notification
@@ -314,15 +312,16 @@ class AgentNotificationsTest {
314312 " Approval $title · Project\n Working Another thread · Other project" ,
315313 card.extras.getCharSequence(Notification .EXTRA_BIG_TEXT ).toString()
316314 )
317- assertEquals(" Approval $title · Project" , card.extras.getCharSequence(Notification .EXTRA_TEXT ).toString())
315+ assertEquals(
316+ " Approval $title · Project" ,
317+ card.extras.getCharSequence(Notification .EXTRA_TEXT ).toString()
318+ )
318319 assertEquals(listOf (" Approve" , " Dismiss" ), card.actions.map { it.title.toString() })
319320 assertEquals(
320321 " t3code-dev://threads/environment/thread" ,
321322 shadowOf(card.actions[0 ].actionIntent).savedIntent.dataString
322323 )
323324 assertEquals(" Approve" , card.extras.getString(NotificationCompat .EXTRA_SHORT_CRITICAL_TEXT ))
324- assertEquals(since, card.`when `)
325- assertTrue(card.extras.getBoolean(Notification .EXTRA_SHOW_CHRONOMETER ))
326325
327326 AgentNotifications .receive(
328327 context,
@@ -342,6 +341,29 @@ class AgentNotificationsTest {
342341 assertEquals(" Answer" , next.extras.getString(NotificationCompat .EXTRA_SHORT_CRITICAL_TEXT ))
343342 }
344343
344+ @Test
345+ fun waitingCardsIgnoreMutableThreadTimestampsEvenAfterRename () {
346+ lifecycle.currentState = Lifecycle .State .RESUMED
347+ val now = System .currentTimeMillis()
348+ for (phase in listOf (" waiting_for_approval" , " waiting_for_input" )) {
349+ val status = if (phase == " waiting_for_approval" ) " Approval" else " Input"
350+ for ((title, updatedAt) in listOf (" Original" to now - 1200000L , " Renamed" to now)) {
351+ AgentNotifications .receive(
352+ context,
353+ update(" waiting" , true ) + mapOf (
354+ " activity_line_0" to " $status \t $title \t Project" ,
355+ " activity_phase" to phase,
356+ " activity_since" to updatedAt.toString()
357+ )
358+ )
359+ val card = manager.activeNotifications.single().notification
360+ assertEquals(title, card.extras.getCharSequence(Notification .EXTRA_TITLE ).toString())
361+ assertFalse(card.extras.getBoolean(Notification .EXTRA_SHOW_WHEN ))
362+ assertFalse(card.extras.getBoolean(Notification .EXTRA_SHOW_CHRONOMETER ))
363+ }
364+ }
365+ }
366+
345367 @Test
346368 fun aSingleThreadUsesItsTitleAndNeverShowsAProgressBar () {
347369 lifecycle.currentState = Lifecycle .State .RESUMED
@@ -351,12 +373,24 @@ class AgentNotificationsTest {
351373 )
352374 AgentNotifications .receive(context, data)
353375 val working = manager.activeNotifications.single().notification
354- assertEquals(" Update dashboard" , working.extras.getCharSequence(Notification .EXTRA_TITLE ).toString())
355- assertEquals(" Working Project" , working.extras.getCharSequence(Notification .EXTRA_BIG_TEXT ).toString())
376+ assertEquals(
377+ " Update dashboard" ,
378+ working.extras.getCharSequence(Notification .EXTRA_TITLE ).toString()
379+ )
380+ assertEquals(
381+ " Working Project" ,
382+ working.extras.getCharSequence(Notification .EXTRA_BIG_TEXT ).toString()
383+ )
356384 assertEquals(null , working.extras.getString(Notification .EXTRA_SUB_TEXT ))
357385 assertEquals(" Working" , working.extras.getString(NotificationCompat .EXTRA_SHORT_CRITICAL_TEXT ))
358386 assertFalse(working.extras.getBoolean(Notification .EXTRA_SHOW_CHRONOMETER ))
359- for (phase in listOf (" waiting_for_approval" , " waiting_for_input" , " stale" , " failed" , " completed" )) {
387+ for (phase in listOf (
388+ " waiting_for_approval" ,
389+ " waiting_for_input" ,
390+ " stale" ,
391+ " failed" ,
392+ " completed"
393+ )) {
360394 val active = phase != " failed" && phase != " completed"
361395 AgentNotifications .receive(
362396 context,
@@ -430,7 +464,10 @@ class AgentNotificationsTest {
430464 )
431465 )
432466 val finished = manager.activeNotifications.single().notification
433- assertEquals(" Finished, 1 failed" , finished.extras.getCharSequence(Notification .EXTRA_TITLE ).toString())
467+ assertEquals(
468+ " Finished, 1 failed" ,
469+ finished.extras.getCharSequence(Notification .EXTRA_TITLE ).toString()
470+ )
434471 assertEquals(" Project · 2 threads" , finished.extras.getString(Notification .EXTRA_SUB_TEXT ))
435472 }
436473
0 commit comments