(t *testing.T)
| 50 | } |
| 51 | |
| 52 | func TestUsersService_AddEmails(t *testing.T) { |
| 53 | t.Parallel() |
| 54 | client, mux, _ := setup(t) |
| 55 | |
| 56 | input := []string{"new@example.com"} |
| 57 | |
| 58 | mux.HandleFunc("/user/emails", func(w http.ResponseWriter, r *http.Request) { |
| 59 | testMethod(t, r, "POST") |
| 60 | testJSONBody(t, r, input) |
| 61 | fmt.Fprint(w, `[{"email":"old@example.com"}, {"email":"new@example.com"}]`) |
| 62 | }) |
| 63 | |
| 64 | ctx := t.Context() |
| 65 | emails, _, err := client.Users.AddEmails(ctx, input) |
| 66 | if err != nil { |
| 67 | t.Errorf("Users.AddEmails returned error: %v", err) |
| 68 | } |
| 69 | |
| 70 | want := []*UserEmail{ |
| 71 | {Email: Ptr("old@example.com")}, |
| 72 | {Email: Ptr("new@example.com")}, |
| 73 | } |
| 74 | if !cmp.Equal(emails, want) { |
| 75 | t.Errorf("Users.AddEmails returned %+v, want %+v", emails, want) |
| 76 | } |
| 77 | |
| 78 | const methodName = "AddEmails" |
| 79 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 80 | got, resp, err := client.Users.AddEmails(ctx, input) |
| 81 | if got != nil { |
| 82 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 83 | } |
| 84 | return resp, err |
| 85 | }) |
| 86 | } |
| 87 | |
| 88 | func TestUsersService_DeleteEmails(t *testing.T) { |
| 89 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…