This commit is contained in:
Felix Ableitner 2024-11-28 12:17:48 +01:00
parent 0583505320
commit 6eaa569d13
5 changed files with 9 additions and 16 deletions

View file

@ -28,7 +28,7 @@
"eslint": "^9.14.0", "eslint": "^9.14.0",
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-prettier": "^5.1.3",
"jest": "^29.5.0", "jest": "^29.5.0",
"lemmy-js-client": "0.20.0-api-v4.5", "lemmy-js-client": "0.20.0-api-v4.6",
"prettier": "^3.2.5", "prettier": "^3.2.5",
"ts-jest": "^29.1.0", "ts-jest": "^29.1.0",
"typescript": "^5.5.4", "typescript": "^5.5.4",

View file

@ -703,9 +703,9 @@ test("Check that activity from another instance is sent to third instance", asyn
test("Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedded comments, A subs to B, B updates the lowest level comment, A fetches both the post and all the inreplyto comments for that post.", async () => { test("Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedded comments, A subs to B, B updates the lowest level comment, A fetches both the post and all the inreplyto comments for that post.", async () => {
// Unfollow all remote communities // Unfollow all remote communities
let my_user = await unfollowRemotes(alpha); let my_user = await unfollowRemotes(alpha);
expect( expect(my_user.follows.filter(c => c.community.local == false).length).toBe(
my_user.follows.filter(c => c.community.local == false).length, 0,
).toBe(0); );
// B creates a post, and two comments, should be invisible to A // B creates a post, and two comments, should be invisible to A
let postOnBetaRes = await createPost(beta, 2); let postOnBetaRes = await createPost(beta, 2);

View file

@ -453,8 +453,7 @@ test("Enforce site ban federation for local user", async () => {
// create a test user // create a test user
let alphaUserHttp = await registerUser(alpha, alphaUrl); let alphaUserHttp = await registerUser(alpha, alphaUrl);
let alphaUserPerson = (await getMyUser(alphaUserHttp)).local_user_view let alphaUserPerson = (await getMyUser(alphaUserHttp)).local_user_view.person;
.person;
let alphaUserActorId = alphaUserPerson?.actor_id; let alphaUserActorId = alphaUserPerson?.actor_id;
if (!alphaUserActorId) { if (!alphaUserActorId) {
throw "Missing alpha user actor id"; throw "Missing alpha user actor id";
@ -534,8 +533,7 @@ test("Enforce site ban federation for federated user", async () => {
// create a test user // create a test user
let alphaUserHttp = await registerUser(alpha, alphaUrl); let alphaUserHttp = await registerUser(alpha, alphaUrl);
let alphaUserPerson = (await getMyUser(alphaUserHttp)).local_user_view let alphaUserPerson = (await getMyUser(alphaUserHttp)).local_user_view.person;
.person;
let alphaUserActorId = alphaUserPerson?.actor_id; let alphaUserActorId = alphaUserPerson?.actor_id;
if (!alphaUserActorId) { if (!alphaUserActorId) {
throw "Missing alpha user actor id"; throw "Missing alpha user actor id";
@ -565,8 +563,7 @@ test("Enforce site ban federation for federated user", async () => {
expect(banAlphaOnBeta.banned).toBe(true); expect(banAlphaOnBeta.banned).toBe(true);
// The beta site ban should NOT be federated to alpha // The beta site ban should NOT be federated to alpha
let alphaPerson2 = (await getMyUser(alphaUserHttp)).local_user_view let alphaPerson2 = (await getMyUser(alphaUserHttp)).local_user_view.person;
.person;
expect(alphaPerson2.banned).toBe(false); expect(alphaPerson2.banned).toBe(false);
// existing alpha post should be removed on beta // existing alpha post should be removed on beta

View file

@ -771,9 +771,7 @@ export async function listPrivateMessages(
return api.getPrivateMessages(form); return api.getPrivateMessages(form);
} }
export async function unfollowRemotes( export async function unfollowRemotes(api: LemmyHttp): Promise<MyUserInfo> {
api: LemmyHttp,
): Promise<MyUserInfo> {
// Unfollow all remote communities // Unfollow all remote communities
let my_user = await getMyUser(api); let my_user = await getMyUser(api);
let remoteFollowed = let remoteFollowed =

View file

@ -153,9 +153,7 @@ test("Create user with accept-language", async () => {
let my_user = await getMyUser(user); let my_user = await getMyUser(user);
expect(my_user).toBeDefined(); expect(my_user).toBeDefined();
expect(my_user?.local_user_view.local_user.interface_language).toBe( expect(my_user?.local_user_view.local_user.interface_language).toBe("fr");
"fr",
);
let site = await getSite(user); let site = await getSite(user);
let langs = site.all_languages let langs = site.all_languages
.filter(a => my_user.discussion_languages.includes(a.id)) .filter(a => my_user.discussion_languages.includes(a.id))