Skip to content

refactor: simplify user picture test#25

Merged
zetsux merged 1 commit intomainfrom
task/simplify-user-picture-test
Oct 25, 2025
Merged

refactor: simplify user picture test#25
zetsux merged 1 commit intomainfrom
task/simplify-user-picture-test

Conversation

@zetsux
Copy link
Owner

@zetsux zetsux commented Oct 25, 2025

Description

This pull request makes minor adjustments to the TestUserService_ChangePicture test in picture_test.go, mostly simplifying the test setup by removing unnecessary user creation logic.

Test setup simplification:

  • Removed the import of the custom error package errs, which is no longer needed due to the removal of user creation and error handling logic.
  • Refactored the test to use a single expectedUser object directly, eliminating the previous steps of simulating user creation and error handling for GetUserByPrimaryKey and CreateNewUser. The test now focuses only on changing the user's picture.

Change

Check all options that are relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have performed a self-review of my code
  • I have made sure that my fix is effective / my feature works
  • All other features still works locally with my changes
  • I have made API documentation and example response in Postman

@zetsux zetsux self-assigned this Oct 25, 2025
@zetsux zetsux requested a review from Copilot October 25, 2025 07:30
Copy link

Copilot AI left a comment

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 simplifies the TestUserService_ChangePicture test by removing unnecessary user creation setup and focusing solely on the picture change functionality. The refactoring eliminates redundant mock calls and intermediate variables while maintaining test coverage.

Key Changes:

  • Removed unused errs package import
  • Eliminated user creation logic and related mock setup
  • Replaced multi-step user creation with direct expectedUser instantiation

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

@zetsux zetsux merged commit 2f88337 into main Oct 25, 2025
1 check passed
@zetsux zetsux deleted the task/simplify-user-picture-test branch October 25, 2025 07:33
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