diff --git a/internal/modules/storytelling/dependency.go b/internal/modules/storytelling/dependency.go index cf685c7..9e470ee 100644 --- a/internal/modules/storytelling/dependency.go +++ b/internal/modules/storytelling/dependency.go @@ -2,4 +2,5 @@ package storytelling type ICleaner interface { ClearCode(code string) string + ClearText(text string) string } diff --git a/internal/modules/storytelling/story.go b/internal/modules/storytelling/story.go index 0e01f08..7df6b4a 100644 --- a/internal/modules/storytelling/story.go +++ b/internal/modules/storytelling/story.go @@ -136,7 +136,7 @@ func (s *story) mapPlace( applications = append( applications, &Application{ - Name: application.Name, + Name: s.cleaner.ClearText(application.Name), Image: application.Image, }, ) @@ -181,7 +181,7 @@ func (s *story) mapPlace( return &Place{ Code: place.Code, Name: place.Name, - Text: place.Text, + Text: s.cleaner.ClearText(place.Text), Image: place.Image, Applications: applications, Doors: doors, diff --git a/internal/modules/storytelling/story_test.go b/internal/modules/storytelling/story_test.go index 579cff6..fb89107 100644 --- a/internal/modules/storytelling/story_test.go +++ b/internal/modules/storytelling/story_test.go @@ -72,6 +72,28 @@ func Test_story_GetStory(t *testing.T) { }, }, }, + { + name: "Получение точки проверка очистки ссылок", + scenario: &Story{ + Places: []*Place{ + { + Code: "Ы-1", + Name: "Название точки", + Text: "Текст точки.([Ы-2])", + }, + }, + }, + codes: []string{"Ы-1"}, + want: &Story{ + Places: []*Place{ + { + Code: "Ы-1", + Name: "Название точки", + Text: "Текст точки.", + }, + }, + }, + }, { name: "Получение 2 точек", scenario: &Story{