Skip to content

test: add tests for unprotected behavior#2193

Open
nilsreichardt wants to merge 2 commits into
mainfrom
test/homework-subcategorization-tests-482962541106125281
Open

test: add tests for unprotected behavior#2193
nilsreichardt wants to merge 2 commits into
mainfrom
test/homework-subcategorization-tests-482962541106125281

Conversation

@nilsreichardt

Copy link
Copy Markdown
Member

This PR introduces new unit tests for the hausaufgabenheft_logik package to improve reliability in homework scheduling and display logic.

Key Changes:

  • New Test File: lib/hausaufgabenheft_logik/test/homework_sort_and_subcategorizer_test.dart
    • Tests HomeworkSortAndSubcategorizer for correct grouping of homework into date sections (Overdue, Today, Tomorrow, In 2 Days, Later).
    • Verifies sorting logic within sections (by subject, title, date).
    • Tests different sorting strategies (SmallestDateSubjectAndTitleSort, SubjectSmallestDateAndTitleSort, WeekdayDateSubjectAndTitleSort).
  • Enhanced Test: lib/hausaufgabenheft_logik/test/create_student_homework_view_test.dart
    • Added boundary condition test for colorDate property 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

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>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions

github-actions Bot commented Feb 22, 2026

Copy link
Copy Markdown

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

@github-actions

github-actions Bot commented Feb 22, 2026

Copy link
Copy Markdown

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

@github-actions

github-actions Bot commented Feb 22, 2026

Copy link
Copy Markdown

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +71 to +90
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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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();
References
  1. Rule 141: AVOID abbreviations. The variable names h1, h2, and h3 are not descriptive and could be considered abbreviations. (link)
  2. Rule 144: PREFER a noun phrase for a non-boolean property or variable. Using more descriptive noun phrases for variables improves readability. (link)

Comment on lines +129 to +148
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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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();
References
  1. Rule 141: AVOID abbreviations. The variable names h1, h2, and h3 are not descriptive and could be considered abbreviations. (link)
  2. Rule 144: PREFER a noun phrase for a non-boolean property or variable. Using more descriptive noun phrases for variables improves readability. (link)

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant