Skip to content

Commit

Permalink
fix: test data read
Browse files Browse the repository at this point in the history
  • Loading branch information
istae committed Sep 27, 2023
1 parent 00dbc12 commit 23f306d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/storageincentives/proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package storageincentives_test

import (
"bytes"
_ "embed"
"encoding/json"
"fmt"
"math/big"
"os"
"testing"

"github.com/ethersphere/bee/pkg/cac"
Expand Down Expand Up @@ -38,6 +38,9 @@ func TestMakeInclusionProofs(t *testing.T) {
}
}

//go:embed testdata/inclusion-proofs.json
var testData []byte

// Test asserts that MakeInclusionProofs will generate the same
// output for given sample.
func TestMakeInclusionProofsRegression(t *testing.T) {
Expand Down Expand Up @@ -111,10 +114,12 @@ func TestMakeInclusionProofsRegression(t *testing.T) {
t.Fatal(err)
}

expectedProofs := redistribution.ChunkInclusionProofs{}
var expectedProofs redistribution.ChunkInclusionProofs

data, _ := os.ReadFile("testdata/inclusion-proofs.json")
_ = json.Unmarshal(data, &expectedProofs)
err = json.Unmarshal(testData, &expectedProofs)
if err != nil {
t.Fatal(err)
}

if diff := cmp.Diff(proofs, expectedProofs); diff != "" {
t.Fatalf("unexpected inclusion proofs (-want +have):\n%s", diff)
Expand Down

0 comments on commit 23f306d

Please sign in to comment.