fix: skip null album entries in subsonic pagination
This commit is contained in:
@@ -96,4 +96,26 @@ describe('SubsonicClient', () => {
|
||||
await c.getAllAlbums((_albums, done) => progress.push(done))
|
||||
expect(progress[progress.length - 1]!).toBe(503)
|
||||
})
|
||||
|
||||
it('getAllAlbums skips null album entries', async () => {
|
||||
const c = new SubsonicClient({
|
||||
url: 'http://x',
|
||||
username: 'sam',
|
||||
password: 'pass',
|
||||
fetchImpl: (async () =>
|
||||
subsonicResponse({
|
||||
'subsonic-response': {
|
||||
status: 'ok',
|
||||
albumList2: {
|
||||
album: [{ id: 1, name: 'Album 1', artist: 'Artist 0' }, null, { id: 2, name: 'Album 2', artist: 'Artist 0' }],
|
||||
},
|
||||
},
|
||||
})) as typeof fetch,
|
||||
})
|
||||
const albums = await c.getAllAlbums()
|
||||
expect(albums).toEqual([
|
||||
{ id: '1', title: 'Album 1', artist: 'Artist 0' },
|
||||
{ id: '2', title: 'Album 2', artist: 'Artist 0' },
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user