Add tests, edit error messages

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-08-03 00:00:29 -04:00
parent c3b2ab00c2
commit 8259f16f19
11 changed files with 726 additions and 22 deletions
+2 -2
View File
@@ -103,7 +103,7 @@ func (s *SubredditService) Top(ctx context.Context, subreddit string, opts ...Se
// Get gets a subreddit by name.
func (s *SubredditService) Get(ctx context.Context, name string) (*Subreddit, *Response, error) {
if name == "" {
return nil, nil, errors.New("name: must not be empty")
return nil, nil, errors.New("name: cannot be empty")
}
path := fmt.Sprintf("r/%s/about", name)
@@ -406,7 +406,7 @@ func (s *SubredditService) RandomNSFW(ctx context.Context) (*Subreddit, *Respons
// This text is set by the subreddit moderators and intended to be displayed on the submission form.
func (s *SubredditService) SubmissionText(ctx context.Context, name string) (string, *Response, error) {
if name == "" {
return "", nil, errors.New("name: must not be empty")
return "", nil, errors.New("name: cannot be empty")
}
path := fmt.Sprintf("r/%s/api/submit_text", name)