Skip to content

Commit

Permalink
🚨 Fix 'testpackage'.
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
  • Loading branch information
ggwpez committed Nov 18, 2021
1 parent d73e3ad commit 9a02add
Show file tree
Hide file tree
Showing 42 changed files with 29 additions and 50 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions client/proposal_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"math/rand"
"testing"

"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"perun.network/go-perun/channel"
Expand Down Expand Up @@ -100,6 +102,33 @@ func TestChannelProposal_assertValidNumParts(t *testing.T) {
require.Error(c.assertValidNumParts())
}

func TestProposalResponder_Accept_Nil(t *testing.T) {
p := new(ProposalResponder)
_, err := p.Accept(nil, new(LedgerChannelProposalAcc))
assert.Error(t, err, "context")
}

func TestPeerRejectedProposalError(t *testing.T) {
reason := "some-random-reason"
err := newPeerRejectedError("update", reason)
t.Run("direct_error", func(t *testing.T) {
peerRejectedProposalError := PeerRejectedError{}
gotPeerRejectedError := errors.As(err, &peerRejectedProposalError)
require.True(t, gotPeerRejectedError)
assert.Equal(t, reason, peerRejectedProposalError.Reason)
assert.Contains(t, err.Error(), reason)
})

t.Run("wrapped_error", func(t *testing.T) {
wrappedError := errors.WithMessage(err, "some higher level error")
peerRejectedError := PeerRejectedError{}
gotPeerRejectedError := errors.As(wrappedError, &peerRejectedError)
require.True(t, gotPeerRejectedError)
assert.Equal(t, reason, peerRejectedError.Reason)
assert.Contains(t, err.Error(), reason)
})
}

func NewRandomBaseChannelProposal(rng *rand.Rand, opts ...channeltest.RandomOpt) BaseChannelProposal {
var opt channeltest.RandomOpt
if len(opts) != 0 {
Expand Down
50 changes: 0 additions & 50 deletions client/proposal_test.go

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 9a02add

Please sign in to comment.