19 lines
663 B
TypeScript
19 lines
663 B
TypeScript
import { test } from '@japa/runner'
|
|
import { parseGroupResponse } from '#lib/nntp/group'
|
|
|
|
test.group('nntp / parseGroupResponse', () => {
|
|
test('parses the reply from news.eweka.nl', ({ assert }) => {
|
|
// Captured 2026-09-27. count == last - first + 1, so the field order is standard.
|
|
assert.deepEqual(parseGroupResponse('211 27275164317 266599 27275430915 alt.binaries.test'), {
|
|
count: 27275164317n,
|
|
first: 266599n,
|
|
last: 27275430915n,
|
|
name: 'alt.binaries.test',
|
|
})
|
|
})
|
|
|
|
test('rejects non-211 replies', ({ assert }) => {
|
|
assert.throws(() => parseGroupResponse('411 No such group'), /Unexpected GROUP response/)
|
|
})
|
|
})
|