Skip to content

Commit

Permalink
fix(tests): don't update ipfs golden files on every run
Browse files Browse the repository at this point in the history
  • Loading branch information
slowbackspace committed Dec 11, 2023
1 parent c5ff6df commit 89ad6f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api_addresses_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func WriteGoldenFile(t *testing.T, path string, bytes []byte) {

func ReadOrGenerateGoldenFile(t *testing.T, path string, v interface{}) []byte {
t.Helper()
b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
switch {
case errors.Is(err, os.ErrNotExist):
if *generate {
Expand Down
5 changes: 2 additions & 3 deletions ipfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package blockfrost_test
import (
"context"
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
Expand Down Expand Up @@ -75,7 +74,7 @@ func TestIPFSResourceAddIntegration(t *testing.T) {
fp_up := filepath.Join(testdata, "json", "ipfs", "ipfs_object.json")
got, err := ipfs.Add(context.TODO(), fp_up)
testErrorHelper(t, err)
*update = true
// *update = true

// want := blockfrost.IPFSObject{}
// fp_golden := filepath.Join(testdata, strings.ToLower(strings.TrimPrefix(t.Name(), "Test"))+".golden")
Expand Down Expand Up @@ -188,7 +187,7 @@ func testIPFSResourceRemoveIntegration(t *testing.T, ipfs blockfrost.IPFSClient,
func testIPFSResourceGatewayIntegration(t *testing.T, ipfs blockfrost.IPFSClient, ipfsPath string, fp_up string) {
got, err := ipfs.Gateway(context.TODO(), ipfsPath)
testErrorHelper(t, err)
want, err := ioutil.ReadFile(fp_up)
want, err := os.ReadFile(fp_up)
testErrorHelper(t, err)
if !reflect.DeepEqual(got, want) {
t.Fatalf("expected %v got %v", want, got)
Expand Down

0 comments on commit 89ad6f2

Please sign in to comment.