generated from VLADIMIR/template
clean links
This commit is contained in:
@@ -2,4 +2,5 @@ package storytelling
|
||||
|
||||
type ICleaner interface {
|
||||
ClearCode(code string) string
|
||||
ClearText(text string) string
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user