Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added upgrade option #222

Merged

Conversation

gpuligundla
Copy link

@gpuligundla gpuligundla commented Nov 12, 2023

πŸ“š Description

This PR Address the issue: #143

πŸ”– Changes

  • Added new option "--upgrade" to bashunit
  • Added unit test & acceptance tests for changes
  • Updated necessary files

βœ… To-do list

  • I updated the CHANGELOG.md to reflect the new feature or fix
  • I updated the documentation to reflect the changes

@Chemaclass Chemaclass added the enhancement New feature or request label Nov 12, 2023
@antonio-gg-dev
Copy link
Member

Thank you very much @gpuligundla, what I see looks very promising.

Just need to add some tests, include you in the changelog.md, and add the new option to the documentation (it would go here: docs/command-line.md).

Copy link
Member

@khru khru left a comment

Choose a reason for hiding this comment

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

I Agree with @Tito-Kati I'm lacking some acceptance test and some unit test for this

@gpuligundla gpuligundla marked this pull request as ready for review November 14, 2023 03:44
Comment on lines 194 to 196
function test_get_latest_tag() {
assert_not_empty "$(helpers::get_latest_tag)"
}
Copy link
Member

@Chemaclass Chemaclass Nov 15, 2023

Choose a reason for hiding this comment

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

Calling the actual method will imply I/O which by definition is not a unit test, because you are depending on external things. Therefore, we can mock the network response, and we will test the actual behaviour of the function. Consider the following example:

Suggested change
function test_get_latest_tag() {
assert_not_empty "$(helpers::get_latest_tag)"
}
function test_get_latest_tag() {
mock git<<EOF
fc9aac40eb8e5ad4483f08d79eb678a3650dcf78 refs/tags/0.1.0
a17e6816669ec8d0f18ed8c6d5564df9fc699bf9 refs/tags/0.10.0
3977be123b0b73cfdf4b4eff46b909f37aa83b3c refs/tags/0.10.1
b546c693198870dd75d1a102b94f4ddad6f4f3ea refs/tags/0.2.0
732ea5e8b16c3c05f0a6977b794ed7098e1839e2 refs/tags/0.3.0
EOF
assert_equals "0.10.1" "$(helpers::get_latest_tag)"
unset -f git # remove the mock
}

Copy link
Author

Choose a reason for hiding this comment

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

yeah, changed it. I never worked with the concept of mock. Thanks for introducing it to me.

Copy link
Member

@Chemaclass Chemaclass left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks a lot πŸ’―

@antonio-gg-dev antonio-gg-dev changed the base branch from main to feat/upgrade-option November 15, 2023 13:15
Copy link
Member

@antonio-gg-dev antonio-gg-dev left a comment

Choose a reason for hiding this comment

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

Thank you for collaborating with us and adding this great feature to our library.

@antonio-gg-dev antonio-gg-dev merged commit cb4d500 into TypedDevs:feat/upgrade-option Nov 15, 2023
@gpuligundla
Copy link
Author

Thank you so much, guys. It is my first notable open-source contribution <3

@antonio-gg-dev antonio-gg-dev mentioned this pull request Nov 17, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants