All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package openmeteo
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gitea.maximumdirect.net/ejr/feedkit/config"
|
|
"gitea.maximumdirect.net/ejr/feedkit/event"
|
|
)
|
|
|
|
func TestObservationSourceAdvertisesKinds(t *testing.T) {
|
|
src, err := NewObservationSource(config.SourceConfig{
|
|
Name: "openmeteo-observation-test",
|
|
Driver: "openmeteo_observation",
|
|
Mode: config.SourceModePoll,
|
|
Params: map[string]any{
|
|
"url": "https://example.invalid",
|
|
"user_agent": "test-agent",
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatalf("NewObservationSource() error = %v", err)
|
|
}
|
|
if got := src.Kinds(); len(got) != 1 || got[0] != event.Kind("observation") {
|
|
t.Fatalf("Kinds() = %#v, want [observation]", got)
|
|
}
|
|
}
|
|
|
|
func TestForecastSourceAdvertisesKinds(t *testing.T) {
|
|
src, err := NewForecastSource(config.SourceConfig{
|
|
Name: "openmeteo-forecast-test",
|
|
Driver: "openmeteo_forecast",
|
|
Mode: config.SourceModePoll,
|
|
Params: map[string]any{
|
|
"url": "https://example.invalid",
|
|
"user_agent": "test-agent",
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatalf("NewForecastSource() error = %v", err)
|
|
}
|
|
if got := src.Kinds(); len(got) != 1 || got[0] != event.Kind("forecast") {
|
|
t.Fatalf("Kinds() = %#v, want [forecast]", got)
|
|
}
|
|
}
|