-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NFT Bridging Cadence tests #24
Changes from 1 commit
d348030
ad523a2
c41d529
4f51d01
11607fa
b42be15
95bf57a
650d6ee
5e4cca7
603ed09
65e3e03
99c9c30
c12a0e2
e8c7aa1
5edd167
64159a2
a14ede1
a2026ba
9b1193f
8e4dcaf
7fc45d0
f4a4874
8af66b7
e81602e
5493944
1c0f239
d51f152
c65ce33
93ad5be
b2c036f
4ab4e7b
7780ac7
b5489c7
9a89674
7bc9b0a
83beef6
fa4e505
fe07489
0d69463
a36e872
2d5900c
47659be
9f3f0de
62a9b87
9b32c62
1f18b4a
f4342cd
c829495
5bd71ed
6caa259
d7ffaeb
ad21578
41a5102
be1e8e7
af3282c
2256c2c
12eb335
9215bb5
96fcf9a
f0959be
77109cc
fdb1921
ab8315e
84847a4
34b25cd
07aaf23
3bf3f54
45b44ac
389e9d2
113b301
ad8ca3e
87186b7
680e521
f45ad59
c4e4fa0
97cdfcd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -487,6 +487,16 @@ fun bridgeNFTToEVM(signer: Test.TestAccount, contractAddr: Address, contractName | |
signer | ||
) | ||
Test.expect(bridgeResult, Test.beSucceeded()) | ||
|
||
var events = Test.eventsOfType(Type<NonFungibleToken.Withdrawn>()) | ||
let withdrawnEvent = events[events.length - 1] as! NonFungibleToken.Withdrawn | ||
Test.assertEqual(nftID, withdrawnEvent.id) | ||
Test.assertEqual(signer.address, withdrawnEvent.from!) | ||
|
||
events = Test.eventsOfType(Type<NonFungibleToken.Deposited>()) | ||
let depositedEvent = events[events.length - 1] as! NonFungibleToken.Deposited | ||
Test.assertEqual(nftID, depositedEvent.id) | ||
Test.assertEqual(bridgeAccount.address, depositedEvent.to!) | ||
} | ||
|
||
access(all) | ||
|
@@ -497,5 +507,13 @@ fun bridgeNFTFromEVM(signer: Test.TestAccount, contractAddr: Address, contractNa | |
signer | ||
) | ||
Test.expect(bridgeResult, Test.beSucceeded()) | ||
|
||
var events = Test.eventsOfType(Type<NonFungibleToken.Withdrawn>()) | ||
let withdrawnEvent = events[events.length - 1] as! NonFungibleToken.Withdrawn | ||
Test.assertEqual(bridgeAccount.address, withdrawnEvent.from!) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to add some assertions to check the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the best way to do this would be to look for the subsequent |
||
|
||
events = Test.eventsOfType(Type<NonFungibleToken.Deposited>()) | ||
let depositedEvent = events[events.length - 1] as! NonFungibleToken.Deposited | ||
Test.assertEqual(signer.address, depositedEvent.to!) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a few more lines after this one and for the next test to verify this worked? Could be as simple as using the get ids to make sure the id still exists here in the account on the evm side, and similar for the next test. Also an event emitted check would be good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are actually helper functions, used in test cases. The actual tests do contain assertions for checking the IDs etc.
I have added some assertions about checking emitted events: f45ad59