turash/bugulma/backend/internal/financial/config_test.go
Damir Mukimov 000eab4740
Major repository reorganization and missing backend endpoints implementation
Repository Structure:
- Move files from cluttered root directory into organized structure
- Create archive/ for archived data and scraper results
- Create bugulma/ for the complete application (frontend + backend)
- Create data/ for sample datasets and reference materials
- Create docs/ for comprehensive documentation structure
- Create scripts/ for utility scripts and API tools

Backend Implementation:
- Implement 3 missing backend endpoints identified in gap analysis:
  * GET /api/v1/organizations/{id}/matching/direct - Direct symbiosis matches
  * GET /api/v1/users/me/organizations - User organizations
  * POST /api/v1/proposals/{id}/status - Update proposal status
- Add complete proposal domain model, repository, and service layers
- Create database migration for proposals table
- Fix CLI server command registration issue

API Documentation:
- Add comprehensive proposals.md API documentation
- Update README.md with Users and Proposals API sections
- Document all request/response formats, error codes, and business rules

Code Quality:
- Follow existing Go backend architecture patterns
- Add proper error handling and validation
- Match frontend expected response schemas
- Maintain clean separation of concerns (handler -> service -> repository)
2025-11-25 06:01:16 +01:00

65 lines
1.3 KiB
Go

package financial
import (
"testing"
)
func TestDefaultConfig(t *testing.T) {
config := DefaultConfig()
if config == nil {
t.Fatal("DefaultConfig() returned nil")
}
// Check default values
if config.DefaultDiscountRate != 0.08 {
t.Errorf("DefaultDiscountRate = %v, want 0.08", config.DefaultDiscountRate)
}
if config.DefaultProjectLife != 10 {
t.Errorf("DefaultProjectLife = %v, want 10", config.DefaultProjectLife)
}
if config.GridEmissionFactor != 0.3 {
t.Errorf("GridEmissionFactor = %v, want 0.3", config.GridEmissionFactor)
}
if config.OpexPctOfCapex != 0.03 {
t.Errorf("OpexPctOfCapex = %v, want 0.03", config.OpexPctOfCapex)
}
}
// Config validation not implemented - no Validate method exists
func TestNewCalculator(t *testing.T) {
config := DefaultConfig()
calc := NewCalculator(config)
if calc == nil {
t.Error("NewCalculator() returned nil")
}
// Test that we can call methods
data := &ResourceFlowData{
ResourceType: "heat",
DistanceKm: 10.0,
AnnualVolume: 1000.0,
CostIn: 100.0,
CostOut: 20.0,
}
assumptions := &EconomicAssumptions{
DiscountRate: 0.08,
ProjectLifeYears: 10,
}
result, err := calc.Calculate(AnalysisTypeBasic, data, assumptions)
if err != nil {
t.Fatalf("Calculate() error = %v", err)
}
if result == nil {
t.Error("Calculate() returned nil result")
}
}