Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
chungquantin committed Nov 26, 2024
1 parent 5212a5a commit 519a144
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions pallets/nfts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2383,14 +2383,20 @@ fn clear_all_transfer_approvals_works() {
));

assert_noop!(
Nfts::clear_all_transfer_approvals(RuntimeOrigin::signed(account(3)), 0, Some(42)),
Nfts::clear_all_transfer_approvals(
RuntimeOrigin::signed(account(3)),
0,
Some(42),
ClearAllApprovalsWitness { allowances: 0 }
),
Error::<Test>::NoPermission
);

assert_ok!(Nfts::clear_all_transfer_approvals(
RuntimeOrigin::signed(account(2)),
0,
Some(42)
Some(42),
ClearAllApprovalsWitness { allowances: 0 }
));

assert!(events().contains(&Event::<Test>::AllApprovalsCancelled {
Expand Down Expand Up @@ -2443,11 +2449,31 @@ fn clear_all_collection_approvals_works() {
));

assert_noop!(
Nfts::clear_all_transfer_approvals(RuntimeOrigin::signed(account(2)), 0, None),
Nfts::clear_all_transfer_approvals(
RuntimeOrigin::signed(account(2)),
0,
None,
ClearAllApprovalsWitness { allowances: 2 }
),
Error::<Test>::NoPermission
);

assert_ok!(Nfts::clear_all_transfer_approvals(RuntimeOrigin::signed(account(1)), 0, None));
assert_noop!(
Nfts::clear_all_transfer_approvals(
RuntimeOrigin::signed(account(1)),
0,
None,
ClearAllApprovalsWitness { allowances: 1 }
),
Error::<Test>::BadWitness
);

assert_ok!(Nfts::clear_all_transfer_approvals(
RuntimeOrigin::signed(account(1)),
0,
None,
ClearAllApprovalsWitness { allowances: 2 }
));
assert!(events().contains(&Event::<Test>::AllApprovalsCancelled {
collection: 0,
item: None,
Expand Down

0 comments on commit 519a144

Please sign in to comment.