-
Notifications
You must be signed in to change notification settings - Fork 4
test(medium): Refactor Spotify Polling service for better architectural separation #7123
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
Conversation
- Extract `getCurrentlyPlaying` logic from `SpotifyPolling.ts` into `SpotifyPlayerManager.ts` as `fetchPlaybackState`. - Create `services/spotifyUtils.ts` for shared utility `isEmptyResponseError`. - Remove `Track` and `Episode` imports from `SpotifyPolling.ts` and clean up logic. - Update `SpotifyPolling` to use `fetchPlaybackState` and handle state updates/broadcasting. - Add unit tests for `fetchPlaybackState` in `tests/unit/services/spotifyPlayerManager.test.ts`. - Addresses architectural directives to decompose the polling service. Co-authored-by: arii <342438+arii@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
📋 Quality Gate Results
❌ Lint Failure Details❌ Infrastructure Test Failure Details❌ Unit Test Failure Details❌ Component Test Failure Details❌ Visual Test Failure Details❌ Performance Test Failure Details
|
Acknowledged. I have fixed the linting issues (Prettier formatting and explicit any usage in tests). |
- Extract `fetchPlaybackState` logic into `SpotifyPlayerManager` with strict `ParsedPlaybackState` return type. - Create `services/spotifyUtils.ts` and move `isEmptyResponseError` there for shared use. - Update `SpotifyPolling` to delegate state fetching and remove redundant parsing logic. - Add comprehensive unit tests for `fetchPlaybackState` and fix lint/type issues in tests. Co-authored-by: arii <342438+arii@users.noreply.github.com>
This PR successfully refactors the Spotify Polling service, significantly improving architectural separation and code organization. The core logic for fetching and parsing the currently playing Spotify track/episode has been extracted from Strengths
Verdict✅ Verified the refactoring for better architectural separation and new unit tests. No regressions found. Ready for approval.
|
7eee0aa
into
feat/refactor-spotify-polling-180427182370128719
Description
This PR refactors the
SpotifyPollingservice to improve separation of concerns by moving thegetCurrentlyPlayingimplementation details intoSpotifyPlayerManager. It also introduces a shared utility for error checking and ensures all changes are covered by unit tests. This addresses the feedback from PR #6093.Fixes #
Change Type: 🏗️ Refactoring (code change that neither fixes bug nor adds feature)
PR Scope Checklist
This checklist is mandatory for all PRs.
Impact Assessment
Original PR Body
This PR refactors the
SpotifyPollingservice to improve separation of concerns by moving thegetCurrentlyPlayingimplementation details intoSpotifyPlayerManager. It also introduces a shared utility for error checking and ensures all changes are covered by unit tests. This addresses the feedback from PR #6093.PR created automatically by Jules for task 18352674082257778548 started by @arii