fix(qbittorrent): add seeds/peers fields (num_seeds/num_leechs), guard empty response (closes #64)
Build and Push Docker Image / build (push) Successful in 50s
Licence Check / Licence compatibility and copyright header verification (push) Successful in 1m9s
Docs Check / Markdown lint (push) Successful in 1m19s
CI / Security audit (push) Successful in 2m8s
Docs Check / Mermaid diagram parse check (push) Successful in 2m33s
CI / Swagger Validation & Coverage (push) Successful in 2m40s
CI / Tests & coverage (push) Successful in 2m54s

This commit is contained in:
2026-05-28 15:52:52 +01:00
parent 6b73727d4e
commit 498eabc7bc
3 changed files with 38 additions and 0 deletions
@@ -130,6 +130,8 @@ describe('QBittorrentClient', () => {
downloaded: 750000000,
speed: 1048576,
eta: 3600,
seeds: 0,
peers: 0,
category: 'movies',
tags: ['movie', 'hd'],
savePath: '/downloads/test',
@@ -138,6 +140,28 @@ describe('QBittorrentClient', () => {
});
});
it('should expose connected seeds/peers from num_seeds and num_leechs (Issue #64)', () => {
const torrent = {
hash: 'def456',
name: 'Swarm Torrent',
state: 'downloading',
progress: 0.1,
size: 1000,
completed: 100,
dlspeed: 0,
eta: 0,
num_seeds: 7,
num_leechs: 3,
// Swarm totals — must NOT be picked up as connected counts
num_complete: 200,
num_incomplete: 50
};
const normalized = client.normalizeDownload(torrent);
expect(normalized.seeds).toBe(7);
expect(normalized.peers).toBe(3);
});
it('should handle unknown torrent states', () => {
const torrent = {
hash: 'abc123',