-
Notifications
You must be signed in to change notification settings - Fork 6
/
opensea-model_test.go
57 lines (44 loc) · 1.09 KB
/
opensea-model_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
package opensea
import (
"encoding/json"
"github.com/stretchr/testify/assert"
"io/ioutil"
"log"
"testing"
)
func TestAssetResponse(t *testing.T) {
inputFile, err := ioutil.ReadFile("test-files/opensea-assets-collectibles.json")
if err != nil {
log.Fatalf("file not found...")
}
osAsset := &AssetResponse{}
err = json.Unmarshal(inputFile, osAsset)
if err != nil {
assert.FailNow(t, err.Error())
}
assert.NotNil(t, osAsset)
}
func TestStatResponse(t *testing.T) {
inputFile, err := ioutil.ReadFile("test-files/opensea-stats-doodles.json")
if err != nil {
log.Fatalf("file not found...")
}
osStat := &StatResponse{}
err = json.Unmarshal(inputFile, osStat)
if err != nil {
assert.FailNow(t, err.Error())
}
assert.NotNil(t, osStat)
}
func TestSingleCollectionResponse(t *testing.T) {
inputFile, err := ioutil.ReadFile("test-files/opensea-collection-doodles.json")
if err != nil {
log.Fatalf("file not found...")
}
osColl := &CollectionSingleResponse{}
err = json.Unmarshal(inputFile, osColl)
if err != nil {
assert.FailNow(t, err.Error())
}
assert.NotNil(t, osColl)
}