feat(testutils): add CreateTestServiceWithDuration fixture

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-06-21 21:00:45 +01:00
co-authored by Sisyphus
parent b292eaac99
commit 0c1e1d7be4
+14
View File
@@ -71,6 +71,20 @@ func CreateTestService(q db.Querier) (string, error) {
return serviceID, nil 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 // CreateTestServiceWithPatchTest creates a service and a patch test that links to it
// Returns serviceID, patchTestID // Returns serviceID, patchTestID
func CreateTestServiceWithPatchTest(q db.Querier) (string, string, error) { func CreateTestServiceWithPatchTest(q db.Querier) (string, string, error) {