Skip to content

tests: improve coverage#34

Merged
sozercan merged 3 commits intomainfrom
improve-tests
Jan 5, 2026
Merged

tests: improve coverage#34
sozercan merged 3 commits intomainfrom
improve-tests

Conversation

@sozercan
Copy link
Owner

@sozercan sozercan commented Jan 4, 2026

Description

improve overall coverage

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📚 Documentation update
  • 🎨 UI/UX improvement
  • ♻️ Refactoring (no functional changes)
  • 🧪 Test update
  • 🔧 Build/CI configuration

Related Issues

Changes Made

Testing

  • Unit tests pass (xcodebuild test -only-testing:KasetTests)
  • Manual testing performed
  • UI tested on macOS 26+

Checklist

  • My code follows the project's style guidelines
  • I have run swiftlint --strict && swiftformat .
  • I have added tests that prove my fix/feature works
  • New and existing unit tests pass locally
  • I have updated documentation if needed
  • I have checked for any performance implications
  • My changes generate no new warnings

Screenshots

Additional Notes

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Copilot AI review requested due to automatic review settings January 4, 2026 23:43
Copy link

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 comprehensive test coverage for parser, service, and view model components. The new tests follow the Swift Testing framework patterns and include thorough coverage of edge cases, error handling, and state management.

  • Adds parser tests for metadata extraction (songs, artists, lyrics, radio queues)
  • Adds service tests for player functionality, library management, and like/dislike operations
  • Adds view model tests with mock clients for testing data loading and state transitions

Reviewed changes

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

Show a summary per file
File Description
SongMetadataParserTests.swift Tests for parsing song metadata from renderer objects, including title, artists, thumbnails, duration, and menu data
SongLikeStatusManagerTests.swift Tests for managing song like/dislike status with caching and API synchronization
SettingsManagerTests.swift Tests for app settings including launch page configuration and navigation mappings
RadioQueueParserTests.swift Tests for parsing radio queue responses, including continuation handling and wrapped renderers
PlaylistDetailViewModelTests.swift Tests for playlist detail view model including loading, continuation, and deduplication logic
PlayerServiceMixTests.swift Tests for player service queue management including shuffle, reorder, and insertion operations
PlayerServiceLibraryTests.swift Tests for player service library actions including like/dislike and library status toggling
LyricsParserTests.swift Tests for extracting lyrics browse IDs and parsing lyrics content with multi-run support
LikedMusicViewModelTests.swift Tests for liked music view model including pagination and deduplication
ChartsViewModelTests.swift Tests for charts view model including background continuation loading
ArtistParserTests.swift Tests for parsing artist details, songs, albums, and subscription information
ArtistDetailViewModelTests.swift Tests for artist detail view model including subscription toggling and song fetching

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +60 to +67
// Cannot reset UserDefaults in test, but we verify the code path exists
#expect(manager.showNowPlayingNotifications == true || manager.showNowPlayingNotifications == false)
}

@Test("Default hapticFeedbackEnabled is true")
func defaultHapticFeedbackEnabled() {
let manager = SettingsManager.shared
#expect(manager.hapticFeedbackEnabled == true || manager.hapticFeedbackEnabled == false)
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

This test assertion always passes regardless of the actual value. The condition x == true || x == false is a tautology for any boolean value. Consider either testing the specific default value (e.g., #expect(manager.showNowPlayingNotifications == true)) or removing this test if the default value cannot be reliably verified in tests.

Suggested change
// Cannot reset UserDefaults in test, but we verify the code path exists
#expect(manager.showNowPlayingNotifications == true || manager.showNowPlayingNotifications == false)
}
@Test("Default hapticFeedbackEnabled is true")
func defaultHapticFeedbackEnabled() {
let manager = SettingsManager.shared
#expect(manager.hapticFeedbackEnabled == true || manager.hapticFeedbackEnabled == false)
// Cannot reset UserDefaults in test, but we still verify the expected default value
#expect(manager.showNowPlayingNotifications == true)
}
@Test("Default hapticFeedbackEnabled is true")
func defaultHapticFeedbackEnabled() {
let manager = SettingsManager.shared
#expect(manager.hapticFeedbackEnabled == true)

Copilot uses AI. Check for mistakes.
Comment on lines +61 to +67
#expect(manager.showNowPlayingNotifications == true || manager.showNowPlayingNotifications == false)
}

@Test("Default hapticFeedbackEnabled is true")
func defaultHapticFeedbackEnabled() {
let manager = SettingsManager.shared
#expect(manager.hapticFeedbackEnabled == true || manager.hapticFeedbackEnabled == false)
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

This test assertion always passes regardless of the actual value. The condition x == true || x == false is a tautology for any boolean value. Consider either testing the specific default value (e.g., #expect(manager.hapticFeedbackEnabled == true)) or removing this test if the default value cannot be reliably verified in tests.

Suggested change
#expect(manager.showNowPlayingNotifications == true || manager.showNowPlayingNotifications == false)
}
@Test("Default hapticFeedbackEnabled is true")
func defaultHapticFeedbackEnabled() {
let manager = SettingsManager.shared
#expect(manager.hapticFeedbackEnabled == true || manager.hapticFeedbackEnabled == false)
#expect(manager.showNowPlayingNotifications == true)
}
@Test("Default hapticFeedbackEnabled is true")
func defaultHapticFeedbackEnabled() {
let manager = SettingsManager.shared
#expect(manager.hapticFeedbackEnabled == true)

Copilot uses AI. Check for mistakes.
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Review feedback from Copilot - the original assertions
always pass regardless of actual value. Now testing expected defaults directly.
@sozercan sozercan merged commit 8a1bad8 into main Jan 5, 2026
6 checks passed
@sozercan sozercan deleted the improve-tests branch January 5, 2026 00:02
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.

2 participants