-
Notifications
You must be signed in to change notification settings - Fork 2
chore: nft contract tests #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far, so good!
src/nft_contract/src/test.nr
Outdated
// mod transfer_in_private; | ||
// mod transfer_in_public; | ||
// mod transfer_to_private; | ||
// mod transfer_to_public; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enable all tests
src/nft_contract/src/main.nr
Outdated
@@ -3,6 +3,7 @@ mod test; | |||
|
|||
use aztec::macros::aztec; | |||
|
|||
/// @dev NFT only supports public minting and public/private transfers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no longer relevant
@@ -1,5 +1,6 @@ | |||
use aztec::{ | |||
context::{PrivateContext, UnconstrainedContext}, | |||
context::{PrivateContext, UtilityContext}, | |||
macros::functions::utility, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we using #[utility]
in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes for:
#[utility]
unconstrained fn get_private_nfts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking really really good! Some small comments and I'm good to approve!
|
||
// Verify initial state | ||
utils::assert_owns_private_nft(nft_contract_address, owner, token_id); | ||
assert(utils::get_nft_exists(nft_contract_address, token_id), "NFT should exist before burn"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: get_nft_exists
could be a method of utils
(utils::assert_nft_exists
) like assert_owns_private_nft
is. just for consistency
src/nft_contract/src/test/view.nr
Outdated
#[test] | ||
unconstrained fn name_is_set() { | ||
let (env, nft_contract_address, owner, minter, recipient) = utils::setup_with_minter(false); | ||
|
||
let name = NFT::at(nft_contract_address).public_get_name().view(&mut env.public()); | ||
let expected_name = FieldCompressedString::from_string("TestNFT000000000000000000000000"); | ||
assert(name == expected_name, "name is not set correctly"); | ||
} | ||
|
||
#[test] | ||
unconstrained fn symbol_is_set() { | ||
let (env, nft_contract_address, owner, minter, recipient) = utils::setup_with_minter(false); | ||
|
||
let symbol = NFT::at(nft_contract_address).public_get_symbol().view(&mut env.public()); | ||
let expected_symbol = FieldCompressedString::from_string("TNFT000000000000000000000000000"); | ||
assert(symbol == expected_symbol, "symbol is not set correctly"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, we should add these tests (and getters) on the token @0xShaito u tracking this?
closes AZT-158