Add end-to-end tests for parent rewards management
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 2m33s
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 2m33s
- Implement tests for creating, editing, canceling, and deleting rewards in parent mode. - Include scenarios for converting default rewards to user items and verifying restoration of default rewards after deletion. - Create a comprehensive test plan outlining the steps and expectations for each scenario.
This commit is contained in:
@@ -128,14 +128,19 @@ def edit_reward(id):
|
||||
is_dirty = True
|
||||
|
||||
if 'description' in data:
|
||||
desc = (data.get('description') or '').strip()
|
||||
if not desc:
|
||||
return jsonify({'error': 'Description cannot be empty'}), 400
|
||||
reward.description = desc
|
||||
# allow empty description (same behavior as add_reward)
|
||||
# note: front-end often submits an empty string, so don't block edits
|
||||
reward.description = data.get('description') or ''
|
||||
is_dirty = True
|
||||
|
||||
if 'cost' in data:
|
||||
cost = data.get('cost')
|
||||
# allow numeric strings as well
|
||||
if isinstance(cost, str):
|
||||
try:
|
||||
cost = int(cost)
|
||||
except ValueError:
|
||||
return jsonify({'error': 'Cost must be an integer'}), 400
|
||||
if not isinstance(cost, int):
|
||||
return jsonify({'error': 'Cost must be an integer'}), 400
|
||||
if cost <= 0:
|
||||
|
||||
Reference in New Issue
Block a user