test: add formatDurationMillis tests

This commit is contained in:
2026-07-04 05:17:29 +02:00
parent b796560f77
commit 43fb5509f1

View File

@@ -0,0 +1,23 @@
package observability
import (
"testing"
)
func TestFormatDurationMillisFormatsFloat(t *testing.T) {
if got := formatDurationMillis(123.456); got != "123.456ms" {
t.Fatalf("got %q, want %q", got, "123.456ms")
}
}
func TestFormatDurationMillisFormatsInt(t *testing.T) {
if got := formatDurationMillis(42); got != "42ms" {
t.Fatalf("got %q, want %q", got, "42ms")
}
}
func TestFormatDurationMillisReturnsStringAsIs(t *testing.T) {
if got := formatDurationMillis("fast"); got != "fast" {
t.Fatalf("got %q, want %q", got, "fast")
}
}