From e251d77316ad3db0fcc622c9a130becdf3001195 Mon Sep 17 00:00:00 2001 From: Peter Schorn Date: Fri, 22 Nov 2024 23:36:56 -0600 Subject: [PATCH] Fixed a bug where the Spotify ids were not being sent in the correct format in the following methods (see #66): * `SpotifyAPI.saveAlbumsForCurrentUser`  * `SpotifyAPI.removeSavedAlbumsForCurrentUser` * `SpotifyAPI.saveEpisodesForCurrentUser` * `SpotifyAPI.removeSavedEpisodesForCurrentUser` * `SpotifyAPI.saveShowsForCurrentUser` * `SpotifyAPI.removeSavedShowsForCurrentUser` * `SpotifyAPI.saveTracksForCurrentUser` * `SpotifyAPI.removeSavedTracksForCurrentUser` --- .../xcschemes/SpotifyAPI-Package.xcscheme | 2 +- .../xcschemes/SpotifyAPI.xcscheme | 2 +- CHANGELOG.md | 17 ++++++++++ .../WebKitBrowserAuthorizer.swift | 2 +- .../SpotifyAPITests.swift | 1 + .../API/SpotifyAPI+Library.swift | 12 ++++--- .../API Tests/SpotifyAPIAlbumsTests.swift | 34 +++++++++++++++++++ 7 files changed, 63 insertions(+), 7 deletions(-) diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/SpotifyAPI-Package.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/SpotifyAPI-Package.xcscheme index a5f005913..d7498b6cb 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/SpotifyAPI-Package.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/SpotifyAPI-Package.xcscheme @@ -1,6 +1,6 @@ AnyPublisher { return self.saveItemsForCurrentUser( - uris: uris, types: [.show], path: "/me/shows" + uris: uris, + types: [.show], + path: "/me/shows", + idsInBody: false ) } @@ -816,7 +819,8 @@ public extension SpotifyAPI where uris: uris, types: [.show], path: "/me/shows", - market: market + market: market, + idsInBody: false ) } diff --git a/Tests/SpotifyAPIMainTests/API Tests/SpotifyAPIAlbumsTests.swift b/Tests/SpotifyAPIMainTests/API Tests/SpotifyAPIAlbumsTests.swift index df393c504..ee14e72ee 100644 --- a/Tests/SpotifyAPIMainTests/API Tests/SpotifyAPIAlbumsTests.swift +++ b/Tests/SpotifyAPIMainTests/API Tests/SpotifyAPIAlbumsTests.swift @@ -724,6 +724,40 @@ extension SpotifyAPIAlbumsTests { } + func trackLink() { + + func receiveTrackLink(_ album: Album) { + encodeDecode(album) + + XCTAssertEqual(album.name, "") + } + + let hrefString = """ + https://api.spotify.com/v1/albums/2zffBP6FVUDZ3dsKodfQi6 + """ + + let href = URL(string: hrefString)! + + let expectation = XCTestExpectation( + description: "testTrackLink" + ) + + Self.spotify.getFromHref(href, responseType: Album.self) + .assertNoFailure() + .receiveOnMain() + .sink( + receiveCompletion: { _ in expectation.fulfill() }, + receiveValue: receiveTrackLink(_:) + ) + .store(in: &Self.cancellables) + + self.wait( + for: [expectation], + timeout: 60 + ) + + } + func receiveAlbumTracksPage1(_ page: PagingObject) { print("begin receiveAlbumTracksPage1")