init: hgmj server initial commit

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 16:50:13 +08:00
co-authored by Claude Opus 4.7
commit 625e89c15d
1870 changed files with 254090 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
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)
}
})
}
}