add tests for postavailability and reservation summary

This commit is contained in:
2024-07-15 22:38:29 +02:00
parent e8390cc51d
commit 6853a1a483
3 changed files with 129 additions and 11 deletions

View File

@ -41,6 +41,17 @@ func (m *testDBRepo) SearchAvailabilityByDatesByRoomID(start, end time.Time, roo
// SearchAvailabilityForAllRooms returns a slice of rooms, if any, for given date range
func (m *testDBRepo) SearchAvailabilityForAllRooms(start, end time.Time) ([]models.Room, error) {
var rooms []models.Room
if start.Format("2006-01-02") == "2050-01-01" && end.Format("2006-01-02") == "2050-01-02" {
room := models.Room{
RoomName: "room",
ID: 1,
}
rooms = append(rooms, room)
return rooms, nil
}
if start.Format("2006-01-02") == "2050-01-03" && end.Format("2006-01-02") == "2050-01-04" {
return rooms, errors.New("deliberate error")
}
return rooms, nil
}