using testify instead of testing.T methods. (#143)

This commit is contained in:
K
2024-09-09 13:50:56 +03:30
committed by GitHub
parent b2692a2584
commit c91e7b9765
21 changed files with 473 additions and 643 deletions

View File

@@ -6,10 +6,14 @@ import (
"testing"
"github.com/nbd-wtf/go-nostr"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestUpload(t *testing.T) {
img, _ := os.Open("./testdata/image.png")
img, err := os.Open("./testdata/image.png")
require.NoError(t, err)
defer img.Close()
ctx := context.Background()
@@ -24,9 +28,7 @@ func TestUpload(t *testing.T) {
ContentType: "image/png",
NoTransform: true,
})
if err != nil {
t.Fatal(err, "client.Upload")
}
assert.NoError(t, err)
t.Logf("resp: %#v\n", *resp)
// nip96_test.go:28: resp: nip96.UploadResponse{Status:"success", Message:"Upload successful.", ProcessingURL:"", Nip94Event:struct { Tags nostr.Tags "json:\"tags\"" }{Tags:nostr.Tags{nostr.Tag{"url", "https://image.nostr.build/4ece05f1d77c9cb97d334ba9c0301b2960640df89bf5d75d6bffadefc4355673.jpg"}, nostr.Tag{"ox", "4ece05f1d77c9cb97d334ba9c0301b2960640df89bf5d75d6bffadefc4355673"}, nostr.Tag{"x", ""}, nostr.Tag{"m", "image/jpeg"}, nostr.Tag{"dim", "1125x750"}, nostr.Tag{"bh", "LLF=kB-;yH-;-;R#t7xKEZWA#_oM"}, nostr.Tag{"blurhash", "LLF=kB-;yH-;-;R#t7xKEZWA#_oM"}, nostr.Tag{"thumb", "https://image.nostr.build/thumb/4ece05f1d77c9cb97d334ba9c0301b2960640df89bf5d75d6bffadefc4355673.jpg"}}}}