-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmanifets_test.go
61 lines (51 loc) · 1.56 KB
/
manifets_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package arseeding
import (
"context"
"encoding/json"
"github.com/everFinance/arseeding/argraphql"
"github.com/everFinance/arseeding/schema"
"github.com/everFinance/goar/utils"
"github.com/stretchr/testify/assert"
"net/http"
"testing"
)
func Test_getRawById(t *testing.T) {
data, contentType, err := getRawById("U1FqvR_xTuL2qxrJDw20oIghpGt1eTumJ9ZfCczc5_M")
if err != nil {
t.Error(err)
}
t.Log(err)
t.Log(contentType)
t.Log(string(data))
mani := schema.ManifestData{}
err = json.Unmarshal(data, &mani)
t.Log(err)
}
func TestNewS3Store(t *testing.T) {
err := syncManifestData("yy8F4i6jKVKtQuOw2q8RwxjQyUwJ4QtGRkdUXd8jbEw", nil)
assert.NoError(t, err)
}
func Test_getRawById1(t *testing.T) {
data, contentType, err := getRawById("AjV6oRKHh5PPI8Ehu9hIyWEz3oFAm5K0I0UYkxjwLdE")
assert.NoError(t, err)
t.Log(contentType)
bundle, err := utils.DecodeBundle(data)
assert.NoError(t, err)
assert.Equal(t, 2, len(bundle.Items))
}
func Test_getNestBundle(t *testing.T) {
itemIds := []string{"lfjl4f5joOhNT_VNDb7aaOqbwafgdXYkqXtAN3u0SUM"}
items, err := getNestBundle("mKg9fvDQ_qFZE2sSPm3fG01jfV5HoA1YnauXwuAwmlw", itemIds)
assert.NoError(t, err)
assert.Equal(t, 1, len(items))
t.Log(items[0].Id)
}
func TestNewCache(t *testing.T) {
nestBundle := "AjV6oRKHh5PPI8Ehu9hIyWEz3oFAm5K0I0UYkxjwLdE"
gq := argraphql.NewARGraphQL("https://arweave.net/graphql", http.Client{})
res, err := gq.QueryTransaction(context.Background(), nestBundle)
assert.NoError(t, err)
t.Log(res.GetTransaction().BundledIn.Id)
t.Log(res.Transaction.Data.Size)
t.Log(res.Transaction.Id)
}