Skip to content

Commit

Permalink
combine tests to handle http handler registration
Browse files Browse the repository at this point in the history
  • Loading branch information
johanmcgwire-cb committed May 8, 2022
1 parent 6ee76f4 commit 80f904b
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions conversation_test.go
Expand Up @@ -411,24 +411,18 @@ func TestGetConversationInfo(t *testing.T) {
t.Error("channel should not be nil")
return
}
}

func TestGetConversationInfoNilError(t *testing.T) {
http.HandleFunc("/conversations.info", okChannelJsonHandler)
once.Do(startServer)
api := New("testing-token", OptionAPIURL("http://"+serverAddr+"/"))
_, err := api.GetConversationInfo(nil)
// Nil Input Error
api = New("testing-token", OptionAPIURL("http://"+serverAddr+"/"))
_, err = api.GetConversationInfo(nil)
if err == nil {
t.Errorf("Unexpected pass where there should have been nil input error")
return
}
}

func TestGetConversationInfoMissingChannelError(t *testing.T) {
http.HandleFunc("/conversations.info", okChannelJsonHandler)
once.Do(startServer)
api := New("testing-token", OptionAPIURL("http://"+serverAddr+"/"))
_, err := api.GetConversationInfo(&GetConversationInfoInput{})
// No Channel Error
api = New("testing-token", OptionAPIURL("http://"+serverAddr+"/"))
_, err = api.GetConversationInfo(&GetConversationInfoInput{})
if err == nil {
t.Errorf("Unexpected pass where there should have been missing channel error")
return
Expand Down

0 comments on commit 80f904b

Please sign in to comment.