sim test nft_revoke_all
@@ -118,3 +118,38 @@ fn simulate_revoke() {
.unwrap_json();
assert!(!token_receiver_approved);
}
+
+#[test]
+fn simulate_revoke_all() {
+ let (root, nft, alice, token_receiver) = init();
+
+ // root approves alice
+ call!(
+ root,
+ nft.nft_approve(TOKEN_ID.into(), alice.valid_account_id(), None),
+ deposit = 170000000000000000000
+ )
+ .assert_success();
+
+ // root approves token_receiver
+ call!(
+ root,
+ nft.nft_approve(TOKEN_ID.into(), token_receiver.valid_account_id(), None),
+ deposit = 260000000000000000000
+ )
+ .assert_success();
+
+ // root revokes all
+ call!(root, nft.nft_revoke_all(TOKEN_ID.into()), deposit = 1).assert_success();
+
+ // alice is revoked...
+ let alice_approved: bool =
+ view!(nft.nft_is_approved(TOKEN_ID.into(), alice.valid_account_id(), None)).unwrap_json();
+ assert!(!alice_approved);
+
+ // but token_receiver is still approved
+ let token_receiver_approved: bool =
+ view!(nft.nft_is_approved(TOKEN_ID.into(), token_receiver.valid_account_id(), None))
+ .unwrap_json();
+ assert!(!token_receiver_approved);
+}
