Files
usenet-indexer/tests/unit/release/source.spec.ts
T
Daan MeijerandClaude Fable 5.1 346493b6c3
Test and deploy / test (push) Failing after 50s
Test and deploy / edge (push) Successful in 1m53s
Test and deploy / deploy (push) Skipped
Voyager 3 schema: the slim catalog (migration 6000, the reset) and blocks (6100)
releases rebuilt without its text copies: poster_id, group_set_id,
bytea keys, source smallint, edge, settled_at as the finish. posters by
id, group_sets. blocks as the lease unit, ranges.block_id. fragments,
range_blocks, release_final, the settler and the fragment merger gone;
release_chunks, rule_counts and rule_samples keyed by block. Cold tables
on CHUNK_TABLESPACE. Migration 6000 truncates the catalog and refuses
without VOYAGER3_RESET=1.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 13:44:54 +01:00

20 lines
783 B
TypeScript

import { test } from '@japa/runner'
import { SOURCES, sourceCode, sourceName } from '#lib/release/source'
test.group('release source codes', () => {
test('names and codes map both ways; the codes are fixed', ({ assert }) => {
assert.deepEqual(SOURCES, { subject: 1, post: 2, stem: 3, spot: 4, nzb: 5, album: 6 })
for (const [name, code] of Object.entries(SOURCES)) {
assert.equal(sourceCode(name), code)
assert.equal(sourceName(code), name)
assert.equal(sourceName(String(code)), name)
}
})
test('an unknown name throws, an unknown code reads as unknown', ({ assert }) => {
assert.throws(() => sourceCode('subjekt'), /Unknown release source/)
assert.equal(sourceName(99), 'unknown')
assert.equal(sourceName(null), 'unknown')
})
})