Added GET / (empty) test

This commit is contained in:
James Mills 2018-05-09 23:55:29 -07:00
parent dd992ab5d8
commit 03e0fb07c7
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6

View File

@ -1,6 +1,8 @@
package msgbus
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
@ -45,6 +47,18 @@ func TestMessageBusPutGet(t *testing.T) {
assert.Equal(t, actual, expected)
}
func TestServeHTTPGETEmpty(t *testing.T) {
assert := assert.New(t)
mb := New(nil)
w := httptest.NewRecorder()
r, _ := http.NewRequest("GET", "/", nil)
mb.ServeHTTP(w, r)
assert.Equal(w.Code, http.StatusOK)
assert.Equal(w.Body.String(), "{}")
}
func BenchmarkMessageBusPut(b *testing.B) {
mb := New(nil)
topic := mb.NewTopic("foo")