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