Skip to content

Commit

Permalink
test ok with set_contract_address
Browse files Browse the repository at this point in the history
  • Loading branch information
julienbrs committed Nov 21, 2023
1 parent 6d029f5 commit 2a1a618
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions listings/ch00-getting-started/constructor/src/tests.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mod tests {
use constructor::constructor::ExampleConstructor::{names};
use debug::PrintTrait;
use starknet::{deploy_syscall, ContractAddress, contract_address_const};
use starknet::testing::{set_contract_address};
use starknet::class_hash::Felt252TryIntoClassHash;

#[test]
Expand All @@ -23,10 +24,10 @@ mod tests {
.unwrap();

let mut state = ExampleConstructor::unsafe_new_contract_state();
set_contract_address(address_0);

let name: felt252 = names::InternalContractMemberStateTrait::read(@state.names, address);

name.print();

assert(name == 'bob', 'name should be bob');
}
}
Expand Down

0 comments on commit 2a1a618

Please sign in to comment.