Skip to content

Commit

Permalink
test: tidy and add test (#752)
Browse files Browse the repository at this point in the history
* test: remove reflect

* test: add additional test without a passphrase
  • Loading branch information
robdefeo authored Jan 10, 2022
1 parent 6206ef8 commit e513dcf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 1 addition & 2 deletions crypto/ed25519/private_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"crypto/rand"
"io"
"reflect"
"testing"
"testing/iotest"

Expand Down Expand Up @@ -97,7 +96,7 @@ func TestPrivateKeyFromBytes(t *testing.T) {
t.Errorf("PrivateKeyFromBytes() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
if !assert.Equal(t, tt.want, got) {
t.Errorf("PrivateKeyFromBytes() = %v, want %v", got, tt.want)
}
})
Expand Down
10 changes: 9 additions & 1 deletion internal/keystore/kdf/scrypt/scrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,21 @@ func TestDeriveKey(t *testing.T) {
wantErr bool
}{
{
"success",
"success-passphrase",
args{
[]DeriveOptionsBuilder{WithPassphrase("passphrase"), DefaultDeriveOptions()},
},
[]byte{0x14, 0x64, 0xbb, 0x68, 0x5d, 0xd1, 0x6a, 0xef, 0xe9, 0x1a, 0xe1, 0x34, 0x6d, 0x3d, 0x9a, 0x60, 0x2, 0x43, 0x1a, 0x5a, 0x1b, 0xc2, 0xde, 0xa6, 0x23, 0x35, 0xef, 0xc8, 0xad, 0x1f, 0x60, 0x1b},
false,
},
{
"success-no-passphrase",
args{
[]DeriveOptionsBuilder{DefaultDeriveOptions()},
},
[]byte{0xae, 0x51, 0xe1, 0x6a, 0x25, 0x28, 0x52, 0x2f, 0x1c, 0x61, 0x85, 0xcc, 0xed, 0xb4, 0xba, 0xb, 0x96, 0xbc, 0x3, 0x32, 0x86, 0x17, 0x2, 0x65, 0x9d, 0x26, 0xf2, 0x6c, 0x54, 0x83, 0xc2, 0xe6},
false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit e513dcf

Please sign in to comment.