845038120e
Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
32 lines
597 B
Go
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)
|
|
}
|