diff --git a/docs/RepositoryExplorerTest.md b/docs/RepositoryExplorerTest.md new file mode 100644 index 0000000..34c1e38 --- /dev/null +++ b/docs/RepositoryExplorerTest.md @@ -0,0 +1,52 @@ +## Overview +The `RepositoryExplorerTest` contract is a comprehensive test suite for the RepositoryExplorer and Repository smart contracts, designed to validate core repository management functionality on the ChunkNet blockchain environment. + +## Interface + +| Function | Parameters | Returns | Description | +|----------|------------|---------|-------------| +| `setUp()` | None | None | Initializes test environment with owner and test user | +| `testCreateRepository()` | None | None | Validates repository creation process | +| `testAddRepositoryContent()` | None | None | Tests adding content to a repository | +| `testTransferRepositoryOwnership()` | None | None | Checks repository ownership transfer mechanism | +| `testCannotCreateRepositoryWithEmptyName()` | None | None | Ensures empty repository names are rejected | +| `testMultipleRepositoryCreation()` | None | None | Verifies multiple repository creation | +| `testRepositoryContentLimits()` | None | None | Validates content addition limits | + +## Events +No explicit events are tested in this contract, but the underlying Repository contract likely emits events for: +- Repository Creation +- Content Addition +- Ownership Transfer + +## Storage Layout +- `repositoryExplorer`: RepositoryExplorer contract instance +- `repository`: Repository contract instance +- `owner`: Contract deployer address +- `testUser`: Test user address + +## Access Control +- Repository creation restricted to authenticated users +- Repository content addition requires ownership +- Ownership transfer requires current owner's permission + +## Security Considerations +- Input validation for repository names +- Ownership transfer mechanism +- Content hash and type validation +- Prevent empty repository names + +## Deployment +### ChunkNet Devnet Deployment +- **RPC URL**: https://rpc.chunknet.org +- **Chain ID**: 214562 +- **Recommended Deployment Steps**: + 1. Set CHUNK_CHAIN_RPC_URL environment variable + 2. Use Foundry or Hardhat for deployment + 3. Verify contract on ChunkNet explorer at https://explorer.chunknet.org + +## Testing +- Comprehensive test coverage for repository operations +- Tests validate core contract functionalities +- Uses Foundry's `forge-std/Test.sol` testing framework +- Covers edge cases and typical usage scenarios \ No newline at end of file