clean links

This commit is contained in:
2026-07-29 02:09:00 +07:00
parent d1b263fa78
commit 33d0fb526f
3 changed files with 25 additions and 2 deletions
@@ -2,4 +2,5 @@ package storytelling
type ICleaner interface { type ICleaner interface {
ClearCode(code string) string ClearCode(code string) string
ClearText(text string) string
} }
+2 -2
View File
@@ -136,7 +136,7 @@ func (s *story) mapPlace(
applications = append( applications = append(
applications, applications,
&Application{ &Application{
Name: application.Name, Name: s.cleaner.ClearText(application.Name),
Image: application.Image, Image: application.Image,
}, },
) )
@@ -181,7 +181,7 @@ func (s *story) mapPlace(
return &Place{ return &Place{
Code: place.Code, Code: place.Code,
Name: place.Name, Name: place.Name,
Text: place.Text, Text: s.cleaner.ClearText(place.Text),
Image: place.Image, Image: place.Image,
Applications: applications, Applications: applications,
Doors: doors, Doors: doors,
@@ -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 точек", name: "Получение 2 точек",
scenario: &Story{ scenario: &Story{