feat(graphql): runtime query-id refresh

This commit is contained in:
Peter Steinberger
2025-12-26 14:58:03 +01:00
parent 472d666eee
commit 978d07f60f
8 changed files with 628 additions and 109 deletions
+8 -3
View File
@@ -85,6 +85,11 @@ describe('TwitterClient', () => {
it('retries CreateTweet via /i/api/graphql when operation URL 404s', async () => {
mockFetch
.mockResolvedValueOnce({
ok: false,
status: 404,
text: async () => '',
})
.mockResolvedValueOnce({
ok: false,
status: 404,
@@ -111,12 +116,12 @@ describe('TwitterClient', () => {
expect(result.success).toBe(true);
expect(result.tweetId).toBe('1234567890');
expect(mockFetch).toHaveBeenCalledTimes(2);
expect(mockFetch).toHaveBeenCalledTimes(3);
const [firstUrl] = mockFetch.mock.calls[0];
const [secondUrl] = mockFetch.mock.calls[1];
const [thirdUrl] = mockFetch.mock.calls[2];
expect(String(firstUrl)).toContain('/CreateTweet');
expect(String(secondUrl)).toBe('https://x.com/i/api/graphql');
expect(String(thirdUrl)).toBe('https://x.com/i/api/graphql');
});
it('should handle API errors', async () => {