mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-29 03:57:11 +00:00
feat(torrents): add encryption policy
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
canonicalizeDownloadFileName,
|
||||
isValidTorrentExcludeTrackerList,
|
||||
isValidTorrentTrackerList,
|
||||
normalizeTorrentEncryptionPolicy,
|
||||
normalizeTorrentPrioritizePiece,
|
||||
redactDownloadForPersistence,
|
||||
resolveDownloadConnections
|
||||
@@ -92,6 +93,20 @@ describe('Torrent piece priority validation', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Torrent encryption policy validation', () => {
|
||||
it('accepts only the canonical policy states', () => {
|
||||
expect(normalizeTorrentEncryptionPolicy('disabled')).toBe('disabled');
|
||||
expect(normalizeTorrentEncryptionPolicy('require-crypto')).toBe('require-crypto');
|
||||
expect(normalizeTorrentEncryptionPolicy('force-encryption')).toBe('force-encryption');
|
||||
});
|
||||
|
||||
it('clears unknown or malformed persisted values', () => {
|
||||
expect(normalizeTorrentEncryptionPolicy(undefined)).toBeUndefined();
|
||||
expect(normalizeTorrentEncryptionPolicy('arc4')).toBeUndefined();
|
||||
expect(normalizeTorrentEncryptionPolicy(true)).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