-
Notifications
You must be signed in to change notification settings - Fork 23
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
test: update test for reject_land and update fn #115
base: main
Are you sure you want to change the base?
Conversation
@fishonamos ready for review. |
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.
Aside the review above. Everyother thing looks good!.
fn test_can_reject_land_by_owner() { | ||
let contract_address = deploy("LandRegistryContract"); | ||
let land_register_dispatcher = ILandRegistryDispatcher { contract_address }; | ||
|
||
// Set up test data | ||
let owner_address = starknet::contract_address_const::<0x123>(); | ||
let inspector_address = starknet::contract_address_const::<0x456>(); | ||
let location = Location { latitude: 1, longitude: 2 }; | ||
let area = 1000; | ||
let land_use = LandUse::Residential; | ||
|
||
// Register land as owner | ||
start_cheat_caller_address(contract_address, owner_address); | ||
let land_id = land_register_dispatcher.register_land(location, area, land_use); | ||
|
||
// Verify initial status | ||
let land_before = land_register_dispatcher.get_land(land_id); | ||
assert_eq!(land_before.status, LandStatus::Pending, "Should be pending before reject"); | ||
|
||
// Owner rejects their own land | ||
land_register_dispatcher.reject_land(land_id); | ||
|
||
// Verify final status | ||
let land_after = land_register_dispatcher.get_land(land_id); | ||
assert_eq!(land_after.status, LandStatus::Rejected, "Should be rejected after"); | ||
|
||
stop_cheat_caller_address(contract_address); | ||
} |
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.
Only inspectors should be able to reject land
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.
Basically, below is the process follow:
Register Land
Approve or Reject Land --- Inspector only
If appproved land, land nft is minted. Else, land is rejected. Only approved lands are valid and issued with NFts. Unapproved lands have the id as reference but don't have an associtated nft.
Detailed Information
Update test file to implement test for reject_land and update_land fn
Related Issues
Closes #50
Type of Change
Checklist (select as many as applicable)