Skip to content

Adding mocks for the flag service - #11

Merged
serroba merged 3 commits into
mainfrom
dev
Jan 2, 2026
Merged

Adding mocks for the flag service#11
serroba merged 3 commits into
mainfrom
dev

Conversation

@serroba

@serroba serroba commented Jan 2, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings January 2, 2026 06:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces mock-based testing for the handler package by adding a FlagService interface and using gomock for test isolation. The refactoring improves test maintainability and focuses handler tests on handler-specific behavior rather than integration with the service layer.

  • Defines a FlagService interface to enable mocking
  • Replaces integration-style tests with unit tests using gomock mocks
  • Removes the custom failingRepository test helper in favor of mock expectations

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/handler/handler.go Introduces the FlagService interface with Create and Evaluate methods, updates Handler to depend on the interface, and adds go:generate directive for mock generation
internal/handler/mock_service_test.go Generated mock implementation of FlagService using mockgen for use in handler tests
internal/handler/handler_test.go Refactors all handler tests to use mocked FlagService instead of concrete implementations, removes the failingRepository helper, and renames one test for clarity
go.mod Adds go.uber.org/mock v0.6.0 as an indirect dependency
go.sum Adds checksums for go.uber.org/mock v0.6.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@serroba
serroba merged commit 61bfa67 into main Jan 2, 2026
1 check passed
@codecov

codecov Bot commented Jan 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (17ae615) to head (28c3561).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #11   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          176       176           
=========================================
  Hits           176       176           

☔ 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.

@serroba
serroba deleted the dev branch January 2, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants