diff --git a/api_tests/src/community.spec.ts b/api_tests/src/community.spec.ts index d75b711fc..3583308f0 100644 --- a/api_tests/src/community.spec.ts +++ b/api_tests/src/community.spec.ts @@ -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); @@ -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); +}); diff --git a/api_tests/src/user.spec.ts b/api_tests/src/user.spec.ts index 0cc747d2b..5425b97f7 100644 --- a/api_tests/src/user.spec.ts +++ b/api_tests/src/user.spec.ts @@ -22,6 +22,7 @@ import { alphaImage, unfollows, saveUserSettingsBio, + getPersonDetails, } from "./shared"; import { EditSite, @@ -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(); @@ -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 () => {