This commit is contained in:
@@ -124,6 +124,41 @@ describe('TwitterClient core coverage', () => {
|
||||
expect(headers).toEqual({});
|
||||
});
|
||||
|
||||
it('adds x-profile-name header when profileName is set', () => {
|
||||
const client = new TwitterClient({ relayBaseUrl: testRelayBaseUrl, profileName: 'work' });
|
||||
const clientPrivate = client as unknown as TwitterClientPrivate;
|
||||
|
||||
expect(clientPrivate.getHeaders()).toEqual({ 'x-profile-name': 'work' });
|
||||
});
|
||||
|
||||
it('ignores blank profileName values', () => {
|
||||
const client = new TwitterClient({ relayBaseUrl: testRelayBaseUrl, profileName: ' ' });
|
||||
const clientPrivate = client as unknown as TwitterClientPrivate;
|
||||
|
||||
expect(clientPrivate.getHeaders()).toEqual({});
|
||||
});
|
||||
|
||||
it('adds x-profile-name to JSON headers when profileName is set', () => {
|
||||
const client = new TwitterClient({ relayBaseUrl: testRelayBaseUrl, profileName: 'work' });
|
||||
const clientPrivate = client as unknown as TwitterClientPrivate & {
|
||||
getJsonHeaders: () => Record<string, string>;
|
||||
};
|
||||
|
||||
expect(clientPrivate.getJsonHeaders()).toEqual({
|
||||
'content-type': 'application/json',
|
||||
'x-profile-name': 'work',
|
||||
});
|
||||
});
|
||||
|
||||
it('adds x-profile-name to upload headers when profileName is set', () => {
|
||||
const client = new TwitterClient({ relayBaseUrl: testRelayBaseUrl, profileName: 'work' });
|
||||
const clientPrivate = client as unknown as TwitterClientPrivate & {
|
||||
getUploadHeaders: () => Record<string, string>;
|
||||
};
|
||||
|
||||
expect(clientPrivate.getUploadHeaders()).toEqual({ 'x-profile-name': 'work' });
|
||||
});
|
||||
|
||||
describe('fetchUserArticlePlainText failures', () => {
|
||||
it('returns empty object when response is not ok', async () => {
|
||||
const mockFetch = vi.fn().mockResolvedValueOnce(makeResponse({ ok: false, status: 500 }));
|
||||
|
||||
Reference in New Issue
Block a user