Skip to content

Commit 239c816

Browse files
committed
test: ✅ use proper assert_noop!
1 parent ae7c6a5 commit 239c816

File tree

3 files changed

+60
-69
lines changed

3 files changed

+60
-69
lines changed

runtime/moonbase/tests/integration_test.rs

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,31 +1625,28 @@ fn root_can_change_default_xcm_vers() {
16251625
};
16261626
// Default XCM version is not set yet, so xtokens should fail because it does not
16271627
// know with which version to send
1628-
let result = PolkadotXcm::transfer_assets(
1629-
origin_of(AccountId::from(ALICE)),
1630-
Box::new(VersionedLocation::from(Location::parent())),
1631-
Box::new(VersionedLocation::from(Location {
1632-
parents: 0,
1633-
interior: [AccountId32 {
1634-
network: None,
1635-
id: [1u8; 32],
1636-
}]
1637-
.into(),
1638-
})),
1639-
Box::new(VersionedAssets::from(asset.clone())),
1640-
0,
1641-
WeightLimit::Unlimited,
1628+
assert_noop!(
1629+
PolkadotXcm::transfer_assets(
1630+
origin_of(AccountId::from(ALICE)),
1631+
Box::new(VersionedLocation::from(Location::parent())),
1632+
Box::new(VersionedLocation::from(Location {
1633+
parents: 0,
1634+
interior: [AccountId32 {
1635+
network: None,
1636+
id: [1u8; 32],
1637+
}]
1638+
.into(),
1639+
})),
1640+
Box::new(VersionedAssets::from(asset.clone())),
1641+
0,
1642+
WeightLimit::Unlimited,
1643+
),
1644+
pallet_xcm::Error::<Runtime>::LocalExecutionIncompleteWithError {
1645+
index: 2,
1646+
error: pallet_xcm::ExecutionError::DestinationUnsupported
1647+
}
16421648
);
16431649

1644-
assert!(matches!(
1645-
result,
1646-
Err(sp_runtime::DispatchError::Module(sp_runtime::ModuleError {
1647-
index: 28,
1648-
error: [28, 2, 13, 0],
1649-
message: Some("LocalExecutionIncompleteWithError"),
1650-
}))
1651-
));
1652-
16531650
// Root sets the defaultXcm
16541651
assert_ok!(PolkadotXcm::force_default_xcm_version(
16551652
root_origin(),

runtime/moonbeam/tests/integration_test.rs

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,31 +1145,28 @@ fn root_can_change_default_xcm_vers() {
11451145
};
11461146
// Default XCM version is not set yet, so xtokens should fail because it does not
11471147
// know with which version to send
1148-
let result = PolkadotXcm::transfer_assets(
1149-
origin_of(AccountId::from(ALICE)),
1150-
Box::new(VersionedLocation::from(Location::parent())),
1151-
Box::new(VersionedLocation::from(Location {
1152-
parents: 0,
1153-
interior: [AccountId32 {
1154-
network: None,
1155-
id: [1u8; 32],
1156-
}]
1157-
.into(),
1158-
})),
1159-
Box::new(VersionedAssets::from(asset.clone())),
1160-
0,
1161-
WeightLimit::Unlimited,
1148+
assert_noop!(
1149+
PolkadotXcm::transfer_assets(
1150+
origin_of(AccountId::from(ALICE)),
1151+
Box::new(VersionedLocation::from(Location::parent())),
1152+
Box::new(VersionedLocation::from(Location {
1153+
parents: 0,
1154+
interior: [AccountId32 {
1155+
network: None,
1156+
id: [1u8; 32],
1157+
}]
1158+
.into(),
1159+
})),
1160+
Box::new(VersionedAssets::from(asset.clone())),
1161+
0,
1162+
WeightLimit::Unlimited,
1163+
),
1164+
pallet_xcm::Error::<Runtime>::LocalExecutionIncompleteWithError {
1165+
index: 2,
1166+
error: pallet_xcm::ExecutionError::DestinationUnsupported
1167+
}
11621168
);
11631169

1164-
assert!(matches!(
1165-
result,
1166-
Err(sp_runtime::DispatchError::Module(sp_runtime::ModuleError {
1167-
index: 103,
1168-
error: [28, 2, 13, 0],
1169-
message: Some("LocalExecutionIncompleteWithError"),
1170-
}))
1171-
));
1172-
11731170
// Root sets the defaultXcm
11741171
assert_ok!(PolkadotXcm::force_default_xcm_version(
11751172
root_origin(),

runtime/moonriver/tests/integration_test.rs

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,31 +1139,28 @@ fn root_can_change_default_xcm_vers() {
11391139
};
11401140
// Default XCM version is not set yet, so xtokens should fail because it does not
11411141
// know with which version to send
1142-
let result = PolkadotXcm::transfer_assets(
1143-
origin_of(AccountId::from(ALICE)),
1144-
Box::new(VersionedLocation::from(Location::parent())),
1145-
Box::new(VersionedLocation::from(Location {
1146-
parents: 0,
1147-
interior: [AccountId32 {
1148-
network: None,
1149-
id: [1u8; 32],
1150-
}]
1151-
.into(),
1152-
})),
1153-
Box::new(VersionedAssets::from(asset.clone())),
1154-
0,
1155-
WeightLimit::Unlimited,
1142+
assert_noop!(
1143+
PolkadotXcm::transfer_assets(
1144+
origin_of(AccountId::from(ALICE)),
1145+
Box::new(VersionedLocation::from(Location::parent())),
1146+
Box::new(VersionedLocation::from(Location {
1147+
parents: 0,
1148+
interior: [AccountId32 {
1149+
network: None,
1150+
id: [1u8; 32],
1151+
}]
1152+
.into(),
1153+
})),
1154+
Box::new(VersionedAssets::from(asset.clone())),
1155+
0,
1156+
WeightLimit::Unlimited,
1157+
),
1158+
pallet_xcm::Error::<Runtime>::LocalExecutionIncompleteWithError {
1159+
index: 2,
1160+
error: pallet_xcm::ExecutionError::DestinationUnsupported
1161+
}
11561162
);
11571163

1158-
assert!(matches!(
1159-
result,
1160-
Err(sp_runtime::DispatchError::Module(sp_runtime::ModuleError {
1161-
index: 103,
1162-
error: [28, 2, 13, 0],
1163-
message: Some("LocalExecutionIncompleteWithError"),
1164-
}))
1165-
));
1166-
11671164
// Root sets the defaultXcm
11681165
assert_ok!(PolkadotXcm::force_default_xcm_version(
11691166
root_origin(),

0 commit comments

Comments
 (0)