44 "context"
55 "fmt"
66 "os"
7+ "runtime"
78 "sync"
89 "testing"
910 "time"
@@ -196,8 +197,15 @@ func TestTrayIconRestoredAfterNetworkRecovery(t *testing.T) {
196197 }
197198 app .setTrayTitle ()
198199 initialTitle := mock .title
199- if initialTitle != "🪿 1" {
200- t .Errorf ("Expected initial tray title '🪿 1', got %q" , initialTitle )
200+
201+ // Expected title varies by platform
202+ expectedTitle := "1/1" // Linux format
203+ if runtime .GOOS == "darwin" {
204+ expectedTitle = "1" // macOS format
205+ }
206+
207+ if initialTitle != expectedTitle {
208+ t .Errorf ("Expected initial tray title %q, got %q" , expectedTitle , initialTitle )
201209 }
202210
203211 // Simulate network failure - updatePRs would set warning icon and return early
@@ -213,8 +221,8 @@ func TestTrayIconRestoredAfterNetworkRecovery(t *testing.T) {
213221 // With our fix, setTrayTitle() is now called after successful fetch
214222 app .setTrayTitle ()
215223 recoveredTitle := mock .title
216- if recoveredTitle != "🪿 1" {
217- t .Errorf ("Expected tray title to be restored to '🪿 1' after recovery, got %q" , recoveredTitle )
224+ if recoveredTitle != expectedTitle {
225+ t .Errorf ("Expected tray title to be restored to %q after recovery, got %q" , expectedTitle , recoveredTitle )
218226 }
219227}
220228
@@ -447,15 +455,19 @@ func TestSoundPlaybackDuringTransitions(t *testing.T) {
447455 // Actual sound playback is verified through integration testing.
448456
449457 // Set initial state
458+ app .mu .Lock ()
450459 app .incoming = tt .initialIncoming
451460 app .outgoing = tt .initialOutgoing
461+ app .mu .Unlock ()
452462
453463 // Run first check to establish baseline
454464 app .checkForNewlyBlockedPRs (ctx )
455465
456466 // Update to new state
467+ app .mu .Lock ()
457468 app .incoming = tt .updatedIncoming
458469 app .outgoing = tt .updatedOutgoing
470+ app .mu .Unlock ()
459471
460472 // Run check again to detect transitions
461473 app .checkForNewlyBlockedPRs (ctx )
@@ -465,6 +477,7 @@ func TestSoundPlaybackDuringTransitions(t *testing.T) {
465477 if len (tt .expectedSounds ) > 0 {
466478 // Check that blocked PRs are tracked in previousBlockedPRs
467479 blocked := 0
480+ app .mu .RLock ()
468481 for _ , pr := range app .incoming {
469482 if pr .NeedsReview && app .previousBlockedPRs [pr .URL ] {
470483 blocked ++
@@ -475,6 +488,7 @@ func TestSoundPlaybackDuringTransitions(t *testing.T) {
475488 blocked ++
476489 }
477490 }
491+ app .mu .RUnlock ()
478492 if blocked == 0 {
479493 t .Errorf ("%s: expected blocked PRs to be tracked in previousBlockedPRs" , tt .description )
480494 }
0 commit comments