Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ineiti committed Feb 29, 2024
1 parent c27f860 commit ccf2186
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestRegisterContract(t *testing.T) {
}

func TestNewTransaction(t *testing.T) {
mgr := NewManager(signed.NewManager(fake.NewSigner(), nil))
mgr := NewManager(signed.NewManager(fake.NewSigner(), fake.NewClient()))

tx, err := mgr.Make(authority.New(nil, nil))
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion core/txn/signed/signed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func TestTransactionFactory_Deserialize(t *testing.T) {
}

func TestManager_Make(t *testing.T) {
mgr := NewManager(fake.NewSigner(), nil)
mgr := NewManager(fake.NewSigner(), fake.NewClient())

tx, err := mgr.Make(txn.Arg{Key: "a", Value: []byte{1, 2, 3}})
require.NoError(t, err)
Expand Down
14 changes: 14 additions & 0 deletions testing/fake/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package fake
import (
"hash"

"go.dedis.ch/dela/core/access"
"go.dedis.ch/dela/crypto"
"go.dedis.ch/dela/serde"
)
Expand Down Expand Up @@ -253,6 +254,19 @@ func (s Signer) Aggregate(...crypto.Signature) (crypto.Signature, error) {
return Signature{}, s.err
}

type Client struct {
nonce uint64
}

// NewClient returns a fake client
func NewClient() Client {
return Client{}
}

func (c Client) GetNonce(access.Identity) (uint64, error) {
return c.nonce, nil
}

// Verifier is a fake implementation of crypto.Verifier.
//
// - implements crypto.Verifier
Expand Down

0 comments on commit ccf2186

Please sign in to comment.