forked from elizaOS/agent-twitter-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelationships.test.ts
59 lines (43 loc) · 1.25 KB
/
relationships.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { getScraper } from './test-utils';
test('scraper can get profile followers', async () => {
const scraper = await getScraper();
const seenProfiles = new Map<string, boolean>();
const maxProfiles = 50;
let nProfiles = 0;
const profiles = await scraper.getFollowers(
'1425600122885394432',
maxProfiles,
);
for await (const profile of profiles) {
nProfiles++;
const id = profile.userId;
expect(id).toBeTruthy();
if (id != null) {
expect(seenProfiles.has(id)).toBeFalsy();
seenProfiles.set(id, true);
}
expect(profile.username).toBeTruthy();
}
expect(nProfiles).toEqual(maxProfiles);
});
test('scraper can get profile following', async () => {
const scraper = await getScraper();
const seenProfiles = new Map<string, boolean>();
const maxProfiles = 50;
let nProfiles = 0;
const profiles = await scraper.getFollowing(
'1425600122885394432',
maxProfiles,
);
for await (const profile of profiles) {
nProfiles++;
const id = profile.userId;
expect(id).toBeTruthy();
if (id != null) {
expect(seenProfiles.has(id)).toBeFalsy();
seenProfiles.set(id, true);
}
expect(profile.username).toBeTruthy();
}
expect(nProfiles).toEqual(maxProfiles);
});