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
@@ -0,0 +1,39 @@
package usermod
import (
"testing"
"time"
)
func TestGetPaymentStatusPopupNewUserIgnoresFreeWatchCount(t *testing.T) {
now := time.Now()
tests := []struct {
name string
watchCount uint64
want string
}{
{
name: "remaining free views stays new unpaid",
watchCount: 3,
want: UserPaymentStatusPopupNewUnpay,
},
{
name: "exhausted free views stays new unpaid",
watchCount: 0,
want: UserPaymentStatusPopupNewUnpay,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
user := &User{
CreatedAt: now.Add(-time.Hour),
WatchCount: tt.watchCount,
}
if got := user.GetPaymentStatusPopup(); got != tt.want {
t.Fatalf("GetPaymentStatusPopup() = %q, want %q", got, tt.want)
}
})
}
}