Skip to content

Commit

Permalink
Add stretchr testify for better JSON assertions and output
Browse files Browse the repository at this point in the history
closes #25
  • Loading branch information
Stein Fletcher committed Feb 20, 2019
1 parent 20f79e8 commit 53494b2
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 367 deletions.
100 changes: 0 additions & 100 deletions .sequence/2895595591_1412177239.html

This file was deleted.

2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ A simple and extensible behavioural testing library in golang. Supports mocking

In behavioural tests the internal structure of the app is not known by the tests. Data is input to the system and the outputs are expected to meet certain conditions.

**This library is dependency free and we intend to keep it that way**

## Installation

```bash
Expand Down
7 changes: 4 additions & 3 deletions apitest.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/steinfletcher/apitest/assert"
"hash/fnv"
"io/ioutil"
"net/http"
Expand All @@ -17,6 +16,8 @@ import (
"strings"
"testing"
"time"

"github.com/stretchr/testify/assert"
)

const systemUnderTestDefaultName = "sut"
Expand Down Expand Up @@ -642,7 +643,7 @@ func (a *APITest) assertResponse(res *httptest.ResponseRecorder) {

if a.response.body != "" {
if isJSON(a.response.body) {
assert.JsonEqual(a.t, a.response.body, res.Body.String())
assert.JSONEq(a.t, a.response.body, res.Body.String())
} else {
assert.Equal(a.t, a.response.body, res.Body.String())
}
Expand All @@ -662,7 +663,7 @@ func (a *APITest) assertCookies(response *httptest.ResponseRecorder) {
}
}
assert.Equal(a.t, true, foundCookie, "ExpectedCookie not found - "+*expectedCookie.name)
assert.Equal(a.t, 0, len(mismatchedFields), mismatchedFields...)
assert.Equal(a.t, 0, len(mismatchedFields), mismatchedFields)
}
}

Expand Down
2 changes: 1 addition & 1 deletion apitest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package apitest

import (
"fmt"
"github.com/steinfletcher/apitest/assert"
"github.com/stretchr/testify/assert"
"io/ioutil"
"net/http"
"net/http/httptest"
Expand Down
101 changes: 0 additions & 101 deletions assert/assert.go

This file was deleted.

Loading

0 comments on commit 53494b2

Please sign in to comment.