-
Notifications
You must be signed in to change notification settings - Fork 8
/
find_furnace_test.go
61 lines (49 loc) · 1.31 KB
/
find_furnace_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 test_main
import (
"fmt"
"testing"
. "github.com/bjartek/overflow"
)
func TestFindFurnace(t *testing.T) {
otu := NewOverflowTest(t).
setupFIND().
setupDandy("user1")
dandyType := otu.identifier("Dandy", "NFT")
otu.mintThreeExampleDandies()
otu.registerDandyInNFTRegistry()
t.Run("Should be able to burn Dandy", func(t *testing.T) {
ids := otu.mintThreeExampleDandies()
res := otu.O.Tx("burnNFTs",
WithSigner("user1"),
WithArg("types", []string{dandyType, dandyType, dandyType}),
WithArg("ids", ids),
WithArg("messages", []string{"Message 0", "Message 1", "Message 2"}),
).
AssertSuccess(t)
for i, id := range ids {
events := res.GetEventsWithName("FindFurnace.Burned")
mockField := map[string]interface{}{}
for _, e := range events {
field, exist := e.Fields["nftInfo"].(map[string]interface{})
if exist {
mockId := field["id"].(uint64)
if id == mockId {
field["id"] = id
field["type"] = dandyType
mockField = field
}
}
}
res.AssertEvent(t, "FindFurnace.Burned", map[string]interface{}{
"from": otu.O.Address("user1"),
"fromName": "user1",
"uuid": id,
"context": map[string]interface{}{
"message": fmt.Sprintf("Message %d", i),
"tenant": "find",
},
"nftInfo": mockField,
})
}
})
}