Skip to content

Feat/unit tests propertyregistry#25

Merged
LaGodxy merged 4 commits into
MettaChain:mainfrom
FabianSanchezD:feat/unit-tests-propertyregistry
Jan 26, 2026
Merged

Feat/unit tests propertyregistry#25
LaGodxy merged 4 commits into
MettaChain:mainfrom
FabianSanchezD:feat/unit-tests-propertyregistry

Conversation

@FabianSanchezD

Copy link
Copy Markdown
Contributor

Add Comprehensive Unit Tests for PropertyRegistry

Overview

This PR implements a comprehensive unit test suite for the PropertyRegistry contract, ensuring robust test coverage for all core functionality, edge cases, and error handling scenarios.

Changes

Unit Test Suite (contracts/lib/src/tests.rs)

  • Core functionality tests: Property registration, transfers, ownership verification, metadata handling
  • Edge cases: Max values, zero values, empty strings, special characters, Unicode support
  • Error handling: Unauthorized transfers, non-existent properties, invalid operations
  • Performance tests: Bulk operations, large property lists, consistency under load
  • Event verification: Tests ensure proper event emission for all state changes

CI/CD Integration

  • Added unit test execution to main CI workflow
  • Created dedicated test.yml workflow for unit tests
  • Tests run automatically on push and pull requests
  • Proper caching configuration for faster CI runs

🧹 Code Cleanup

  • Removed unused imports from lib.rs and traits/lib.rs

Test Coverage

The test suite covers:

  • ✅ Property registration and ID generation
  • ✅ Property transfers and ownership updates
  • ✅ Owner property lists management
  • ✅ Metadata preservation and immutability
  • ✅ Error conditions (unauthorized, not found, etc.)
  • ✅ Edge cases (max values, empty strings, Unicode)
  • ✅ Performance scenarios (bulk operations, large datasets)
  • ✅ Event emission verification
  • ✅ Timestamp accuracy

Testing

All tests pass locally and are integrated into the CI/CD pipeline. The test suite can be run with:

cd contracts/lib
cargo test --lib

This is how it looks:
image

Related

Closes #8


Note: Compliments are greatly appreciated! I'm available to contribute any time and happy to help with further improvements or additional features. 🚀

@LaGodxy

LaGodxy commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

@FabianSanchezD resolve conflict.

@FabianSanchezD

Copy link
Copy Markdown
Contributor Author

Didn't saw the message earlier, mb

@LaGodxy LaGodxy merged commit fcec2d6 into MettaChain:main Jan 26, 2026
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.

Comprehensive Unit Test Suite

2 participants