Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Kingsuite
Copy link

Detailed Information

Update test file to implement test for reject_land and update_land fn

Related Issues

Closes #50


Type of Change

  • 🐛 Bug fix or ⚙️ enhancement
  • ✨ New feature or Chore (change with no new features or fixes)
  • 📚 Documentation update
  • test

Checklist (select as many as applicable)

  • The code follows the style guidelines of this project.
  • All new and existing tests pass.
  • This pull request is ready to be merged and reviewed.

@fishonamos fishonamos self-requested a review October 31, 2024 09:31
@Kingsuite
Copy link
Author

@fishonamos ready for review.

Copy link
Member

@fishonamos fishonamos left a 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!.

Comment on lines 392 to 419
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);
}
Copy link
Member

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

Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test update land and reject land
2 participants