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)
}