Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Apr 16, 2024
1 parent d2b94c5 commit 5d50e09
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
9 changes: 3 additions & 6 deletions cadence/scripts/bridge/type_requires_onboarding.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ import "FlowEVMBridge"

/// Returns whether a type needs to be onboarded to the FlowEVMBridge
///
/// @param identifier: The identifier of the Cadence Type in question
/// @param type: The Cadence Type in question
///
/// @return Whether the type requires onboarding to the FlowEVMBridge if the type is bridgeable, otherwise nil
///
access(all) fun main(identifier: String): Bool? {
if let type = CompositeType(identifier) {
return FlowEVMBridge.typeRequiresOnboarding(type)
}
return nil
access(all) fun main(type: Type): Bool? {
return FlowEVMBridge.typeRequiresOnboarding(type)
}
14 changes: 14 additions & 0 deletions cadence/scripts/bridge/type_requires_onboarding_by_identifier.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import "FlowEVMBridge"

/// Returns whether a type needs to be onboarded to the FlowEVMBridge
///
/// @param identifier: The identifier of the Cadence Type in question
///
/// @return Whether the type requires onboarding to the FlowEVMBridge if the type is bridgeable, otherwise nil
///
access(all) fun main(identifier: String): Bool? {
if let type = CompositeType(identifier) {
return FlowEVMBridge.typeRequiresOnboarding(type)
}
return nil
}
18 changes: 9 additions & 9 deletions cadence/tests/flow_evm_bridge_tests.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -440,31 +440,31 @@ fun testUpdateBridgeFeesSucceeds() {

access(all)
fun testOnboardNFTByTypeSucceeds() {
var onboaringRequiredResult = executeScript(
"../scripts/bridge/type_requires_onboarding.cdc",
var onboaringRequiredResult: Test.ScriptResult = executeScript(
"../scripts/bridge/type_requires_onboarding_by_identifier.cdc",
[exampleNFTIdentifier]
)
Test.expect(onboaringRequiredResult, Test.beSucceeded())
var requiresOnboarding = onboaringRequiredResult.returnValue as! Bool? ?? panic("Problem getting onboarding requirement")
Test.assertEqual(true, requiresOnboarding)

var onboardingResult = executeTransaction(
"../transactions/bridge/onboarding/onboard_by_type.cdc",
"../transactions/bridge/onboarding/onboard_by_type_identifier.cdc",
[exampleNFTIdentifier],
alice
)
Test.expect(onboardingResult, Test.beSucceeded())

onboaringRequiredResult = executeScript(
"../scripts/bridge/type_requires_onboarding.cdc",
"../scripts/bridge/type_requires_onboarding_by_identifier.cdc",
[exampleNFTIdentifier]
)
Test.expect(onboaringRequiredResult, Test.beSucceeded())
requiresOnboarding = onboaringRequiredResult.returnValue as! Bool? ?? panic("Problem getting onboarding requirement")
Test.assertEqual(false, requiresOnboarding)

onboardingResult = executeTransaction(
"../transactions/bridge/onboarding/onboard_by_type.cdc",
"../transactions/bridge/onboarding/onboard_by_type_identifier.cdc",
[exampleNFTIdentifier],
alice
)
Expand Down Expand Up @@ -510,30 +510,30 @@ fun testOnboardERC721ByEVMAddressSucceeds() {
access(all)
fun testOnboardTokenByTypeSucceeds() {
var onboaringRequiredResult = executeScript(
"../scripts/bridge/type_requires_onboarding.cdc",
"../scripts/bridge/type_requires_onboarding_by_identifier.cdc",
[exampleTokenIdentifier]
)
Test.expect(onboaringRequiredResult, Test.beSucceeded())
var requiresOnboarding = onboaringRequiredResult.returnValue as! Bool? ?? panic("Problem getting onboarding requirement")
Test.assertEqual(true, requiresOnboarding)

var onboardingResult = executeTransaction(
"../transactions/bridge/onboarding/onboard_by_type.cdc",
"../transactions/bridge/onboarding/onboard_by_type_identifier.cdc",
[exampleTokenIdentifier],
alice
)
Test.expect(onboardingResult, Test.beSucceeded())

onboaringRequiredResult = executeScript(
"../scripts/bridge/type_requires_onboarding.cdc",
"../scripts/bridge/type_requires_onboarding_by_identifier.cdc",
[exampleTokenIdentifier]
)
Test.expect(onboaringRequiredResult, Test.beSucceeded())
requiresOnboarding = onboaringRequiredResult.returnValue as! Bool? ?? panic("Problem getting onboarding requirement")
Test.assertEqual(false, requiresOnboarding)

onboardingResult = executeTransaction(
"../transactions/bridge/onboarding/onboard_by_type.cdc",
"../transactions/bridge/onboarding/onboard_by_type_identifier.cdc",
[exampleTokenIdentifier],
alice
)
Expand Down

0 comments on commit 5d50e09

Please sign in to comment.