Skip to content

Commit

Permalink
add test comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Apr 6, 2024
1 parent 642227f commit 81fab9a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cadence/tests/flow_evm_bridge_tests.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,15 @@ fun setup() {
Test.expect(err, Test.beNil())
}

/* --- ASSET & ACCOUNT SETUP - Configure test accounts with assets to bridge --- */

access(all)
fun testCreateCOASucceeds() {
transferFlow(signer: serviceAccount, recipient: alice.address, amount: 1_000.0)
createCOA(signer: alice, fundingAmount: 100.0)

let coaAddressHex = getCOAAddressHex(atFlowAddress: alice.address)
Test.assertEqual(40, coaAddressHex!.length)
Test.assertEqual(40, coaAddressHex.length)
}

access(all)
Expand Down Expand Up @@ -323,6 +325,8 @@ fun testMintERC20Succeeds() {
Test.assertEqual(erc20MintAmount, aliceBalance)
}

/* --- ONBOARDING - Test asset onboarding to the bridge --- */

access(all)
fun testOnboardNFTByTypeSucceeds() {
var onboaringRequiredResult = executeScript(
Expand Down Expand Up @@ -461,6 +465,8 @@ fun testOnboardERC20ByEVMAddressSucceeds() {
Test.expect(onboardingResult, Test.beFailed())
}

/* --- BRIDGING NFTS - Test bridging both Cadence- & EVM-native NFTs --- */

access(all)
fun testBridgeCadenceNativeNFTToEVMSucceeds() {
var aliceOwnedIDs = getIDs(ownerAddr: alice.address, storagePathIdentifier: "cadenceExampleNFTCollection")
Expand Down Expand Up @@ -559,6 +565,8 @@ fun testBridgeEVMNativeNFTToEVMSucceeds() {
Test.assertEqual(true, aliceIsOwner)
}

/* --- BRIDGING FUNGIBLE TOKENS - Test bridging both Cadence- & EVM-native fungible tokens --- */

access(all)
fun testBridgeCadenceNativeTokenToEVMSucceeds() {
var cadenceBalance = getBalance(ownerAddr: alice.address, storagePathIdentifier: "exampleTokenVault")
Expand Down Expand Up @@ -721,6 +729,10 @@ fun testBridgeEVMNativeTokenToEVMSucceeds() {
Test.assertEqual(UInt256(0), bridgeCOAEscrowBalance)
}

/* ---------------------------------------------- */
/* --------------- END TEST CASES --------------- */
/* ---------------------------------------------- */

/* --- Script Helpers --- */

access(all)
Expand Down Expand Up @@ -923,7 +935,7 @@ fun bridgeTokensFromEVM(signer: Test.TestAccount, contractAddr: Address, contrac
[contractAddr, contractName, amount],
signer
)
Test.assert(bridgeResult.error == nil, message: "Could not construct Vault type of: " .concat(contractAddr.toString()).concat(".").concat(contractName).concat(".Vault"))
Test.expect(bridgeResult, Test.beSucceeded())

// TODO: Add event assertions on bridge events. We can't currently import the event types to do this
// so state assertions beyond call scope will need to suffice for now
Expand Down

0 comments on commit 81fab9a

Please sign in to comment.