test: add tests for unprotected behavior#2193
Conversation
This PR adds high-value tests for the `HomeworkSortAndSubcategorizer` to ensure correct sorting and categorization of homeworks (Overdue, Today, Tomorrow, etc.) and regression tests for `StudentHomeworkView` date coloring boundary conditions. - Added `lib/hausaufgabenheft_logik/test/homework_sort_and_subcategorizer_test.dart` - Modified `lib/hausaufgabenheft_logik/test/create_student_homework_view_test.dart` Co-authored-by: nilsreichardt <24459435+nilsreichardt@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Visit the preview URL for this PR (updated for commit 233106f): https://sharezone-console-dev--pr2193-test-homework-subcat-8c6ynrgf.web.app (expires Wed, 25 Feb 2026 16:29:55 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 471536afe3f6ec4895d9ea75513730b515d17eb6 |
|
Visit the preview URL for this PR (updated for commit 233106f): https://sharezone-website-dev--pr2193-test-homework-subcat-ssfr6f5v.web.app (expires Wed, 25 Feb 2026 16:30:04 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 372b0431a96247f908d9a97d5d865de1c8b3b04e |
|
Visit the preview URL for this PR (updated for commit 233106f): https://sharezone-test--pr2193-test-homework-subcat-k6nmzr93.web.app (expires Wed, 25 Feb 2026 16:31:00 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 4cb3ae61e1e018abfd9841fd3239f5b49ccc034b |
There was a problem hiding this comment.
Code Review
This pull request adds a valuable set of unit tests for the HomeworkSortAndSubcategorizer and a boundary condition test for StudentHomeworkViewFactory, which is great for improving the reliability of the homework logic. The new tests are well-structured and cover various scenarios. I have a couple of suggestions to improve the readability of the new test file by using more descriptive variable names, in accordance with the repository's style guide.
| final h1 = createHomework( | ||
| todoDate: now, | ||
| subject: 'B', | ||
| title: 'A', | ||
| id: '1', | ||
| ); | ||
| final h2 = createHomework( | ||
| todoDate: now, | ||
| subject: 'A', | ||
| title: 'B', | ||
| id: '2', | ||
| ); | ||
| final h3 = createHomework( | ||
| todoDate: now, | ||
| subject: 'A', | ||
| title: 'A', | ||
| id: '3', | ||
| ); | ||
|
|
||
| final homeworks = [h1, h2, h3].toIList(); |
There was a problem hiding this comment.
The variable names h1, h2, and h3 are not very descriptive. Using more descriptive names that indicate the content of the homework would improve test readability and maintainability.
| final h1 = createHomework( | |
| todoDate: now, | |
| subject: 'B', | |
| title: 'A', | |
| id: '1', | |
| ); | |
| final h2 = createHomework( | |
| todoDate: now, | |
| subject: 'A', | |
| title: 'B', | |
| id: '2', | |
| ); | |
| final h3 = createHomework( | |
| todoDate: now, | |
| subject: 'A', | |
| title: 'A', | |
| id: '3', | |
| ); | |
| final homeworks = [h1, h2, h3].toIList(); | |
| final homeworkB_A = createHomework( | |
| todoDate: now, | |
| subject: 'B', | |
| title: 'A', | |
| id: '1', | |
| ); | |
| final homeworkA_B = createHomework( | |
| todoDate: now, | |
| subject: 'A', | |
| title: 'B', | |
| id: '2', | |
| ); | |
| final homeworkA_A = createHomework( | |
| todoDate: now, | |
| subject: 'A', | |
| title: 'A', | |
| id: '3', | |
| ); | |
| final homeworks = [homeworkB_A, homeworkA_B, homeworkA_A].toIList(); |
| final h1 = createHomework( | ||
| subject: 'Math', | ||
| todoDate: now.addDays(1), | ||
| title: 'B', | ||
| id: '1', | ||
| ); | ||
| final h2 = createHomework( | ||
| subject: 'Math', | ||
| todoDate: now, | ||
| title: 'A', | ||
| id: '2', | ||
| ); | ||
| final h3 = createHomework( | ||
| subject: 'Math', | ||
| todoDate: now, | ||
| title: 'B', | ||
| id: '3', | ||
| ); | ||
|
|
||
| final homeworks = [h1, h2, h3].toIList(); |
There was a problem hiding this comment.
Similar to the previous comment, using more descriptive variable names like homeworkTomorrowB, homeworkTodayA, and homeworkTodayB instead of h1, h2, and h3 would make the test easier to understand at a glance. This aligns with the repository style guide's emphasis on clear naming.
| final h1 = createHomework( | |
| subject: 'Math', | |
| todoDate: now.addDays(1), | |
| title: 'B', | |
| id: '1', | |
| ); | |
| final h2 = createHomework( | |
| subject: 'Math', | |
| todoDate: now, | |
| title: 'A', | |
| id: '2', | |
| ); | |
| final h3 = createHomework( | |
| subject: 'Math', | |
| todoDate: now, | |
| title: 'B', | |
| id: '3', | |
| ); | |
| final homeworks = [h1, h2, h3].toIList(); | |
| final homeworkTomorrowB = createHomework( | |
| subject: 'Math', | |
| todoDate: now.addDays(1), | |
| title: 'B', | |
| id: '1', | |
| ); | |
| final homeworkTodayA = createHomework( | |
| subject: 'Math', | |
| todoDate: now, | |
| title: 'A', | |
| id: '2', | |
| ); | |
| final homeworkTodayB = createHomework( | |
| subject: 'Math', | |
| todoDate: now, | |
| title: 'B', | |
| id: '3', | |
| ); | |
| final homeworks = [homeworkTomorrowB, homeworkTodayA, homeworkTodayB].toIList(); |
This PR adds high-value tests for the `HomeworkSortAndSubcategorizer` to ensure correct sorting and categorization of homeworks (Overdue, Today, Tomorrow, etc.) and regression tests for `StudentHomeworkView` date coloring boundary conditions. - Added `lib/hausaufgabenheft_logik/test/homework_sort_and_subcategorizer_test.dart` - Modified `lib/hausaufgabenheft_logik/test/create_student_homework_view_test.dart` Co-authored-by: nilsreichardt <24459435+nilsreichardt@users.noreply.github.com>
This PR introduces new unit tests for the
hausaufgabenheft_logikpackage to improve reliability in homework scheduling and display logic.Key Changes:
lib/hausaufgabenheft_logik/test/homework_sort_and_subcategorizer_test.dartHomeworkSortAndSubcategorizerfor correct grouping of homework into date sections (Overdue, Today, Tomorrow, In 2 Days, Later).SmallestDateSubjectAndTitleSort,SubjectSmallestDateAndTitleSort,WeekdayDateSubjectAndTitleSort).lib/hausaufgabenheft_logik/test/create_student_homework_view_test.dartcolorDateproperty to ensure homework due in exactly 2 days is NOT marked as urgent (red).These tests protect against regressions in core homework organization logic, ensuring users see the correct due dates and urgency indicators.
PR created automatically by Jules for task 482962541106125281 started by @nilsreichardt