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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user