Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jorropo <[email protected]>
  • Loading branch information
hacdias and Jorropo authored May 10, 2023
1 parent 88ba464 commit 0b41ecc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ipns/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,28 +420,28 @@ func TestValidateWithPeerID(t *testing.T) {
rnd := rand.New(rand.NewSource(42))

sk, pk, err := crypto.GenerateEd25519Key(rnd)
assert.Nil(t, err)
assert.NoError(t, err)

pid, err := peer.IDFromPublicKey(pk)
assert.Nil(t, err)
assert.NoError(t, err)

entry, err := Create(sk, path, 1, eol, 0)
assert.Nil(t, err)
assert.NoError(t, err)

t.Run("valid peer ID", func(t *testing.T) {
t.Parallel()
err = ValidateWithPeerID(pid, entry)
assert.Nil(t, err)
assert.NoError(t, err)
})

t.Run("invalid peer ID", func(t *testing.T) {
t.Parallel()

_, pk2, err := crypto.GenerateEd25519Key(rnd)
assert.Nil(t, err)
assert.NoError(t, err)

pid2, err := peer.IDFromPublicKey(pk2)
assert.Nil(t, err)
assert.NoError(t, err)

err = ValidateWithPeerID(pid2, entry)
assert.NotNil(t, err)
Expand Down

0 comments on commit 0b41ecc

Please sign in to comment.