Uc006 Sort Tasks
# specs/features/UC006-sort-tasks.feature
#
# SINGLE SOURCE OF TRUTH for UC006 behaviour.
# This file is:
# (1) referenced by specs/use_cases/UC006-sort-tasks.md (documentation)
# (2) executed by the acceptance test suite (living documentation)
#
# Rules:
# - Scenario IDs (e.g. UC006-S01) must match the use case document.
# - Step definitions live in: src/test/java/.../steps/
# - Keep scenarios focused: one behaviour per scenario.
# - Use exact terms from specs/glossary.md.
Feature: Sort Tasks
As a User
I want to sort my task list by status or due date
So that I can focus on the most relevant tasks first
# ---------------------------------------------------------------------------
# Sort by status
# ---------------------------------------------------------------------------
Scenario: UC006-S01 Sort tasks by status
Given the following tasks exist:
| title | status |
| Task A | DONE |
| Task B | TODO |
| Task C | IN_PROGRESS |
When the User requests tasks sorted by "STATUS"
Then the response status is 200
And the response contains 3 tasks
And the tasks appear in title order: "Task B, Task C, Task A"
# ---------------------------------------------------------------------------
# Sort by due date — ending soonest (default)
# Uses mixed statuses to verify that status is irrelevant to the sort order.
# ---------------------------------------------------------------------------
Scenario: UC006-S02 Sort tasks ending soonest, nulls last, mixed statuses
Given the following tasks exist:
| title | status | dueDate |
| Far future | DONE | 2026-12-01 |
| No due date | IN_PROGRESS | |
| Near future | TODO | 2026-04-01 |
When the User requests tasks sorted by "ENDING_SOONEST"
Then the response status is 200
And the response contains 3 tasks
And the tasks appear in title order: "Near future, Far future, No due date"
# ---------------------------------------------------------------------------
# Sort by due date — ending latest
# Uses mixed statuses to verify that status is irrelevant to the sort order.
# ---------------------------------------------------------------------------
Scenario: UC006-S03 Sort tasks ending latest, nulls last, mixed statuses
Given the following tasks exist:
| title | status | dueDate |
| Far future | TODO | 2026-12-01 |
| No due date | DONE | |
| Near future | IN_PROGRESS | 2026-04-01 |
When the User requests tasks sorted by "ENDING_LATEST"
Then the response status is 200
And the response contains 3 tasks
And the tasks appear in title order: "Far future, Near future, No due date"
# ---------------------------------------------------------------------------
# No sort parameter — existing behaviour unchanged (regression)
# ---------------------------------------------------------------------------
Scenario: UC006-S04 No sort parameter returns tasks without guaranteed order
Given the following tasks exist:
| title | status |
| First task | TODO |
| Second task | TODO |
| Third task | TODO |
When the User requests the list of all tasks
Then the response status is 200
And the response contains 3 tasks
And the response includes a task with title "First task"
And the response includes a task with title "Second task"
And the response includes a task with title "Third task"
# ---------------------------------------------------------------------------
# Due date of a TODO task is preserved end-to-end
# Regression for: due date not displayed / returned for TODO tasks.
# ---------------------------------------------------------------------------
Scenario: UC006-S05 TODO task with due date is returned in sorted list
Given the following tasks exist:
| title | status | dueDate |
| With date | TODO | 2026-06-30 |
| Without | TODO | |
When the User requests tasks sorted by "ENDING_SOONEST"
Then the response status is 200
And the response contains 2 tasks
And the response contains a task with due date "2026-06-30"
And the tasks appear in title order: "With date, Without"