Skip to content

chore: add unit tests for package:install and package:uninstall commands#977

Merged
almas-x merged 2 commits intomasterfrom
almas/chore
Mar 31, 2025
Merged

chore: add unit tests for package:install and package:uninstall commands#977
almas-x merged 2 commits intomasterfrom
almas/chore

Conversation

@almas-x
Copy link
Contributor

@almas-x almas-x commented Mar 28, 2025

📑 Description

Closes https://github.com/goravel/goravel/issues/

✅ Checks

  • Added test cases for my code

Copilot AI review requested due to automatic review settings March 28, 2025 06:31
@almas-x almas-x requested a review from a team as a code owner March 28, 2025 06:31
Copy link
Contributor

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 adds unit tests for the package:install and package:uninstall commands to verify their signature, description, extension, and handling behavior.

  • Adds tests for package uninstall command covering error handling and success scenarios.
  • Adds tests for package install command validating installation failure and success cases.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
foundation/console/package_uninstall_command_test.go Unit tests for verifying the uninstall command behavior and error messages.
foundation/console/package_install_command_test.go Unit tests for verifying the install command behavior and proper error messages.

@codecov
Copy link

codecov bot commented Mar 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.07%. Comparing base (9fe0192) to head (14279c4).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #977      +/-   ##
==========================================
+ Coverage   69.10%   70.07%   +0.97%     
==========================================
  Files         168      168              
  Lines       11340    11340              
==========================================
+ Hits         7836     7946     +110     
+ Misses       3152     3042     -110     
  Partials      352      352              

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

Comment on lines +151 to +152
// TODO: A real package needs to be created to test installation
// when goravel/goravel upgrades all internal default dependencies to the latest version.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to implement here? If not, we may test it in goravel/example, and remove these lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can clone the goravel/goravel repository, then use make:package to create a local package. After that, install it with package:install and perform some assertions. However, some dependencies in goravel/goravel, such as gin, are not up-to-date, which causes the artisan commands to fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I suggest removing this case here and testing the logic in goravel/example.

Copy link
Contributor

@hwbrzzl hwbrzzl left a comment

Choose a reason for hiding this comment

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

lgtm

@almas-x almas-x merged commit 30a10c3 into master Mar 31, 2025
13 checks passed
@almas-x almas-x deleted the almas/chore branch March 31, 2025 01:56
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.

3 participants