The `assert.Equal()` expects that the "expected" value is put first. Which is not what I'm used to. It's also slightly inconsistent because `assert.EqualError()` expects the "actual" err first and then the expected string. But this commit is not about ranting :) This commit fixes the order in the tests assert.Equal() so that mismatches actually are displayed correctly.
18 lines
371 B
Go
18 lines
371 B
Go
package main_test
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestTrivialRootEndpoint(t *testing.T) {
|
|
baseURL, _, loggerHook := runTestServer(t)
|
|
|
|
endpoint := baseURL
|
|
resp, err := http.Get(endpoint)
|
|
assert.NoError(t, err)
|
|
assert.Equal(t, 200, resp.StatusCode)
|
|
assert.Equal(t, "/ handler called", loggerHook.LastEntry().Message)
|
|
}
|