Skip to content

Commit 0b8e196

Browse files
committed
Added a new test case, apply_to_marketplace_without_fields_shouldnt_work, to the Gated Marketplace pallet. This test verifies that an application without any fields leads to the FieldsNotProvided error. It enhances the test coverage for the apply function, ensuring it robustly catches instance where application fields are not provided as intended.
1 parent 3d96012 commit 0b8e196

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

pallets/gated-marketplace/src/tests.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,33 @@ fn apply_to_marketplace_works() {
244244
});
245245
}
246246

247+
#[test]
248+
fn apply_to_marketplace_without_fields_shouldnt_work() {
249+
new_test_ext().execute_with(|| {
250+
Balances::make_free_balance_be(&1, 100);
251+
// Dispatch a signed extrinsic.
252+
let m_label = create_label("my marketplace");
253+
assert_ok!(GatedMarketplace::create_marketplace(
254+
RuntimeOrigin::signed(1),
255+
2,
256+
m_label.clone(),
257+
500,
258+
600,
259+
1,
260+
));
261+
let m_id = get_marketplace_id("my marketplace", 500, 600, 1);
262+
assert_noop!(
263+
GatedMarketplace::apply(
264+
RuntimeOrigin::signed(3),
265+
m_id,
266+
create_application_fields(0),
267+
None
268+
),
269+
Error::<Test>::FieldsNotProvided
270+
);
271+
});
272+
}
273+
247274
#[test]
248275
fn apply_with_custodian_works() {
249276
new_test_ext().execute_with(|| {

0 commit comments

Comments
 (0)