Skip to content

Commit

Permalink
Merge pull request #204 from LemmyNet/main
Browse files Browse the repository at this point in the history
[pull] master from LemmyNet:main
  • Loading branch information
pull[bot] authored Dec 3, 2024
2 parents 2f881f3 + f065215 commit 70de175
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
28 changes: 27 additions & 1 deletion api_tests/src/community.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
userBlockInstance,
} from "./shared";
import { AdminAllowInstanceParams } from "lemmy-js-client/dist/types/AdminAllowInstanceParams";
import { EditCommunity, EditSite } from "lemmy-js-client";
import { EditCommunity, EditSite, GetPosts } from "lemmy-js-client";

beforeAll(setupLogins);
afterAll(unfollows);
Expand Down Expand Up @@ -576,3 +576,29 @@ test("Remote mods can edit communities", async () => {
"Example description",
);
});

test("Community name with non-ascii chars", async () => {
const name = "това_ме_ядосва" + Math.random().toString().slice(2, 6);
let communityRes = await createCommunity(alpha, name);

let betaCommunity1 = await resolveCommunity(
beta,
communityRes.community_view.community.actor_id,
);
expect(betaCommunity1.community!.community.name).toBe(name);

let alphaCommunity2 = await getCommunityByName(alpha, name);
expect(alphaCommunity2.community_view.community.name).toBe(name);

let fediName = `${communityRes.community_view.community.name}@LEMMY-ALPHA:8541`;
let betaCommunity2 = await getCommunityByName(beta, fediName);
expect(betaCommunity2.community_view.community.name).toBe(name);

let postRes = await createPost(beta, betaCommunity1.community!.community.id);

let form: GetPosts = {
community_name: fediName,
};
let posts = await beta.getPosts(form);
expect(posts.posts[0].post.name).toBe(postRes.post_view.post.name);
});
16 changes: 9 additions & 7 deletions api_tests/src/user.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
alphaImage,
unfollows,
saveUserSettingsBio,
getPersonDetails,
} from "./shared";
import {
EditSite,
Expand Down Expand Up @@ -136,11 +137,9 @@ test("Requests with invalid auth should be treated as unauthenticated", async ()
});

test("Create user with Arabic name", async () => {
let user = await registerUser(
alpha,
alphaUrl,
"تجريب" + Math.random().toString().slice(2, 10), // less than actor_name_max_length
);
// less than actor_name_max_length
const name = "تجريب" + Math.random().toString().slice(2, 10);
let user = await registerUser(alpha, alphaUrl, name);

let site = await getSite(user);
expect(site.my_user).toBeDefined();
Expand All @@ -149,8 +148,11 @@ test("Create user with Arabic name", async () => {
}
apShortname = `${site.my_user.local_user_view.person.name}@lemmy-alpha:8541`;

let alphaPerson = (await resolvePerson(alpha, apShortname)).person;
expect(alphaPerson).toBeDefined();
let betaPerson1 = (await resolvePerson(beta, apShortname)).person;
expect(betaPerson1!.person.name).toBe(name);

let betaPerson2 = await getPersonDetails(beta, betaPerson1!.person.id);
expect(betaPerson2!.person_view.person.name).toBe(name);
});

test("Create user with accept-language", async () => {
Expand Down

0 comments on commit 70de175

Please sign in to comment.