Skip to content

Feature/dag unit tests - #129

Open
gitsofaryan wants to merge 7 commits into
akave-ai:devfrom
gitsofaryan:feature/dag-unit-tests
Open

Feature/dag unit tests#129
gitsofaryan wants to merge 7 commits into
akave-ai:devfrom
gitsofaryan:feature/dag-unit-tests

Conversation

@gitsofaryan

@gitsofaryan gitsofaryan commented Mar 17, 2026

Copy link
Copy Markdown

cc : @d4v1d03 @Abhay-2811
Issue #102

What's Covered

📝 48 unit tests in tests/unit/test_dag.py:

  • DAGRoot class - Creation, link management, building with proper error handling
  • CID operations - Encoding/decoding with fallback behavior
  • Varint encoding/decoding - Single-byte, multi-byte, and roundtrip validation
  • UnixFS node creation - Data generation and field parsing
  • ChunkDAG - Block management and size tracking
  • build_dag() function - Handles single/multiple blocks, partial blocks, edge cases
  • Node parsing - Link extraction, data retrieval from protobuf structures
  • Fallback behavior - Full test coverage when IPLD library is unavailable

Test Results

image

All tests passing with proper mocking to verify both IPLD-available and fallback scenarios.

Key Features

✅ Edge case testing (empty data, zero sizes, oversized values)
✅ Error handling verification
✅ IPLD availability simulation
✅ Comprehensive workflow integration tests

Branch: feature/dag-unit-tests (PR ready)

- Tests for DAGRoot class (creation, link management, building)
- Varint encoding and decoding tests with roundtrip validation
- UnixFS data extraction tests
- ChunkDAG dataclass tests
- build_dag() function tests with various block configurations
- Helper function tests for CID operations
- Node size calculation tests
- Block data extraction and parsing tests
- Integration tests for complete DAG workflows
- 48 total unit tests covering all major DAG functionality
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.

1 participant