Skip to content

Make general LoggerMock#4138

Merged
imnasnainaec merged 1 commit intomasterfrom
backend-logger-mock
Feb 9, 2026
Merged

Make general LoggerMock#4138
imnasnainaec merged 1 commit intomasterfrom
backend-logger-mock

Conversation

@imnasnainaec
Copy link
Copy Markdown
Collaborator

@imnasnainaec imnasnainaec commented Feb 5, 2026

Split off from #4122


This change is Reviewable

Summary by CodeRabbit

  • Tests
    • Updated test infrastructure and reorganized mock dependency injection for controller tests.
    • Added new test mock implementation to improve logging verification in tests.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

This PR refactors test dependencies in LiftControllerTests by extracting mocks into explicitly declared variables and introduces a new generic LoggerMock class to replace an inline MockLogger implementation.

Changes

Cohort / File(s) Summary
Test Setup Refactoring
Backend.Tests/Controllers/LiftControllerTests.cs
Restructured test initialization to use pre-declared mock instances (SemanticDomainRepositoryMock, HubContextMock, PermissionServiceMock, and LoggerMock) instead of inline instantiation and removed the local MockLogger implementation.
Logger Mock Implementation
Backend.Tests/Mocks/LoggerMock.cs
Added new generic LoggerMock class implementing ILogger with BeginScope, IsEnabled, and Log methods that output formatted logs to console.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • #4091: Modifies LiftControllerTests and LiftController dependency wiring with similar mock and constructor parameter adjustments.

Suggested reviewers

  • jasonleenaylor

Poem

🐰✨ A logger mock hops into the scene,
Mocks arranged in a pattern so clean!
Dependencies extracted with care,
Console logs everywhere, everywhere!
Tests now structured, refactored with grace.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: creating a reusable LoggerMock class extracted as a general utility for testing, which is the primary focus of the changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch backend-logger-mock

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.54%. Comparing base (956e69e) to head (635c686).
⚠️ Report is 32 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4138       +/-   ##
===========================================
+ Coverage   74.76%   86.54%   +11.78%     
===========================================
  Files         295       54      -241     
  Lines       10958     4758     -6200     
  Branches     1371      584      -787     
===========================================
- Hits         8193     4118     -4075     
+ Misses       2368      498     -1870     
+ Partials      397      142      -255     
Flag Coverage Δ
backend 86.54% <ø> (ø)
frontend ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

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

@jasonleenaylor reviewed 2 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec).

@imnasnainaec imnasnainaec merged commit 8ebc0d3 into master Feb 9, 2026
16 checks passed
@imnasnainaec imnasnainaec deleted the backend-logger-mock branch February 9, 2026 18:04
@coderabbitai coderabbitai Bot mentioned this pull request Feb 24, 2026
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.

2 participants