spotify-web-api-wrapper
spotify-web-api-wrapper copied to clipboard
Refactor: Improve code readability and modularity by introducing constants, decomposing conditions, and refactoring test logic
This pull request includes a series of refactorings to improve code readability and modularity. The changes are as follows:
Introduce MAX_EPISODE_ID_ALLOWED constant: Replaced the magic number with a named constant MAX_EPISODE_ID_ALLOWED to improve code clarity and provide better context on its purpose.
Decompose complex conditional into static methods: Simplified the complex if-else condition in Playlist logic by creating two static methods to handle null checks for input parameters, enhancing code readability and maintainability.
Rename variable to maxEpisodeIds: Renamed the variable to maxEpisodeIds for better readability, making it clearer and more aligned with naming conventions.
Refactor ResponseChecker to handle different HTTP response codes: Updated the ResponseChecker class to handle various HTTP response codes more effectively, including 200, 400, 401, and 500. This provides better error handling and cleaner response management.
Move player device and context API testing logic to separate classes: Extracted the player device and context API testing logic into dedicated classes to improve test structure and maintainability.
Introduce abstract class for shared player service tests: Added an abstract class for shared player service tests, with specific concrete test classes for each player service type. This reduces code duplication and improves test organization.