2019-12-31 07:16:11 +01:00
|
|
|
package places
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-01-12 14:00:56 +01:00
|
|
|
"github.com/photoprism/photoprism/pkg/s2"
|
2019-12-31 07:16:11 +01:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestFindLocation(t *testing.T) {
|
|
|
|
t.Run("U Berliner Rathaus", func(t *testing.T) {
|
|
|
|
lat := 52.51961810676184
|
|
|
|
lng := 13.40806264572578
|
2020-01-02 04:08:33 +01:00
|
|
|
id := s2.Token(lat, lng)
|
2019-12-31 07:16:11 +01:00
|
|
|
|
|
|
|
l, err := FindLocation(id)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.False(t, l.Cached)
|
2020-01-11 01:59:43 +01:00
|
|
|
assert.Equal(t, "Alt-Berlin", l.Name())
|
2019-12-31 07:16:11 +01:00
|
|
|
assert.Equal(t, "Berlin", l.City())
|
|
|
|
assert.Equal(t, "de", l.CountryCode())
|
|
|
|
})
|
|
|
|
}
|