package config import ( "os" "path/filepath" "testing" ) // TestConfigLoad ensures the config package can be imported and basic functionality works func TestConfigLoad(t *testing.T) { // Create a temporary config file tmpDir := t.TempDir() configPath := filepath.Join(tmpDir, "test-config.yaml") configContent := `age_recipient: age1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx source_dirs: - /tmp/test s3: endpoint: https://s3.example.com bucket: test-bucket access_key_id: test-key secret_access_key: test-secret ` if err := os.WriteFile(configPath, []byte(configContent), 0644); err != nil { t.Fatalf("Failed to write test config: %v", err) } // Test loading the config cfg, err := Load(configPath) if err != nil { t.Fatalf("Failed to load config: %v", err) } // Basic validation if cfg.AgeRecipient != "age1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" { t.Errorf("Expected age recipient to be set, got '%s'", cfg.AgeRecipient) } if len(cfg.SourceDirs) != 1 || cfg.SourceDirs[0] != "/tmp/test" { t.Errorf("Expected source dirs to be ['/tmp/test'], got %v", cfg.SourceDirs) } if cfg.S3.Bucket != "test-bucket" { t.Errorf("Expected S3 bucket to be 'test-bucket', got '%s'", cfg.S3.Bucket) } }