feat: add comprehensive test suite for recent backend changes

This commit is contained in:
2026-05-29 17:13:16 +01:00
parent 9ba4949d37
commit 9d8015f1b8
5 changed files with 339 additions and 68 deletions
+5 -1
View File
@@ -135,13 +135,17 @@ func CreateUserPatchTest(pool *pgxpool.Pool, userID, patchTestID string, testedA
}
func CreateTestBooking(pool *pgxpool.Pool, userID, serviceID string) (string, error) {
return CreateTestBookingAtTime(pool, userID, serviceID, time.Date(2099, 12, 31, 10, 0, 0, 0, time.UTC))
}
func CreateTestBookingAtTime(pool *pgxpool.Pool, userID, serviceID string, startTime time.Time) (string, error) {
ctx := context.Background()
var bookingID string
err := pool.QueryRow(ctx, `
INSERT INTO bookings (user_id, start_time, status, notes)
VALUES ($1, $2, $3, $4)
RETURNING id
`, userID, "2099-12-31 10:00:00+00", "pending", "Test booking").Scan(&bookingID)
`, userID, startTime, "pending", "Test booking").Scan(&bookingID)
if err != nil {
return "", fmt.Errorf("failed to create booking: %w", err)