Skip to content

Commit

Permalink
Merge pull request #3 from maxcnunes/typo-bugfix
Browse files Browse the repository at this point in the history
fixing a typo in the new testing assertions
  • Loading branch information
maxcnunes authored Jun 15, 2020
2 parents 3566a5f + 6cfbcb5 commit 774018c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (h *requiredHeaderValue) Assert(r *http.Request) error {

// Log prints a testing info log for the requiredHeaderValue Assertor
func (h *requiredHeaderValue) Log(t testing.TB) {
t.Logf("Testing request for required header value [%s: %s]", h.Key, h.ExpectedValue)
t.Logf("Testing request for a required header value [%s: %s]", h.Key, h.ExpectedValue)
}

// Error prints a testing error for the requiredHeaderValue Assertor
Expand Down Expand Up @@ -126,7 +126,7 @@ func (q *requiredQueryValue) Assert(r *http.Request) error {

// Log prints a testing info log for the requiredQueryValue Assertor
func (q *requiredQueryValue) Log(t testing.TB) {
t.Logf("Testing request for required query parameter value [%s: %s]", q.Key, q.ExpectedValue)
t.Logf("Testing request for a required query parameter value [%s: %s]", q.Key, q.ExpectedValue)
}

// Error prints a testing error for the requiredQueryValue Assertor
Expand All @@ -147,7 +147,7 @@ func (b *requiredBody) Assert(r *http.Request) error {

body, err := ioutil.ReadAll(r.Body)
if err != nil {
return fmt.Errorf("error reading the request body: %w", err)
return fmt.Errorf("error reading the request body: %s", err.Error())
}

if !bytes.EqualFold(b.ExpectedBody, body) {
Expand All @@ -161,7 +161,7 @@ func (b *requiredBody) Assert(r *http.Request) error {

// Log prints a testing info log for the requiredBody Assertor
func (b *requiredBody) Log(t testing.TB) {
t.Log("Testing request for required a required body")
t.Log("Testing request for a required body value")
}

// Error prints a testing error for the requiredBody Assertor
Expand Down
6 changes: 3 additions & 3 deletions assertions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func TestAssertors_Log(t *testing.T) {
buf: &bytes.Buffer{},
},
assertor: &requiredHeaderValue{Key: "test-key", ExpectedValue: "test-value"},
expected: "Testing request for required header value [test-key: test-value]",
expected: "Testing request for a required header value [test-key: test-value]",
},
{
name: "requiredQueries Log should log the expected output when called",
Expand All @@ -331,15 +331,15 @@ func TestAssertors_Log(t *testing.T) {
buf: &bytes.Buffer{},
},
assertor: &requiredQueryValue{Key: "test-key", ExpectedValue: "test-value"},
expected: "Testing request for required query parameter value [test-key: test-value]",
expected: "Testing request for a required query parameter value [test-key: test-value]",
},
{
name: "requiredBody Log should log the expected output when called",
mockTester: &mockTester{
buf: &bytes.Buffer{},
},
assertor: &requiredBody{},
expected: "Testing request for required a required body\n",
expected: "Testing request for a required body value\n",
},
}
for _, tt := range tests {
Expand Down

0 comments on commit 774018c

Please sign in to comment.