main pico / pkg / shared / util_test.go
Antonio Mika  ·  2026-10-10
 1package shared
 2
 3import "testing"
 4
 5func TestStorageUsage(t *testing.T) {
 6	tests := []struct {
 7		used, max int
 8		want      string
 9	}{
10		{used: 0, max: 1000 * MB, want: ""},
11		{used: 999 * MB, max: 1000 * MB, want: ""},
12		{used: 1000 * MB, max: 1000 * MB, want: " (space: 1.00/1.00GB, 100.00%)"},
13		{used: 10, max: 0, want: ""},
14	}
15	for _, tt := range tests {
16		if got := StorageUsage(tt.used, tt.max); got != tt.want {
17			t.Errorf("StorageUsage(%d, %d) = %q, want %q", tt.used, tt.max, got, tt.want)
18		}
19	}
20}