This commit is contained in:
2026-03-07 07:50:24 +07:00
parent 795edad998
commit 83868cc778
7 changed files with 222 additions and 7 deletions
@@ -9,8 +9,15 @@ type Place struct {
Name string `json:"name"`
Text string `json:"text"`
Applications []*Application `json:"applications,omitempty"`
Hidden bool `json:"hidden"`
Doors []*Door `json:"doors"`
}
type Application struct {
Name string `json:"name"`
}
type Door struct {
Code string `json:"code"`
Name string `json:"name"`
}
@@ -71,6 +71,8 @@ func (s *StoryService) GetPlace(code string) *Place {
Name: place.Name,
Text: s.cleaner.ClearText(place.Text),
Applications: applications,
Hidden: place.Hidden,
Doors: place.Doors,
}
}
}
@@ -84,6 +84,37 @@ func TestStoryService_GetPlace(t *testing.T) {
},
},
},
{
name: "получение точки с проходами",
story: &story_service.Story{
Places: []*story_service.Place{
{
Code: "Ы-1",
Name: "Название",
Text: "Текст",
Doors: []*story_service.Door{
{
Code: "Ы-2",
Name: "Приложение",
},
},
},
},
},
code: "Ы-1",
want: &story_service.Place{
Code: "Ы-1",
Name: "Название",
Text: "Текст",
Applications: []*story_service.Application{},
Doors: []*story_service.Door{
{
Code: "Ы-2",
Name: "Приложение",
},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {