Skip to content

Commit b184228

Browse files
committed
add guest test
Signed-off-by: ふぁ <yuki@yuki0311.com>
1 parent 1f599eb commit b184228

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { getGuestClient, logger } from '@test/init';
2+
import { printTweet } from '@test/util';
3+
4+
test('getGuestTweetResultByRestId', async () => {
5+
logger.log('getGuestTweetResultByRestId');
6+
const client = await getGuestClient();
7+
const response = await client.getDefaultApi().getTweetResultByRestId({ tweetId: '1349129669258448897' });
8+
printTweet(response.data!);
9+
expect(response.raw.response.ok).toBe(true);
10+
});

twitter-openapi-typescript/test/init.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ export const getClient = async () => {
3232
ct0: CsrfToken,
3333
auth_token: authToken,
3434
});
35-
// const client = await api.getClient();
35+
return client;
36+
};
37+
export const getGuestClient = async () => {
38+
const api = new TwitterOpenApi({ fetchApi: fetch as any });
39+
const client = await api.getGuestClient();
3640
return client;
3741
};

0 commit comments

Comments
 (0)