Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
change json tag for root (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
aarshkshah1992 authored Aug 31, 2022
1 parent a10e4da commit 498773d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
// for the given root and selector.
type CARTransferRequest struct {
RequestId string
Root string
Root string `json:"cid"`
SkipOffset uint64
}

Expand Down
8 changes: 8 additions & 0 deletions types/types_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package types

import (
"encoding/json"
"testing"

"github.com/ipfs/go-cid"
Expand Down Expand Up @@ -44,6 +45,13 @@ func TestCarTransferRequest(t *testing.T) {

for name, tc := range tcs {
t.Run(name, func(t *testing.T) {
bz, err := json.Marshal(tc.cr)
require.NoError(t, err)

var cr CARTransferRequest
require.NoError(t, json.Unmarshal(bz, &cr))
require.EqualValues(t, cr.Root, tc.cr)

dr, err := tc.cr.ToDAGRequest()
if tc.isError {
require.Error(t, err)
Expand Down

0 comments on commit 498773d

Please sign in to comment.