Files
3m-ui/backend/internal/system/system_test.go
T
dzx941 5b4cb63a73 fix: align listener generation with mihomo official spec
- Port now supports mihomo ports format (single/range/list)
- Add explicit RoutingMark field support
- Auto-propagate UDP flag for vmess/vless/trojan/anytls/trusttunnel
- Update validator to accept port ranges
- Sync visual config and client converter port types
- Rename module from dzx941 to kazeyukiro
- Fix missing ExpiresAt in JWTClaims
- Fix nodeDTO Port type to string
- Fix frontend tsconfig and add missing dependencies
2026-08-16 09:21:42 +08:00

32 lines
698 B
Go

package system_test
import (
"testing"
"github.com/kazeyukiro/3m-ui/backend/internal/system"
)
func TestGetSystemStats(t *testing.T) {
stats := system.GetSystemStats()
if stats == nil {
t.Fatal("expected non-nil stats response")
}
if stats.CPU.Percent < 0 {
t.Fatalf("unexpected CPU value: %f", stats.CPU.Percent)
}
if stats.Memory.Percent < 0 || stats.Memory.Percent > 100 {
t.Fatalf("unexpected Memory percent: %f", stats.Memory.Percent)
}
if stats.Disk.Percent < 0 || stats.Disk.Percent > 100 {
t.Fatalf("unexpected Disk percent: %f", stats.Disk.Percent)
}
if stats.Network.Upload < 0 || stats.Network.Download < 0 {
t.Fatal("unexpected Network rate metrics")
}
}