MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / TestFormatUptime

Function TestFormatUptime

internal/cli/cli_helpers_test.go:147–165  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

145}
146
147func TestFormatUptime(t *testing.T) {
148 cases := []struct {
149 input int64
150 want string
151 }{
152 {0, "0s"},
153 {45, "45s"},
154 {90, "1m30s"},
155 {3661, "1h1m"},
156 {90061, "1d1h1m"},
157 }
158
159 for _, tc := range cases {
160 got := formatUptime(tc.input)
161 if got != tc.want {
162 t.Errorf("formatUptime(%d) = %q, want %q", tc.input, got, tc.want)
163 }
164 }
165}
166
167// newTestClient creates an api.Client pointing at the given httptest server URL.
168// The server must respond to POST /api2/json/access/ticket with a valid auth response.

Callers

nothing calls this directly

Calls 1

formatUptimeFunction · 0.85

Tested by

no test coverage detected