fix(transmission): map status 7 to Checking, implement control methods (closes #63)
Docs Check / Markdown lint (push) Failing after 1m14s
Build and Push Docker Image / build (push) Successful in 1m40s
Licence Check / Licence compatibility and copyright header verification (push) Successful in 1m54s
CI / Security audit (push) Successful in 2m16s
CI / Swagger Validation & Coverage (push) Successful in 2m42s
Docs Check / Mermaid diagram parse check (push) Successful in 2m43s
CI / Tests & coverage (push) Successful in 2m55s
Docs Check / Markdown lint (push) Failing after 1m14s
Build and Push Docker Image / build (push) Successful in 1m40s
Licence Check / Licence compatibility and copyright header verification (push) Successful in 1m54s
CI / Security audit (push) Successful in 2m16s
CI / Swagger Validation & Coverage (push) Successful in 2m42s
Docs Check / Mermaid diagram parse check (push) Successful in 2m43s
CI / Tests & coverage (push) Successful in 2m55s
This commit is contained in:
@@ -154,7 +154,9 @@ describe('TransmissionClient', () => {
|
||||
4: 'Downloading',
|
||||
5: 'Queued',
|
||||
6: 'Seeding',
|
||||
7: 'Unknown'
|
||||
// Issue #63: code 7 is undocumented in the RPC spec; mapped to
|
||||
// `Checking` (legacy alias for code 2) as a best-effort interpretation.
|
||||
7: 'Checking'
|
||||
};
|
||||
|
||||
Object.entries(statusMap).forEach(([status, expectedStatus]) => {
|
||||
@@ -433,4 +435,42 @@ describe('TransmissionClient', () => {
|
||||
expect(normalized.arrType).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Torrent Control Methods (Issue #63)', () => {
|
||||
it('startTorrent invokes torrent-start RPC with ids array', async () => {
|
||||
client.makeRequest = vi.fn().mockResolvedValue({ data: { result: 'success' } });
|
||||
await client.startTorrent('abc123');
|
||||
expect(client.makeRequest).toHaveBeenCalledWith('torrent-start', { ids: ['abc123'] });
|
||||
});
|
||||
|
||||
it('startTorrent accepts an array of ids', async () => {
|
||||
client.makeRequest = vi.fn().mockResolvedValue({ data: { result: 'success' } });
|
||||
await client.startTorrent([1, 2, 3]);
|
||||
expect(client.makeRequest).toHaveBeenCalledWith('torrent-start', { ids: [1, 2, 3] });
|
||||
});
|
||||
|
||||
it('stopTorrent invokes torrent-stop RPC', async () => {
|
||||
client.makeRequest = vi.fn().mockResolvedValue({ data: { result: 'success' } });
|
||||
await client.stopTorrent(42);
|
||||
expect(client.makeRequest).toHaveBeenCalledWith('torrent-stop', { ids: [42] });
|
||||
});
|
||||
|
||||
it('removeTorrent invokes torrent-remove with delete-local-data=false by default', async () => {
|
||||
client.makeRequest = vi.fn().mockResolvedValue({ data: { result: 'success' } });
|
||||
await client.removeTorrent('hashX');
|
||||
expect(client.makeRequest).toHaveBeenCalledWith('torrent-remove', {
|
||||
ids: ['hashX'],
|
||||
'delete-local-data': false
|
||||
});
|
||||
});
|
||||
|
||||
it('removeTorrent passes delete-local-data=true when requested', async () => {
|
||||
client.makeRequest = vi.fn().mockResolvedValue({ data: { result: 'success' } });
|
||||
await client.removeTorrent('hashY', true);
|
||||
expect(client.makeRequest).toHaveBeenCalledWith('torrent-remove', {
|
||||
ids: ['hashY'],
|
||||
'delete-local-data': true
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user