feat: add comprehensive test suite for recent backend changes
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user