Add Unit Tests for Domain Layer
Description
Test coverage in the domain layer to ensure business logic reliability.
Testing Requirements
Domain Entities
- Test entity creation and validation
- Test entity methods and business rules
- Edge cases and error conditions
Domain Models
- Test transformation rules parsing
- Test configuration validation
- Test data mapping logic
Domain Aggregates
- Test aggregate root behavior
- Test business rule enforcement
- Test domain events
Value Objects
- Test immutability
- Test validation rules
- Test equality and comparison
Files Needing Tests
Priority 1: Core Entities and Models
internal/domain/
├── entities/
│ ├── base_entity.go (needs tests)
│ ├── graph.go (needs tests)
│ ├── node.go (needs tests)
│ └── relation.go (needs tests)
└── models/
├── config.go (needs tests)
├── database_config.go (needs tests)
├── database_schema.go (needs tests)
├── graph.go (needs tests)
└── search.go (needs tests)
Priority 2: Aggregates and Services
internal/domain/
├── aggregates/
│ ├── graph/graph_aggregate.go (needs tests)
│ ├── serialization/id_generator.go (needs tests)
│ ├── serialization/serialization.go (needs tests)
│ └── transform/transform_rule_aggregate.go (needs tests)
└── services/
└── graph_service.go (needs tests)
Priority 3: Value Objects and Events
internal/domain/
├── valueobjects/
│ ├── search_criteria.go (needs tests)
│ ├── transform_config.go (needs tests)
│ ├── visualization_criteria.go (needs tests)
│ └── transform/
│ ├── direction.go (needs tests)
│ ├── rule_parameters.go (needs tests)
│ └── rule_type.go (needs tests)
└── events/
├── domain_event.go (needs tests)
└── node_events.go (needs tests)
Acceptance Criteria
Technical Requirements
- Use testify framework (already included in project)
- Follow existing test patterns from other layers
- Use mocks for external dependencies
- Write descriptive test names following Go conventions
- Test files should be named
*_test.go in same package
- Use test doubles for repositories and external services
- Focus on testing business rules and domain logic
Commands for Development
# Run domain layer tests specifically
go test ./internal/domain/...
# Run with coverage
go test -cover ./internal/domain/...
# Run specific entity tests
go test ./internal/domain/entities/...
go test ./internal/domain/models/...
# Generate coverage report
make test
Dependencies
- No external dependencies required
- Can be developed incrementally
- Should be completed before adding integration tests
Definition of Done
- All domain layer files have corresponding test files
- Test coverage reports show >80% for domain package
- All tests pass locally and in CI
- Code review completed
Add Unit Tests for Domain Layer
Description
Test coverage in the domain layer to ensure business logic reliability.
Testing Requirements
Domain Entities
Domain Models
Domain Aggregates
Value Objects
Files Needing Tests
Priority 1: Core Entities and Models
Priority 2: Aggregates and Services
Priority 3: Value Objects and Events
Acceptance Criteria
Technical Requirements
*_test.goin same packageCommands for Development
Dependencies
Definition of Done