-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathfind_struct_test.go
86 lines (73 loc) · 1.81 KB
/
find_struct_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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package test_main
import (
"testing"
. "github.com/bjartek/overflow"
"github.com/findonflow/find/findGo"
)
func TestFindStruct(t *testing.T) {
otu := NewOverflowTest(t)
t.Run("Should be able to pass in Royalty Struct", func(t *testing.T) {
otu.O.Tx(
`
import FindPack from "../contracts/FindPack.cdc"
transaction(i: FindPack.Royalty) {}
`,
WithSigner("find-admin"),
WithArg("i", findGo.FindPack_Royalty{
Recipient: otu.O.Address("find-admin"),
Cut: 0.01,
Description: "",
Extra: map[string]interface{}{},
}),
).
AssertSuccess(t)
})
t.Run("Should be able to pass in Verifier Struct", func(t *testing.T) {
otu.O.Tx(
`
import FindVerifier from "../contracts/FindVerifier.cdc"
transaction(i: {FindVerifier.Verifier}) {}
`,
WithSigner("find-admin"),
WithArg("i", findGo.FindVerifier_HasOneFLOAT{
FloatEventIds: []uint64{},
Description: "",
}),
).
AssertSuccess(t)
})
t.Run("Should be able to pass in PackRegisterSaleInfo Struct", func(t *testing.T) {
otu.O.Tx(
`
import FindPack from "../contracts/FindPack.cdc"
transaction(i: FindPack.PackRegisterSaleInfo) {}
`,
WithSigner("find-admin"),
WithArg("i", findGo.FindPack_PackRegisterSaleInfo{
Name: "feownfew",
StartTime: 0.01,
Price: 0.01,
Verifiers: []findGo.FindVerifier_HasOneFLOAT{
{
FloatEventIds: []uint64{},
Description: "",
},
},
}),
).
AssertSuccess(t)
})
t.Run("Should be able to pass in PackRegisterInfo Struct", func(t *testing.T) {
otu.O.Tx(
`
import FindPack from "../contracts/FindPack.cdc"
transaction(i: FindPack.PackRegisterInfo) {}
`,
WithSigner("find-admin"),
WithArg("i", findGo.FindPack_PackRegisterInfo{
Name: "feownfew",
}),
).
AssertSuccess(t)
})
}