Skip to content

Commit 8b4171d

Browse files
temple69romeoscript
authored andcommitted
test: add correct unit tests for getLatestTimelineV2 (#44)
1 parent 034dee3 commit 8b4171d

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/timeline-v2.unit.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ describe('TimelineV2 official', () => {
3333
);
3434
});
3535

36+
test('getLatestTimelineV2 should call v2 homeTimeline with correct params', async () => {
37+
mockV2Client.v2.homeTimeline.mockResolvedValue({ data: [] });
38+
39+
await getLatestTimelineV2(20, mockAuth);
40+
41+
expect(mockV2Client.v2.homeTimeline).toHaveBeenCalledWith(
42+
expect.objectContaining({
43+
max_results: 20,
44+
'tweet.fields': expect.arrayContaining([
45+
'referenced_tweets',
46+
'created_at',
47+
]),
48+
}),
49+
);
50+
});
51+
3652
test('should throw error if v2 client is not initialized', async () => {
3753
mockAuth.getV2Client.mockReturnValue(null);
3854

0 commit comments

Comments
 (0)