Files
usenet-indexer/tests/unit/release/readable.spec.ts
T
Daan MeijerandClaude Fable 5.1 3612bf3e43
Test and deploy / test (push) Successful in 2m49s
Test and deploy / deploy (push) Successful in 3m24s
Readable names: CamelCase product names and words with numbers stay readable
The production dry run of releases:readable flagged 5.37M of 19.8M rows,
and its first sample held real names: "CrossStitcher - Issue 440",
"SchiffsModell", "FastFilms 2.04", "BestCrypt NP v4.0", "SmithsWork",
"Laura15Juli2026". Two CamelCase words with few vowels have four runs and
no lone letter: a scramble now needs five runs, a lone letter or an inner
capital run besides its few vowels; the consonant-run clause is gone
(it counted y); a token whose letter runs are all words or acronyms with
numbers between them is neutral. On a 49k-row production sample the
flagged share went from 27.4% to 26.4% with the letters-only flags all
scrambles; the evaluation sets are unchanged (LOG.md (129)).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-02 13:22:54 +01:00

82 lines
2.9 KiB
TypeScript

import { test } from '@japa/runner'
import { isUnreadableName, tokenKind } from '#lib/release/index'
test.group('release / isUnreadableName', () => {
test('scrambles with separators, spaces, random extensions, packaging words and hex with an addon are unreadable', ({
assert,
}) => {
for (const n of [
'Zx5AjNaK-mh7CFg6Hf8uu.part01.rar',
'yWjfnT2ujG4wJj3fG46o0FLzsgkvhmrTsAfW2.E0WsOU',
'PsNdnYiugfZ.rar',
'phfplC9y07U2yrj',
'n5d1ueIf34X',
'tJqr1tq7xK',
'Description - Lt5nHjlo3RiuBb3C.par2',
'bd5b4a59f3aa87114dcf75c0-addon.rar',
'mrrtmzrzmi4dgmrzmyytqmlbztczbx',
'AA-NaR16302830434zxP32108309f3Ab',
'_QBs01_MqZYnYwM_iAyRquhc-',
'sgkra vU7u2yuw9LDLCjDu04pOez',
'Jk5Pud.zQdNj',
'7uKsD_NRgT-G_Uc_p8',
'NtpUgCmS_Xa1B2Pk',
'{E11BF8E9-E2C9-4DAE-A1B2-8027BC465F3F}',
'IkYovjrtZrItjQ.mkv',
'ff75ce3f16c746c18b2d78cf.6c52f',
'prvjr7hapd0i1ny14pz4',
]) {
assert.isTrue(isUnreadableName(n), n)
}
})
test('scene tags, CamelCase, codes, leet, acronyms and a hash beside words are readable', ({
assert,
}) => {
for (const n of [
'Dark.Matter.2024.S02E10.No.Quiet.Life.1080p.ATVP.WEB-DL.DDP5.1.Atmos.H.264-Kitsune',
'Paul McCartney - Band on the Run',
'ShesSoWild - Ester Ana 1080p',
'MyDadsHotGirlfriend.13.02.01.Luna.Star.XXX.1080p.x264-SEXORS',
'cFosSpeed 11.0 Build 2420 x86 x64 incl Patch.rar',
'Rocketship-Hurt_Feelings-WEB-2026-PreMaxXxing',
'Drum-and-BassDJ_Samurai-Sound_With_Fire_Artemis-(FQY026)-WEB-2006-PRESCRiPTiON',
'Kleverig-H4rd-N12uk3b18-luc16037-720p-smpwr',
'Eclipse_IDE_2023-12_R_win32_x86_64.zip',
'PartsHPGL 1.06c',
'Go4Customer Fax Machine v1.2b',
'AdBeGone 1.2',
'3DMark03 320',
'COD4MW2REMASTERED',
'Movie.2020.1080p-GRP [a3f9e2b1]',
'EPL__NZBSPLIT__f1fdb433772a1a7771d6b73c875009ff__NZBSPLIT__EPL.2026.Liverpool.vs.Brighton.1080pEN50fps',
'iPhone',
'Some.Show.S01E01.1080p.mkv',
'FastFilms 2.04',
'BestCrypt NP v4.0',
'EasyHTML 2.35 German',
'SchiffsModell - September 2026',
'CrossStitcher - Issue 440, October 2026',
'Laura15Juli2026',
'IHaveAWife - Isa Bella',
'DickHDDaily - Santana Red',
'1904-SmithsWork-Hasluck',
]) {
assert.isFalse(isUnreadableName(n), n)
}
})
test('token kinds', ({ assert }) => {
assert.equal(tokenKind('Champions'), 'word')
assert.equal(tokenKind('PRESCRiPTiON'), 'word')
assert.equal(tokenKind('GarciaLive'), null)
assert.equal(tokenKind('S02E10'), null)
assert.equal(tokenKind('1080p'), null)
assert.equal(tokenKind('addon'), null)
assert.equal(tokenKind('NtpUgCmS'), 'random')
assert.equal(tokenKind('tBWTuz'), 'random')
assert.equal(tokenKind('Lt5nHjlo3RiuBb3C'), 'random')
assert.equal(tokenKind('a3f9e2b1'), 'random')
})
})