From 0c1e1d7be46ffd31b80a8a20d8c1620ff93ac27e Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Sun, 21 Jun 2026 21:00:45 +0100 Subject: [PATCH] feat(testutils): add CreateTestServiceWithDuration fixture Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- backend/testutils/fixtures/fixtures.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/backend/testutils/fixtures/fixtures.go b/backend/testutils/fixtures/fixtures.go index 5fe51fe..9386aa2 100644 --- a/backend/testutils/fixtures/fixtures.go +++ b/backend/testutils/fixtures/fixtures.go @@ -71,6 +71,20 @@ func CreateTestService(q db.Querier) (string, error) { return serviceID, nil } +func CreateTestServiceWithDuration(q db.Querier, durationMinutes int) (string, error) { + ctx := context.Background() + var serviceID string + err := q.QueryRow(ctx, ` + INSERT INTO services (name, description, price, duration_minutes, is_active, minimum_age_required) + VALUES ($1, $2, $3, $4, $5, $6) + RETURNING id + `, fmt.Sprintf("Test Service %dmin", durationMinutes), "A test service for unit tests", 50.00, durationMinutes, true, 16).Scan(&serviceID) + if err != nil { + return "", fmt.Errorf("failed to create service: %w", err) + } + return serviceID, nil +} + // CreateTestServiceWithPatchTest creates a service and a patch test that links to it // Returns serviceID, patchTestID func CreateTestServiceWithPatchTest(q db.Querier) (string, string, error) {