tududi/backend/tests
Chris 65b9bbce39
Fix initial due date calculation for weekly tasks with multiple weekdays (#974) (#975)
Fix calculateInitialDueDate() to properly handle recurrence_weekdays array
when creating or updating weekly recurring tasks with multiple weekdays.

Previously, the function only checked for recurrence_weekday (singular) and
ignored recurrence_weekdays (plural array), causing tasks with multiple
weekdays to incorrectly get today's date instead of the next occurrence.

Changes:
- Add support for recurrence_weekdays array in calculateInitialDueDate()
- Fix buildUpdateAttributes() to pass recurrence_weekdays parameter
- Add 8 unit tests covering multiple weekdays scenarios
- Add 3 integration tests for API CREATE and UPDATE operations
- Maintain backward compatibility with single recurrence_weekday

The fix mirrors the proven logic from calculateWeeklyRecurrence() in
recurringTaskService.js and properly handles edge cases like unsorted
arrays, wrapping to next week, and JSON string parsing.

Fixes #974
2026-03-26 17:19:59 +02:00
..
helpers Lint and formatting fixes 2025-07-23 12:22:06 +03:00
integration Fix initial due date calculation for weekly tasks with multiple weekdays (#974) (#975) 2026-03-26 17:19:59 +02:00
mocks Add nanoid 2025-08-04 23:50:53 +03:00
unit Fix initial due date calculation for weekly tasks with multiple weekdays (#974) (#975) 2026-03-26 17:19:59 +02:00