(t *testing.T)
| 704 | } |
| 705 | |
| 706 | func 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 | |
| 731 | func TestAnalyticsDataServiceUsesRuntimeFactory(t *testing.T) { |
| 732 | t.Parallel() |
nothing calls this directly
no test coverage detected