feat: add authenticated list reading

This commit is contained in:
2026-07-26 12:58:35 +09:00
parent 83992bd962
commit 604c7f16e2
28 changed files with 947 additions and 29 deletions
+32
View File
@@ -1,6 +1,8 @@
import { describe, expect, it } from 'vitest'
import {
buildSearchQuery,
listRouteSearchSchema,
normalizeListTarget,
normalizeTweetId,
normalizeUserTarget,
threadPageInputSchema,
@@ -67,6 +69,36 @@ describe('normalizeUserTarget', () => {
})
})
describe('normalizeListTarget', () => {
it.each([
['1234567890', '1234567890'],
[' https://x.com/i/lists/1234567890 ', '1234567890'],
['https://twitter.com/i/lists/1234567890/', '1234567890'],
])('normalizes %s', (input, expected) => {
expect(normalizeListTarget(input)).toBe(expected)
})
it.each([
'',
'not-a-list',
'12345',
'https://example.com/i/lists/1234567890',
'https://x.com/tan_stack/lists',
'https://x.com/i/lists/1234567890/members',
'https://x.com/i/lists/not-a-list',
])('rejects %s', (input) => {
expect(() => normalizeListTarget(input)).toThrow()
})
})
describe('listRouteSearchSchema', () => {
it('keeps a numeric list target from a hand-entered URL', () => {
expect(listRouteSearchSchema.parse({ target: 1234567890 })).toEqual({
target: '1234567890',
})
})
})
describe('buildSearchQuery', () => {
it('keeps a deliberate query unchanged', () => {
expect(buildSearchQuery(' AI lang:ja ', false)).toBe('AI lang:ja')