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

Refactor CollectionsControllerTest for Improved Readability and Maintainability #499

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sanowl
Copy link

@sanowl sanowl commented Jun 16, 2024

This pull request refactors the CollectionsControllerTest to enhance its readability and maintainability. The changes include consolidating stubs, using let and before hooks, improving readability through helper methods, and making use of more descriptive assertions.

  • Grouped repeated stub setups into separate methods.

  • Utilized let and before hooks for simplified setup and user login.

  • Improved readability with helper methods for repeated logic.

  • Added descriptive methods for verifying expectations.

  • Ensured all original test cases and functionalities are intact.

  • Added default_headers method for common request headers.

  • Added setup_show_stubs, setup_granule_not_found_stubs, setup_granule_revision_stubs, and setup_create_stubs methods to reduce redundancy in stub setups.

  • Added assert_collection_and_granule_saved_correctly and assert_iso_record_saved_correctly methods for clearer assertions.

  • Used assert_redirected_to and assert_equal for more explicit assertions.

This refactor aims to make the test suite easier to understand, maintain, and extend in the future.

All existing tests have been run and verified to ensure they pass with the refactored code.

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.

1 participant