-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathfind_wearable_test.go
89 lines (71 loc) · 2.06 KB
/
find_wearable_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
87
88
89
package test_main
import (
"testing"
. "github.com/bjartek/overflow"
"github.com/hexops/autogold"
)
func TestFindWearables(t *testing.T) {
otu := NewOverflowTest(t).
setupFIND().
createWearableUser("user1")
id1 := otu.mintWearables("user1")
id2 := otu.mintWearables("user1")
id3 := otu.mintWearables("user1")
user2 := otu.O.Address("user2")
user3 := otu.O.Address("user3")
t.Run("Should be able to send Wearables using Airdrop", func(t *testing.T) {
otu.createWearableUser("user2")
res := otu.O.Tx(
"sendWearables",
WithSigner("user1"),
WithArg("allReceivers", []string{user2, user3, user2}),
WithArg("ids", []uint64{id1, id2, id3}),
WithArg("memos", []string{"1", "2", "3"}),
).
AssertSuccess(t)
res.AssertEvent(t, "Airdropped", map[string]interface{}{
"from": otu.O.Address("user1"),
"to": otu.O.Address("user2"),
"uuid": id1,
"context": map[string]interface{}{
"tenant": "find",
"message": "1",
},
})
res.AssertEvent(t, "Airdropped", map[string]interface{}{
"from": otu.O.Address("user1"),
"to": otu.O.Address("user2"),
"uuid": id3,
"context": map[string]interface{}{
"tenant": "find",
"message": "3",
},
})
res.AssertEvent(t, "AirdropFailed", map[string]interface{}{
"from": otu.O.Address("user1"),
"to": otu.O.Address("user3"),
"uuid": id2,
"context": map[string]interface{}{
"tenant": "find",
"message": "2",
},
"reason": "Invalid Receiver Capability",
})
})
t.Run("Should be able to getFindStatus with user that has wearables set", func(t *testing.T) {
otu.createUser(10.0, "user2")
otu.O.Script(
"getFindStatus",
WithArg("user", user2),
).
AssertWithPointerWant(t, "/readyForWearables", autogold.Want("should be ready", true))
})
t.Run("Should be able to getFindStatus with user that doesnt has wearables set", func(t *testing.T) {
otu.createUser(10.0, "user3")
otu.O.Script(
"getFindStatus",
WithArg("user", user3),
).
AssertWithPointerWant(t, "/readyForWearables", autogold.Want("should be not ready", false))
})
}