yr/pkg/met/met_test.go
Tim Hårek Andreassen 845038120e
refactor: Move met and nominatim to ./pkg
Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
2024-10-04 21:05:21 +02:00

32 lines
597 B
Go

package met
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewClient(t *testing.T) {
assert := assert.New(t)
c, err := New("my siteName")
assert.NoError(err)
assert.Equal("my siteName", c.siteName)
_, err = New("")
assert.Error(err)
}
func TestForecast(t *testing.T) {
assert := assert.New(t)
c, err := New("my siteName")
assert.NoError(err)
f, err := c.Forecast(60.389444, 5.33, nil)
assert.NoError(err)
coords := f.Geometry.Coordinates
assert.Equal([]float64{5.33, 60.3894, 2}, coords)
_, err = c.Forecast(10000.0, 10000.33, nil)
assert.Error(err)
}