Refactored the application structure to better separate concerns between files and packages
Some checks failed
ci/woodpecker/push/build-image Pipeline failed
Some checks failed
ci/woodpecker/push/build-image Pipeline failed
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// endpoints_test.go validates HTTP endpoint behavior and format negotiation.
|
||||
// Layer: adapters/inbound/httpapi endpoint regression tests.
|
||||
package httpapi
|
||||
|
||||
import (
|
||||
@@ -16,7 +18,7 @@ import (
|
||||
"gitea.maximumdirect.net/ejr/feedapi/render"
|
||||
"gitea.maximumdirect.net/ejr/feedapi/templates"
|
||||
"gitea.maximumdirect.net/ejr/feedapi/transport/httpx"
|
||||
"gitea.maximumdirect.net/ejr/weatherapi/internal/core"
|
||||
"gitea.maximumdirect.net/ejr/weatherapi/internal/app"
|
||||
"gitea.maximumdirect.net/ejr/weatherfeeder/model"
|
||||
)
|
||||
|
||||
@@ -24,7 +26,7 @@ type fakeService struct {
|
||||
observation *model.WeatherObservation
|
||||
forecast *model.WeatherForecastRun
|
||||
alerts *model.WeatherAlertRun
|
||||
conditions *core.CurrentConditions
|
||||
conditions *app.CurrentConditions
|
||||
err error
|
||||
}
|
||||
|
||||
@@ -36,11 +38,11 @@ func (s *fakeService) LatestHourlyForecast(context.Context) (*model.WeatherForec
|
||||
return s.forecast, s.err
|
||||
}
|
||||
|
||||
func (s *fakeService) LatestActiveAlerts(context.Context) (*model.WeatherAlertRun, error) {
|
||||
func (s *fakeService) LatestAlertRun(context.Context) (*model.WeatherAlertRun, error) {
|
||||
return s.alerts, s.err
|
||||
}
|
||||
|
||||
func (s *fakeService) CurrentConditions(context.Context) (*core.CurrentConditions, error) {
|
||||
func (s *fakeService) CurrentConditions(context.Context) (*app.CurrentConditions, error) {
|
||||
return s.conditions, s.err
|
||||
}
|
||||
|
||||
@@ -307,7 +309,7 @@ func TestCurrentConditionsNoDataReturnsNullEnvelopeData(t *testing.T) {
|
||||
|
||||
func TestCurrentConditionsMetricDefaultJSON(t *testing.T) {
|
||||
h := newHandler(t, &fakeService{
|
||||
conditions: &core.CurrentConditions{
|
||||
conditions: &app.CurrentConditions{
|
||||
TemperatureC: float64Ptr(10),
|
||||
ApparentTemperatureC: float64Ptr(9),
|
||||
DewpointC: float64Ptr(5),
|
||||
@@ -345,7 +347,7 @@ func TestCurrentConditionsMetricDefaultJSON(t *testing.T) {
|
||||
|
||||
func TestCurrentConditionsUSJSON(t *testing.T) {
|
||||
h := newHandler(t, &fakeService{
|
||||
conditions: &core.CurrentConditions{
|
||||
conditions: &app.CurrentConditions{
|
||||
TemperatureC: float64Ptr(10),
|
||||
ApparentTemperatureC: float64Ptr(9),
|
||||
DewpointC: float64Ptr(5),
|
||||
@@ -386,7 +388,7 @@ func TestCurrentConditionsUSJSON(t *testing.T) {
|
||||
|
||||
func TestCurrentConditionsXMLAndTextFormats(t *testing.T) {
|
||||
h := newHandler(t, &fakeService{
|
||||
conditions: &core.CurrentConditions{
|
||||
conditions: &app.CurrentConditions{
|
||||
TemperatureC: float64Ptr(10),
|
||||
WindSpeedKmh: float64Ptr(18),
|
||||
ConditionCode: 2,
|
||||
|
||||
Reference in New Issue
Block a user