2019-12-22 21:38:33 +01:00
|
|
|
package osm
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestOSM_Category(t *testing.T) {
|
|
|
|
t.Run("hill", func(t *testing.T) {
|
|
|
|
|
2019-12-27 05:18:52 +01:00
|
|
|
l := &Location{LocCategory: "natural", LocLat: "52.5208", LocLng: "13.40953", LocName: "Nice title", LocType: "hill", LocDisplayName: "dipslay name"}
|
2019-12-22 21:38:33 +01:00
|
|
|
assert.Equal(t, "hill", l.Category())
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("water", func(t *testing.T) {
|
|
|
|
|
2019-12-27 05:18:52 +01:00
|
|
|
l := &Location{LocCategory: "", LocLat: "52.5208", LocLng: "13.40953", LocName: "Nice title", LocType: "water", LocDisplayName: "dipslay name"}
|
2019-12-22 21:38:33 +01:00
|
|
|
assert.Equal(t, "water", l.Category())
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("shop", func(t *testing.T) {
|
|
|
|
|
2019-12-27 05:18:52 +01:00
|
|
|
l := &Location{LocCategory: "shop", LocLat: "52.5208", LocLng: "13.40953", LocName: "Nice title", LocType: "", LocDisplayName: "dipslay name"}
|
2019-12-22 21:38:33 +01:00
|
|
|
assert.Equal(t, "shop", l.Category())
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("no label found", func(t *testing.T) {
|
|
|
|
|
2019-12-27 05:18:52 +01:00
|
|
|
l := &Location{LocCategory: "xxx", LocLat: "52.5208", LocLng: "13.40953", LocName: "Nice title", LocType: "", LocDisplayName: "dipslay name"}
|
2019-12-22 21:38:33 +01:00
|
|
|
assert.Equal(t, "", l.Category())
|
|
|
|
})
|
|
|
|
}
|