Add end-to-end tests for parent notifications and actions
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m35s

- Implement tests for approving and denying rewards and chores, including token generation and validation.
- Create tests for error handling scenarios with expired, tampered, and fake tokens.
- Add tests for push subscription registration and user profile notification settings.
- Ensure that notifications reflect the correct state of rewards and chores in the UI.
- Validate that toggles for email digest and push notifications function correctly based on user permissions and server state.
This commit is contained in:
2026-04-20 20:32:19 -04:00
parent ee16b49020
commit 4ee5367742
22 changed files with 1814 additions and 67 deletions

View File

@@ -825,6 +825,22 @@ const confirmTriggerReward = async () => {
}
}
const denyRewardRequest = async () => {
if (!child.value?.id || !selectedReward.value) return
try {
await fetch(`/api/child/${child.value.id}/deny-reward-request`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ reward_id: selectedReward.value.id }),
})
} catch (err) {
console.error('Failed to deny reward request:', err)
} finally {
showRewardConfirm.value = false
selectedReward.value = null
}
}
function goToAssignTasks() {
if (child.value?.id) {
router.push({
@@ -1168,6 +1184,7 @@ function goToAssignRewards() {
:reward="selectedReward"
:childName="child?.name"
@confirm="confirmTriggerReward"
@deny="denyRewardRequest"
@cancel="
() => {
showRewardConfirm = false

View File

@@ -12,6 +12,7 @@
</div>
<div class="modal-actions">
<button @click="$emit('confirm')" class="btn btn-primary">Yes</button>
<button v-if="reward?.redeeming" @click="$emit('deny')" class="btn btn-danger">Deny</button>
<button @click="$emit('cancel')" class="btn btn-secondary">Cancel</button>
</div>
</ModalDialog>
@@ -28,6 +29,7 @@ defineProps<{
defineEmits<{
confirm: []
deny: []
cancel: []
}>()
</script>