Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

441 B
Raw Blame
package recorder

import "testing"

func TestServerLatencyHeader(t *testing.T) {
	for text, want := range map[string]float64{"0": 0, " 12.5 ": 12.5} {
		got := parseServerLatency(text)
		if got == nil || *got != want {
			t.Fatalf("%q: %v", text, got)
		}
	}
	for _, text := range []string{"", "true", "NaN", "Infinity", "-1", "10ms", "1e2"} {
		if parseServerLatency(text) != nil {
			t.Fatalf("accepted invalid latency %q", text)
		}
	}
}