mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-22 19:01:32 +00:00
* Add test cases for community with non-ascii name (ref #5239) * fmt * Update run-federation-test.sh
This commit is contained in:
parent
dcf1cfca9b
commit
f065215e74
2 changed files with 36 additions and 8 deletions
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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 () => {
|
||||
|
|
Loading…
Reference in a new issue