From 1e9fdf260a371f46f7bfb32ab8c090d7ab4fb9d9 Mon Sep 17 00:00:00 2001 From: Theresa Gresch Date: Sun, 22 Dec 2019 21:39:25 +0100 Subject: [PATCH] Add test for osm/title --- internal/maps/osm/title_test.go | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 internal/maps/osm/title_test.go diff --git a/internal/maps/osm/title_test.go b/internal/maps/osm/title_test.go new file mode 100644 index 000000000..2f9145586 --- /dev/null +++ b/internal/maps/osm/title_test.go @@ -0,0 +1,43 @@ +package osm + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestOSM_Title(t *testing.T) { + t.Run("Nice Title", func(t *testing.T) { + + l := &Location{LocCategory: "natural", LocLat: "52.5208", LocLng: "13.40953", LocTitle: "Nice title", LocType: "hill", LocDisplayName: "dipslay name"} + assert.Equal(t, "Nice Title", l.Title()) + }) + + t.Run("Water", func(t *testing.T) { + + l := &Location{LocCategory: "", LocLat: "52.5208", LocLng: "13.40953", LocTitle: "", LocType: "water", LocDisplayName: "dipslay name"} + assert.Equal(t, "Water", l.Title()) + }) + + t.Run("Nice Title 2", func(t *testing.T) { + + l := &Location{LocCategory: "shop", LocLat: "52.5208", LocLng: "13.40953", LocTitle: "Nice title_2", LocType: "", LocDisplayName: "dipslay name"} + assert.Equal(t, "Nice Title 2", l.Title()) + }) + + t.Run("Cat", func(t *testing.T) { + + l := &Location{LocCategory: "xxx", LocLat: "52.5208", LocLng: "13.40953", LocTitle: "Cat,Dog", LocType: "", LocDisplayName: "dipslay name"} + assert.Equal(t, "Cat", l.Title()) + }) + t.Run("airport", func(t *testing.T) { + + l := &Location{LocCategory: "aeroway", LocLat: "52.5208", LocLng: "13.40953", LocTitle: "", LocType: "", LocDisplayName: "dipslay name"} + assert.Equal(t, "Airport", l.Title()) + }) + t.Run("Cow", func(t *testing.T) { + + l := &Location{LocCategory: "xxx", LocLat: "52.5208", LocLng: "13.40953", LocTitle: "Cow - Cat - Dog", LocType: "", LocDisplayName: "dipslay name"} + assert.Equal(t, "Cow", l.Title()) + }) +}