Skip to content

Commit 6a25758

Browse files
lklimekclaude
andcommitted
fix(test): tc_065 typed match for consensus rejection, tc_066 keep TODO
tc_065: match PlatformRejected or SdkError wrapping ConsensusError (DestinationIdentityForTokenMintingNotSetError). Added TODO for dedicated TaskError variant for token authorization errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent aa94b11 commit 6a25758

1 file changed

Lines changed: 27 additions & 13 deletions

File tree

tests/backend-e2e/token_tasks.rs

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -773,20 +773,34 @@ async fn tc_065_mint_unauthorized() {
773773
let result = run_task(&ctx.app_context, task).await;
774774
let err = result.expect_err("TC-065: unauthorized minting should fail");
775775

776-
// Platform should reject the unauthorized mint. The specific error variant
776+
// Platform rejects via consensus error in the proof. The specific variant
777777
// depends on the token contract config:
778-
// - PlatformRejected: general authorization rejection
779-
// - SdkError wrapping DestinationIdentityForTokenMintingNotSetError: no
780-
// mint destination configured on the contract
778+
// - PlatformRejected (StateTransitionBroadcastError): direct broadcast rejection
779+
// - SdkError wrapping Protocol(ConsensusError(BasicError(
780+
// DestinationIdentityForTokenMintingNotSetError))): no mint destination
781+
// configured — returned via proof verification
782+
// Both indicate the unauthorized mint was correctly rejected.
783+
// TODO: add a dedicated TaskError variant for token authorization errors
784+
// so this can use typed matching instead of Debug inspection.
781785
use dash_evo_tool::backend_task::error::TaskError;
782-
let is_rejection = matches!(
783-
&err,
784-
TaskError::PlatformRejected { .. } | TaskError::SdkError { .. }
785-
);
786-
assert!(
787-
is_rejection,
788-
"TC-065: expected platform rejection for unauthorized mint, got: {:?}",
789-
err
790-
);
786+
match &err {
787+
TaskError::PlatformRejected { .. } => {
788+
tracing::info!("TC-065: unauthorized mint rejected via broadcast");
789+
}
790+
TaskError::SdkError { source_error } => {
791+
let detail = format!("{:?}", source_error);
792+
assert!(
793+
detail.contains("DestinationIdentityForTokenMintingNotSet")
794+
|| detail.contains("ConsensusError"),
795+
"TC-065: SdkError is not a consensus rejection: {}",
796+
detail
797+
);
798+
tracing::info!("TC-065: unauthorized mint rejected via consensus error");
799+
}
800+
other => panic!(
801+
"TC-065: expected platform rejection for unauthorized mint, got: {:?}",
802+
other
803+
),
804+
}
791805
tracing::info!("TC-065: unauthorized mint correctly rejected: {:?}", err);
792806
}

0 commit comments

Comments
 (0)