MCPcopy Create free account
hub / github.com/openclaw/gogcli / TestAnalyticsAdminServiceUsesRuntimeFactory

Function TestAnalyticsAdminServiceUsesRuntimeFactory

internal/cmd/runtime_test.go:706–729  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

704}
705
706func TestAnalyticsAdminServiceUsesRuntimeFactory(t *testing.T) {
707 t.Parallel()
708
709 want := &analyticsadmin.Service{}
710 var gotAccount string
711 runtime := &app.Runtime{Services: app.Services{
712 AnalyticsAdmin: func(_ context.Context, account string) (*analyticsadmin.Service, error) {
713 gotAccount = account
714 return want, nil
715 },
716 }}
717 ctx := app.WithRuntime(context.Background(), runtime)
718
719 got, err := analyticsAdminService(ctx, "test@example.com")
720 if err != nil {
721 t.Fatalf("analyticsAdminService() error = %v", err)
722 }
723 if got != want {
724 t.Fatalf("analyticsAdminService() = %p, want %p", got, want)
725 }
726 if gotAccount != "test@example.com" {
727 t.Fatalf("factory account = %q, want test@example.com", gotAccount)
728 }
729}
730
731func TestAnalyticsDataServiceUsesRuntimeFactory(t *testing.T) {
732 t.Parallel()

Callers

nothing calls this directly

Calls 2

WithRuntimeFunction · 0.92
analyticsAdminServiceFunction · 0.85

Tested by

no test coverage detected