mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-17 14:57:49 +00:00
feat(torrents): add global open-file limit
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
isValidTorrentExcludeTrackerList,
|
||||
isValidTorrentTrackerList,
|
||||
normalizeTorrentEncryptionPolicy,
|
||||
normalizeTorrentMaxOpenFiles,
|
||||
normalizeTorrentPrioritizePiece,
|
||||
normalizeTorrentTrackerInterval,
|
||||
normalizeTorrentTrackerTimeout,
|
||||
@@ -126,6 +127,19 @@ describe('Torrent tracker timing validation', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Torrent open-file limit validation', () => {
|
||||
it('accepts bounded integer limits', () => {
|
||||
expect(normalizeTorrentMaxOpenFiles(1)).toBe(1);
|
||||
expect(normalizeTorrentMaxOpenFiles(4096)).toBe(4096);
|
||||
});
|
||||
|
||||
it('rejects zero, fractional, and oversized limits', () => {
|
||||
expect(normalizeTorrentMaxOpenFiles(0)).toBeUndefined();
|
||||
expect(normalizeTorrentMaxOpenFiles('1.5')).toBeUndefined();
|
||||
expect(normalizeTorrentMaxOpenFiles(4097)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('download connection resolution', () => {
|
||||
it('uses a clamped fallback for legacy rows without a saved value', () => {
|
||||
expect(resolveDownloadConnections(undefined, 8)).toBe(8);
|
||||
|
||||
Reference in New Issue
Block a user