1050-fix: Fix undefined subtitle for angular course in course card - #1061
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughRemoved Angular-specific title special-case in CourseCard; made Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can get early access to new features in CodeRabbit.Enable the |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/entities/course/ui/course-card/course-card.test.tsx (1)
24-26: Add an explicit regression case for missing Angular subtitles.This expectation rebuilds the same condition as the component, so it doesn't clearly prove the
subTitle: undefinedbug is fixed. A dedicated test with Angular +subTitle={undefined}would make the regression coverage much stronger.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/entities/course/ui/course-card/course-card.test.tsx` around lines 24 - 26, The test currently reconstructs the component logic using the mark/title computation (variables mark and title) and doesn't explicitly assert the regression where Angular courses may have subTitle undefined; add a dedicated unit test in course-card.test.tsx that renders the CourseCard (or the component under test) with course.title === COURSE_TITLES.ANGULAR and course.subTitle set to undefined, then assert the rendered output does not include a subtitle parenthesis and matches the expected title string without the subtitle; reference the COURSE_TITLES.ANGULAR constant and the course.subTitle prop to locate where to add this regression case.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/entities/course/ui/course-card/course-card.test.tsx`:
- Around line 24-26: The test currently reconstructs the component logic using
the mark/title computation (variables mark and title) and doesn't explicitly
assert the regression where Angular courses may have subTitle undefined; add a
dedicated unit test in course-card.test.tsx that renders the CourseCard (or the
component under test) with course.title === COURSE_TITLES.ANGULAR and
course.subTitle set to undefined, then assert the rendered output does not
include a subtitle parenthesis and matches the expected title string without the
subtitle; reference the COURSE_TITLES.ANGULAR constant and the course.subTitle
prop to locate where to add this regression case.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 761f377a-cd46-463d-a59d-94c320773770
📒 Files selected for processing (3)
src/entities/course/ui/course-card/course-card.test.tsxsrc/entities/course/ui/course-card/course-card.tsxsrc/widgets/external-embed-content/ui/courses/courses.test.tsx
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/entities/course/ui/course-card/course-card.test.tsx`:
- Around line 23-26: The test builds the expected title using a non-existent
property course.showMentoringStartDate; remove that invalid access and derive
the mark solely from course.subTitle (i.e., const mark = course.subTitle ? `
(${course.subTitle})` : ''), then compute title as `${course.title}${mark}` so
the expectation matches the rendered <CourseCard {...course} /> without adding
showMentoringStartDate.
In `@src/widgets/external-embed-content/ui/courses/courses.test.tsx`:
- Around line 20-23: The test accesses a non-existent property
c.showMentoringStartDate on mockedCourses; update either the Course type
(src/entities/course/types.ts) to include showMentoringStartDate and add that
field to the mockedCourses test fixtures, or change the mark logic in
courses.test.tsx to rely only on existing properties (e.g., use c.subTitle
presence) and remove references to showMentoringStartDate so the comparison uses
`${c.title}${c.subTitle ? ` (${c.subTitle})` : ''}`; modify the Course type,
mockedCourses fixture, or the comparison in the test accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3a22705e-b9c7-4e74-b04c-70bcb50ff267
📒 Files selected for processing (3)
src/entities/course/ui/course-card/course-card.test.tsxsrc/entities/course/ui/course-card/course-card.tsxsrc/widgets/external-embed-content/ui/courses/courses.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- src/entities/course/ui/course-card/course-card.tsx
What type of PR is this? (select all that apply)
Description
Related Tickets & Documents
Screenshots, Recordings
Please replace this line with any relevant images for UI changes.
Added/updated tests?
[optional] Are there any post deployment tasks we need to perform?
[optional] What gif best describes this PR or how it makes you feel?
Summary by CodeRabbit