Skip to content

Commit

Permalink
chore: fix tests for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mefellows committed Dec 9, 2022
1 parent 4daa18c commit 4cd3727
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions message/v3/asynchronous_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/pact-foundation/pact-go/v2/internal/native"
mockserver "github.com/pact-foundation/pact-go/v2/internal/native"
logging "github.com/pact-foundation/pact-go/v2/log"
"github.com/pact-foundation/pact-go/v2/models"
)

Expand Down
1 change: 1 addition & 0 deletions message/v4/asynchronous_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/pact-foundation/pact-go/v2/internal/native"
mockserver "github.com/pact-foundation/pact-go/v2/internal/native"
logging "github.com/pact-foundation/pact-go/v2/log"
"github.com/pact-foundation/pact-go/v2/models"
)

Expand Down
1 change: 1 addition & 0 deletions message/v4/synchronous_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"testing"

"github.com/pact-foundation/pact-go/v2/internal/native"
logging "github.com/pact-foundation/pact-go/v2/log"
"github.com/pact-foundation/pact-go/v2/models"
)

Expand Down
18 changes: 13 additions & 5 deletions provider/verify_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func TestVerifyRequestValidate(t *testing.T) {
name string
request *VerifyRequest
err bool
panic bool
}{
{name: "valid parameters", request: &VerifyRequest{
PactURLs: []string{"http://localhost:1234/path/to/pact"},
Expand All @@ -25,15 +26,21 @@ func TestVerifyRequestValidate(t *testing.T) {
}, err: false},
{name: "no base URL provided", request: &VerifyRequest{
PactURLs: []string{"http://localhost:1234/path/to/pact"},
}, err: true},
}, err: true, panic: true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := tt.request.validate(handle)
if tt.err {
assert.Error(t, err)
if tt.panic {
assert.Panics(t, (func() {
tt.request.validate(handle)
}))
} else {
assert.NoError(t, err)
err := tt.request.validate(handle)
if tt.err {
assert.Error(t, err)
} else {
assert.NoError(t, err)
}
}
})
}
Expand All @@ -55,6 +62,7 @@ func TestVerifyRequestValidate(t *testing.T) {
}, err: true},
{name: "broker url without name/version", request: &VerifyRequest{
BrokerURL: "http://localhost:1234",
ProviderBaseURL: "http://localhost:8080",
ProviderVersion: "1.0.0",
BrokerPassword: "1234",
}, err: true},
Expand Down

0 comments on commit 4cd3727

Please sign in to comment.