2021-08-31 18:49:08 +02:00
|
|
|
//go:build osm
|
2020-01-11 01:59:43 +01:00
|
|
|
// +build osm
|
|
|
|
|
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) {
|
|
|
|
|
2020-10-01 12:15:43 +02:00
|
|
|
l := &Location{LocCategory: "natural", LocName: "Nice title", LocType: "hill", LocDisplayName: "display name"}
|
2019-12-22 21:38:33 +01:00
|
|
|
assert.Equal(t, "hill", l.Category())
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("water", func(t *testing.T) {
|
|
|
|
|
2020-10-01 12:15:43 +02:00
|
|
|
l := &Location{LocCategory: "", LocName: "Nice title", LocType: "water", LocDisplayName: "display name"}
|
2019-12-22 21:38:33 +01:00
|
|
|
assert.Equal(t, "water", l.Category())
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("shop", func(t *testing.T) {
|
|
|
|
|
2020-10-01 12:15:43 +02:00
|
|
|
l := &Location{LocCategory: "shop", LocName: "Nice title", LocType: "", LocDisplayName: "display name"}
|
2019-12-22 21:38:33 +01:00
|
|
|
assert.Equal(t, "shop", l.Category())
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("no label found", func(t *testing.T) {
|
|
|
|
|
2020-10-01 12:15:43 +02:00
|
|
|
l := &Location{LocCategory: "xxx", LocName: "Nice title", LocType: "", LocDisplayName: "display name"}
|
2019-12-22 21:38:33 +01:00
|
|
|
assert.Equal(t, "", l.Category())
|
|
|
|
})
|
|
|
|
}
|