[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
0

Configure Feed

Select the types of activity you want to include in your feed.

test(applemusic): add tests for stripping EP/Single album suffixes

Added test cases to ensure that ' - EP' and ' - Single' suffixes are correctly stripped from Apple Music album names during the formatting process.

Exerra (Jul 15, 2026, 4:21 PM +0300) 93a1042e ba010240

+56
+56
src/backend/tests/applemusic/applemusic.test.ts
··· 245 245 const diffMiddleToOldest = middlePlayTime!.diff(oldestPlayTime!, 'seconds'); 246 246 expect(diffMiddleToOldest).to.be.closeTo(200, 1); 247 247 }); 248 + }); 249 + 250 + describe('Apple Music - Format Play Object', function () { 251 + 252 + it(`Strips " - EP" and " - Single" suffixes from album names`, function () { 253 + // Mock Apple Music API Song objects 254 + const trackEP = { 255 + id: '1', 256 + type: 'songs', 257 + name: 'SONG A', 258 + artistName: 'ARIST A', 259 + albumName: 'ALBUM A - EP', 260 + durationInMillis: 200000 261 + } as any; // Cast as any to bypass TS complaining about missing API fields (artworks, etc.) 262 + 263 + const trackSingle = { 264 + id: '2', 265 + type: 'songs', 266 + name: 'SONG B', 267 + artistName: 'ARIST B', 268 + albumName: 'ALBUM B - Single', 269 + durationInMillis: 200000 270 + } as any; 271 + 272 + const trackNormal = { 273 + id: '3', 274 + type: 'songs', 275 + name: 'SONG C', 276 + artistName: 'ARIST C', 277 + albumName: 'ALBUM C - The 2nd Album', 278 + durationInMillis: 200000 279 + } as any; 280 + 281 + const trackLowercase = { 282 + id: '4', 283 + type: 'songs', 284 + name: 'song d', 285 + artistName: 'artist d', 286 + albumName: 'album d - ep', 287 + durationInMillis: 200000 288 + } as any; 289 + 290 + // Run them through the formatter 291 + const playEP = AppleMusicSource.formatPlayObj(trackEP); 292 + const playSingle = AppleMusicSource.formatPlayObj(trackSingle); 293 + const playNormal = AppleMusicSource.formatPlayObj(trackNormal); 294 + const playLowercase = AppleMusicSource.formatPlayObj(trackLowercase); 295 + 296 + // Assert the suffixes are removed 297 + expect(playEP.data.album).to.equal('ALBUM A'); 298 + expect(playSingle.data.album).to.equal('ALBUM B'); 299 + expect(playLowercase.data.album).to.equal('album d'); 300 + 301 + // Assert normal album names are untouched 302 + expect(playNormal.data.album).to.equal(trackNormal.albumName); 303 + }); 248 304 });