mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-03 16:51:35 +00:00
Fixing api tests.
This commit is contained in:
parent
a940ce38ef
commit
67d72e36ac
9 changed files with 24 additions and 38 deletions
|
@ -28,7 +28,7 @@
|
|||
"eslint": "^9.14.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"jest": "^29.5.0",
|
||||
"lemmy-js-client": "0.20.0-api-v4.16",
|
||||
"lemmy-js-client": "0.20.0-reports-combined.3",
|
||||
"prettier": "^3.2.5",
|
||||
"ts-jest": "^29.1.0",
|
||||
"typescript": "^5.5.4",
|
||||
|
|
|
@ -30,8 +30,8 @@ importers:
|
|||
specifier: ^29.5.0
|
||||
version: 29.7.0(@types/node@22.9.0)
|
||||
lemmy-js-client:
|
||||
specifier: 0.20.0-api-v4.16
|
||||
version: 0.20.0-api-v4.16
|
||||
specifier: 0.20.0-reports-combined.3
|
||||
version: 0.20.0-reports-combined.3
|
||||
prettier:
|
||||
specifier: ^3.2.5
|
||||
version: 3.3.3
|
||||
|
@ -1167,8 +1167,8 @@ packages:
|
|||
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
lemmy-js-client@0.20.0-api-v4.16:
|
||||
resolution: {integrity: sha512-9Wn7b8YT2KnEA286+RV1B3mLmecAynvAERoC0ZZiccfSgkEvd3rG9A5X9ejiPqp+JzDZJeisO57+Ut4QHr5oTw==}
|
||||
lemmy-js-client@0.20.0-reports-combined.3:
|
||||
resolution: {integrity: sha512-0Z/9S41r6NM8f09Gkxerq9zYBE6UcywXfeWNxsYknkyh0ZnKbtNxjTkSxE6JpRbz7wokKFRSH9NpwgNloQY5uw==}
|
||||
|
||||
leven@3.1.0:
|
||||
resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==}
|
||||
|
@ -3077,7 +3077,7 @@ snapshots:
|
|||
|
||||
kleur@3.0.3: {}
|
||||
|
||||
lemmy-js-client@0.20.0-api-v4.16: {}
|
||||
lemmy-js-client@0.20.0-reports-combined.3: {}
|
||||
|
||||
leven@3.1.0: {}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import {
|
|||
followCommunity,
|
||||
banPersonFromCommunity,
|
||||
resolvePerson,
|
||||
getSite,
|
||||
createPost,
|
||||
getPost,
|
||||
resolvePost,
|
||||
|
@ -36,7 +35,7 @@ import {
|
|||
userBlockInstance,
|
||||
} from "./shared";
|
||||
import { AdminAllowInstanceParams } from "lemmy-js-client/dist/types/AdminAllowInstanceParams";
|
||||
import { EditCommunity, EditSite, GetPosts } from "lemmy-js-client";
|
||||
import { EditCommunity, GetPosts } from "lemmy-js-client";
|
||||
|
||||
beforeAll(setupLogins);
|
||||
afterAll(unfollows);
|
||||
|
@ -573,7 +572,7 @@ test("Remote mods can edit communities", async () => {
|
|||
communityRes.community_view.community.id,
|
||||
);
|
||||
|
||||
await expect(alphaCommunity.community_view.community.description).toBe(
|
||||
expect(alphaCommunity.community_view.community.description).toBe(
|
||||
"Example description",
|
||||
);
|
||||
});
|
||||
|
|
|
@ -5,7 +5,6 @@ import {
|
|||
setupLogins,
|
||||
resolveBetaCommunity,
|
||||
followCommunity,
|
||||
getSite,
|
||||
waitUntil,
|
||||
beta,
|
||||
betaUrl,
|
||||
|
|
|
@ -18,7 +18,6 @@ import {
|
|||
epsilon,
|
||||
followCommunity,
|
||||
gamma,
|
||||
getSite,
|
||||
imageFetchLimit,
|
||||
registerUser,
|
||||
resolveBetaCommunity,
|
||||
|
|
|
@ -29,7 +29,6 @@ import {
|
|||
reportPost,
|
||||
randomString,
|
||||
registerUser,
|
||||
getSite,
|
||||
unfollows,
|
||||
resolveCommunity,
|
||||
waitUntil,
|
||||
|
|
|
@ -207,7 +207,9 @@ async function allowInstance(api: LemmyHttp, instance: string) {
|
|||
// Ignore errors from duplicate allows (because setup gets called for each test file)
|
||||
try {
|
||||
await api.adminAllowInstance(params);
|
||||
} catch {}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function createPost(
|
||||
|
|
|
@ -58,7 +58,6 @@ use lemmy_api::{
|
|||
comment_report::{create::create_comment_report, resolve::resolve_comment_report},
|
||||
post_report::{create::create_post_report, resolve::resolve_post_report},
|
||||
private_message_report::{create::create_pm_report, resolve::resolve_pm_report},
|
||||
report_combined::list::list_reports,
|
||||
},
|
||||
site::{
|
||||
federated_instances::get_federated_instances,
|
||||
|
@ -239,11 +238,6 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) {
|
|||
.route("/report", post().to(create_comment_report))
|
||||
.route("/report/resolve", put().to(resolve_comment_report)),
|
||||
)
|
||||
.service(
|
||||
scope("report")
|
||||
.wrap(rate_limit.message())
|
||||
.route("/list", get().to(list_reports)),
|
||||
)
|
||||
// Private Message
|
||||
.service(
|
||||
scope("/private_message")
|
||||
|
|
|
@ -6,11 +6,6 @@ use lemmy_api::{
|
|||
list_comment_likes::list_comment_likes,
|
||||
save::save_comment,
|
||||
},
|
||||
comment_report::{
|
||||
create::create_comment_report,
|
||||
list::list_comment_reports,
|
||||
resolve::resolve_comment_report,
|
||||
},
|
||||
community::{
|
||||
add_mod::add_mod_to_community,
|
||||
ban::ban_from_community,
|
||||
|
@ -65,16 +60,12 @@ use lemmy_api::{
|
|||
mark_read::mark_post_as_read,
|
||||
save::save_post,
|
||||
},
|
||||
post_report::{
|
||||
create::create_post_report,
|
||||
list::list_post_reports,
|
||||
resolve::resolve_post_report,
|
||||
},
|
||||
private_message::mark_read::mark_pm_as_read,
|
||||
private_message_report::{
|
||||
create::create_pm_report,
|
||||
list::list_pm_reports,
|
||||
resolve::resolve_pm_report,
|
||||
reports::{
|
||||
comment_report::{create::create_comment_report, resolve::resolve_comment_report},
|
||||
post_report::{create::create_post_report, resolve::resolve_post_report},
|
||||
private_message_report::{create::create_pm_report, resolve::resolve_pm_report},
|
||||
report_combined::list::list_reports,
|
||||
},
|
||||
site::{
|
||||
admin_allow_instance::admin_allow_instance,
|
||||
|
@ -235,7 +226,6 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) {
|
|||
.route("/save", put().to(save_post))
|
||||
.route("/report", post().to(create_post_report))
|
||||
.route("/report/resolve", put().to(resolve_post_report))
|
||||
.route("/report/list", get().to(list_post_reports))
|
||||
.route("/site_metadata", get().to(get_link_metadata)),
|
||||
)
|
||||
// Comment
|
||||
|
@ -259,8 +249,7 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) {
|
|||
.route("/save", put().to(save_comment))
|
||||
.route("/list", get().to(list_comments))
|
||||
.route("/report", post().to(create_comment_report))
|
||||
.route("/report/resolve", put().to(resolve_comment_report))
|
||||
.route("/report/list", get().to(list_comment_reports)),
|
||||
.route("/report/resolve", put().to(resolve_comment_report)),
|
||||
)
|
||||
// Private Message
|
||||
.service(
|
||||
|
@ -271,8 +260,13 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) {
|
|||
.route("/delete", post().to(delete_private_message))
|
||||
.route("/mark_as_read", post().to(mark_pm_as_read))
|
||||
.route("/report", post().to(create_pm_report))
|
||||
.route("/report/resolve", put().to(resolve_pm_report))
|
||||
.route("/report/list", get().to(list_pm_reports)),
|
||||
.route("/report/resolve", put().to(resolve_pm_report)),
|
||||
)
|
||||
// Reports
|
||||
.service(
|
||||
scope("/report")
|
||||
.wrap(rate_limit.message())
|
||||
.route("/list", get().to(list_reports)),
|
||||
)
|
||||
// User
|
||||
.service(
|
||||
|
|
Loading…
Reference in a new issue