Files
insights-go/featureflags_test.go
T
zeekay b4e1366340 rebrand: export Insights types instead of PostHog
Rename Go package from posthog to insights across all 80+ files.
Consumers now import as `insights "github.com/hanzoai/insights-go"`
and use insights.Client, insights.Config, insights.Capture, etc.

- Rename posthog.go -> insights.go, posthog_test.go -> insights_test.go
- Update package declaration from posthog to insights in all .go files
- Update SDKName from posthog-go to insights-go
- Update DefaultEndpoint from app.posthog.com to insights.hanzo.ai
- Update all FieldError/ConfigError type strings
- Update User-Agent headers, log prefixes, comments, and docs
- Update JSON test fixtures to match new SDK name
- Update CLI, examples, extras, and sdk_compliance_adapter
- Fix pre-existing go vet warnings (non-constant format strings)
2026-03-13 19:54:58 -07:00

27 lines
530 B
Go

package insights
import (
"math"
"testing"
)
func TestCalculateHash(t *testing.T) {
for _, tt := range []struct {
ident string
want float64
}{
{"some_distinct_id", 0.7270002403585725},
{"test-identifier", 0.4493881716040236},
{"example_id", 0.9402003475831224},
{"example_id2", 0.6292740389966519},
} {
t.Run(tt.ident, func(t *testing.T) {
got := calculateHash("holdout-", tt.ident, "")
if math.Abs(got-tt.want) > 0.000001 {
t.Logf("got: %.16f, want: %f", got, tt.want)
t.Fail()
}
})
}
}