package mediaService import "testing" func TestShouldUpdateH265URL(t *testing.T) { tests := []struct { name string current string incoming string want bool }{ { name: "empty incoming does not erase existing URL", current: "https://cdn.example.com/existing.m3u8", incoming: "", want: false, }, { name: "whitespace incoming does not erase existing URL", current: "https://cdn.example.com/existing.m3u8", incoming: " ", want: false, }, { name: "same URL does not update", current: "https://cdn.example.com/hevc.m3u8", incoming: " https://cdn.example.com/hevc.m3u8 ", want: false, }, { name: "new non-empty URL updates", current: "", incoming: "https://cdn.example.com/hevc.m3u8", want: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := shouldUpdateH265URL(tt.current, tt.incoming); got != tt.want { t.Fatalf("shouldUpdateH265URL() = %v, want %v", got, tt.want) } }) } }