fix: resolve missing Radarr and Sonarr links on active downloads (fixes #59)
This commit is contained in:
@@ -563,6 +563,47 @@ describe('GET /api/dashboard/user-downloads', () => {
|
||||
expect(dl.canBlocklist).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Radarr/Sonarr deep-links decoration (Issue #59)', () => {
|
||||
it('decorates active series downloads with Sonarr links for administrator', async () => {
|
||||
const app = createApp({ skipRateLimits: true });
|
||||
const { cookies } = await loginAs(app, EMBY_ADMIN_USER, EMBY_ADMIN_AUTH);
|
||||
|
||||
// Seed cache: queue record exists and matches SABnzbd slot
|
||||
cache.set('poll:sab-queue', { slots: [ADMIN_SAB_SLOT], status: 'Downloading', speed: '10 MB/s' }, CACHE_TTL);
|
||||
cache.set('poll:sab-history', { slots: [] }, CACHE_TTL);
|
||||
cache.set('poll:sonarr-queue', { records: [ADMIN_SONARR_QUEUE_RECORD] }, CACHE_TTL);
|
||||
cache.set('poll:sonarr-history', { records: [] }, CACHE_TTL);
|
||||
cache.set('poll:sonarr-tags', [{ data: SONARR_TAGS }], CACHE_TTL);
|
||||
cache.set('poll:radarr-queue', { records: [] }, CACHE_TTL);
|
||||
cache.set('poll:radarr-history', { records: [] }, CACHE_TTL);
|
||||
cache.set('poll:radarr-tags', RADARR_TAGS, CACHE_TTL);
|
||||
cache.set('poll:qbittorrent', [], CACHE_TTL);
|
||||
|
||||
// Mock Sonarr /api/v3/series response carrying titleSlug and seriesId matching our record
|
||||
nock(SONARR_BASE)
|
||||
.get('/api/v3/series')
|
||||
.reply(200, [
|
||||
{ id: 43, title: 'Admin Show', titleSlug: 'admin-show' }
|
||||
]);
|
||||
|
||||
// Mock Radarr /api/v3/movie response
|
||||
nock(RADARR_BASE)
|
||||
.get('/api/v3/movie')
|
||||
.reply(200, []);
|
||||
|
||||
const res = await request(app)
|
||||
.get('/api/dashboard/user-downloads')
|
||||
.set('Cookie', cookies);
|
||||
|
||||
expect(res.status).toBe(200);
|
||||
const downloads = res.body.downloads;
|
||||
const dl = downloads.find(d => d.type === 'series');
|
||||
expect(dl).toBeDefined();
|
||||
expect(dl.arrLink).toBe('https://sonarr.test/series/admin-show');
|
||||
expect(dl.arrType).toBe('sonarr');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user