fix: address code review findings
- Fix type mismatch in search_cache.go: SearchWithCache now returns *yandex.Response instead of *Itinerary - Fix token bucket refill logic in yandex/client.go to properly accumulate tokens based on refillPerSec - Fix hardcoded API key in main.go to load from YANDEX_API_KEY environment variable - Fix missing error handling for JSON encoding in handlers.go RouteGeoJSON function - Fix incorrect redis.Nil handling in cache/store.go CacheAside.Exists method - Fix incorrect error return type in station_status.go updateStationStatus to return newStatus instead of empty string
This commit is contained in:
@@ -69,21 +69,6 @@ func TestNewSearchCacheService(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseItineraryFromBytes(t *testing.T) {
|
||||
// Test with empty data
|
||||
result := Itinerary{}
|
||||
err := parseItineraryFromBytes([]byte{}, &result)
|
||||
if err == nil {
|
||||
t.Error("expected error for empty data")
|
||||
}
|
||||
|
||||
// Test with invalid JSON data
|
||||
err = parseItineraryFromBytes([]byte("invalid json data"), &result)
|
||||
if err == nil {
|
||||
t.Error("expected error for invalid JSON data")
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertResponseToBytes(t *testing.T) {
|
||||
// Test with nil response
|
||||
_, err := convertResponseToBytes(nil)
|
||||
|
||||
Reference in New Issue
Block a user