feat(proxy): 支持品赞分组代理与自动白名单
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"douyu_go/internal/constants"
|
||||
)
|
||||
|
||||
func TestMigrateLegacyFile(t *testing.T) {
|
||||
@@ -110,3 +112,19 @@ func TestExplicitLogDirOverridesWailsDev(t *testing.T) {
|
||||
t.Fatalf("显式日志目录 = %q, want %q", paths.LogDir, customLogDir)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadConfigNormalizesAccountsPerProxy(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "config.json")
|
||||
if err := os.WriteFile(path, []byte(`{"accountsPerProxy":0}`), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := LoadConfig(path).AccountsPerProxy; got != constants.DefaultAccountsPerProxy {
|
||||
t.Fatalf("AccountsPerProxy=%d, want %d", got, constants.DefaultAccountsPerProxy)
|
||||
}
|
||||
if err := os.WriteFile(path, []byte(`{"accountsPerProxy":999}`), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := LoadConfig(path).AccountsPerProxy; got != constants.MaxAccountsPerProxy {
|
||||
t.Fatalf("AccountsPerProxy=%d, want %d", got, constants.MaxAccountsPerProxy)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user