fix: adapt upstream commands to relay client
CI / test (push) Failing after 5m19s
Publish npm package / publish (push) Successful in 9m52s

This commit is contained in:
2026-06-24 18:51:33 +09:00
parent 55fd5c3d81
commit eedf9b1644
8 changed files with 17 additions and 104 deletions
+2 -4
View File
@@ -6,10 +6,8 @@ import { TwitterClient } from '../src/lib/twitter-client.js';
const baseCtx = {
resolveTimeoutFromOptions: () => undefined,
resolveCredentialsFromOptions: async () => ({
cookies: { authToken: 'auth', ct0: 'ct0', cookieHeader: 'auth=auth; ct0=ct0' },
warnings: [],
}),
resolveRelayBaseUrlFromOptions: () => 'http://relay.test',
resolveProfileNameFromOptions: () => undefined,
p: () => '',
} as unknown as CliContext;
+2 -4
View File
@@ -6,10 +6,8 @@ import { TwitterClient } from '../src/lib/twitter-client.js';
const baseCtx = {
resolveTimeoutFromOptions: () => undefined,
resolveCredentialsFromOptions: async () => ({
cookies: { authToken: 'auth', ct0: 'ct0', cookieHeader: 'auth=auth; ct0=ct0' },
warnings: [],
}),
resolveRelayBaseUrlFromOptions: () => 'http://relay.test',
resolveProfileNameFromOptions: () => undefined,
p: () => '',
l: () => '',
printTweets: () => undefined,
-2
View File
@@ -2,8 +2,6 @@ import { spawn } from 'node:child_process';
import { existsSync } from 'node:fs';
import path from 'node:path';
import { beforeAll, describe, expect, it } from 'vitest';
import { resolveCredentials } from '../../src/lib/cookies.js';
import { TwitterClient } from '../../src/lib/twitter-client.js';
type RunResult = { exitCode: number; stdout: string; stderr: string; signal: NodeJS.Signals | null };
-2
View File
@@ -2,8 +2,6 @@ import { spawn } from 'node:child_process';
import { existsSync } from 'node:fs';
import path from 'node:path';
import { beforeAll, describe, expect, it } from 'vitest';
import { resolveCredentials } from '../../src/lib/cookies.js';
import { TwitterClient } from '../../src/lib/twitter-client.js';
type RunResult = { exitCode: number; stdout: string; stderr: string; signal: NodeJS.Signals | null };
+3 -2
View File
@@ -202,18 +202,19 @@ describe('TwitterClient getUserAboutAccount', () => {
}),
});
const client = new TwitterClient({ cookies: validCookies });
const client = new TwitterClient({ relayBaseUrl: 'http://relay.test', profileName: 'test-profile' });
await client.getUserAboutAccount('testuser');
expect(mockFetch).toHaveBeenCalledTimes(1);
const [url, options] = mockFetch.mock.calls[0] as [string, RequestInit];
expect(url).toContain('http://relay.test/i/api/graphql/');
expect(url).toContain('/AboutAccountQuery?');
expect(url).toContain('variables=');
expect(url).toContain('testuser');
expect(options.method).toBe('GET');
expect(options.headers).toMatchObject({
'x-csrf-token': 'test_ct0_token',
'x-profile-name': 'test-profile',
});
});
});