fix: follow/unfollow hardening (#54) (thanks @citizenlee)

This commit is contained in:
Peter Steinberger
2026-06-24 18:43:54 +09:00
committed by yuta
parent 38d5dfe96a
commit 966599522a
10 changed files with 172 additions and 74 deletions
+13 -7
View File
@@ -149,15 +149,21 @@ d('live CLI (Twitter/X)', () => {
expect(whoamiStdout).toContain('credentials:');
});
it('about returns account JSON', async () => {
const aboutHandle = (process.env.BIRD_LIVE_ABOUT_HANDLE ?? handle).trim() || handle;
const about = await runBird([...baseArgs, '--cookie-timeout', cookieTimeoutArg, 'about', aboutHandle, '--json'], {
it('follow/unfollow works (opt-in)', async () => {
const followHandle = (process.env.BIRD_LIVE_FOLLOW_HANDLE ?? '').trim();
if (!followHandle) {
return;
}
const follow = await runBird([...baseArgs, '--cookie-timeout', cookieTimeoutArg, 'follow', followHandle], {
timeoutMs: 45_000,
});
expect(about.exitCode).toBe(0);
const payload = parseJson<Record<string, unknown>>(about.stdout);
expect(Array.isArray(payload)).toBe(false);
expect(Object.keys(payload).length).toBeGreaterThan(0);
expect(follow.exitCode).toBe(0);
const unfollow = await runBird([...baseArgs, '--cookie-timeout', cookieTimeoutArg, 'unfollow', followHandle], {
timeoutMs: 45_000,
});
expect(unfollow.exitCode).toBe(0);
});
it('read returns tweet JSON', async () => {