Skip to content

Commit

Permalink
rename verbose test func
Browse files Browse the repository at this point in the history
  • Loading branch information
crhntr committed Feb 3, 2024
1 parent fe3a416 commit 0e698d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion domtest/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type T interface {
Log(...any)
}

func ResponseDocument(t T, res *http.Response) spec.Document {
func Response(t T, res *http.Response) spec.Document {
t.Helper()

buf, err := io.ReadAll(res.Body)
Expand Down
14 changes: 7 additions & 7 deletions domtest/document_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ var (
fragmentHTML string
)

func TestResponseDocument(t *testing.T) {
func TestResponse(t *testing.T) {
t.Run("when a valid html document is passed", func(t *testing.T) {
testingT := new(fakes.T)
res := &http.Response{
Body: io.NopCloser(strings.NewReader(indexHTML)),
}
document := domtest.ResponseDocument(testingT, res)
document := domtest.Response(testingT, res)

assert.Equal(t, testingT.ErrorCallCount(), 0, "it should not report errors")
assert.Equal(t, testingT.LogCallCount(), 0)
Expand All @@ -46,7 +46,7 @@ func TestResponseDocument(t *testing.T) {
res := &http.Response{
Body: io.NopCloser(strings.NewReader(fragmentHTML)),
}
document := domtest.ResponseDocument(testingT, res)
document := domtest.Response(testingT, res)

assert.Equal(t, testingT.ErrorCallCount(), 0, "it should not report errors")
assert.Equal(t, testingT.LogCallCount(), 0)
Expand All @@ -68,7 +68,7 @@ func TestResponseDocument(t *testing.T) {
res := &http.Response{
Body: fakeBody,
}
document := domtest.ResponseDocument(testingT, res)
document := domtest.Response(testingT, res)

assert.Equal(t, testingT.ErrorCallCount(), 1, "it should report an error")
assert.Equal(t, testingT.LogCallCount(), 0)
Expand All @@ -87,7 +87,7 @@ func TestResponseDocument(t *testing.T) {
res := &http.Response{
Body: fakeBody,
}
document := domtest.ResponseDocument(testingT, res)
document := domtest.Response(testingT, res)

assert.Equal(t, testingT.ErrorCallCount(), 1, "it should report two errors")
assert.Equal(t, testingT.LogCallCount(), 0)
Expand All @@ -106,7 +106,7 @@ func TestResponseDocument(t *testing.T) {
res := &http.Response{
Body: fakeBody,
}
document := domtest.ResponseDocument(testingT, res)
document := domtest.Response(testingT, res)

assert.Equal(t, testingT.ErrorCallCount(), 2, "it should report two errors")
assert.Equal(t, testingT.LogCallCount(), 0)
Expand All @@ -125,7 +125,7 @@ func TestResponseDocument(t *testing.T) {
res := &http.Response{
Body: fakeBody,
}
document := domtest.ResponseDocument(testingT, res)
document := domtest.Response(testingT, res)

assert.Equal(t, testingT.ErrorCallCount(), 2, "it should report two errors")
assert.Equal(t, testingT.LogCallCount(), 0)
Expand Down

0 comments on commit 0e698d6

Please sign in to comment.