1 jest.setTimeout(120000);
15 } from 'lemmy-js-client';
17 let apShortname: string;
19 function assertUserFederation(userOne: PersonViewSafe, userTwo: PersonViewSafe) {
20 expect(userOne.person.name).toBe(userTwo.person.name);
21 expect(userOne.person.display_name).toBe(userTwo.person.display_name);
22 expect(userOne.person.bio).toBe(userTwo.person.bio);
23 expect(userOne.person.actor_id).toBe(userTwo.person.actor_id);
24 expect(userOne.person.avatar).toBe(userTwo.person.avatar);
25 expect(userOne.person.banner).toBe(userTwo.person.banner);
26 expect(userOne.person.published).toBe(userTwo.person.published);
29 test('Create user', async () => {
30 let userRes = await registerUser(alpha);
31 expect(userRes.jwt).toBeDefined();
32 alpha.auth = userRes.jwt;
34 let site = await getSite(alpha);
35 expect(site.my_user).toBeDefined();
36 apShortname = `@${site.my_user.local_user_view.person.name}@lemmy-alpha:8541`;
39 test('Set some user settings, check that they are federated', async () => {
40 let avatar = 'https://image.flaticon.com/icons/png/512/35/35896.png';
41 let banner = 'https://image.flaticon.com/icons/png/512/36/35896.png';
42 let bio = 'a changed bio';
43 let form: SaveUserSettings = {
46 default_sort_type: Object.keys(SortType).indexOf(SortType.Hot),
47 default_listing_type: Object.keys(ListingType).indexOf(ListingType.All),
51 display_name: 'user321',
53 send_notifications_to_email: false,
57 await saveUserSettings(alpha, form);
59 let searchAlpha = await searchForUser(alpha, apShortname);
60 let userOnAlpha = searchAlpha.users[0];
61 let searchBeta = await searchForUser(beta, apShortname);
62 let userOnBeta = searchBeta.users[0];
63 assertUserFederation(userOnAlpha, userOnBeta);