mirror of
https://github.com/modrinth/code.git
synced 2026-08-27 18:14:49 +00:00
Include compatible dependencies field in project search (#6366)
* include compatible dependency projects field * fix
This commit is contained in:
@@ -9,6 +9,7 @@ use common::environment::TestEnvironment;
|
||||
use common::environment::with_test_environment;
|
||||
use common::search::setup_search_projects;
|
||||
use futures::stream::StreamExt;
|
||||
use labrinth::models::projects::DependencyType;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::common::api_common::Api;
|
||||
@@ -95,6 +96,12 @@ async fn search_projects() {
|
||||
)]]),
|
||||
vec![7],
|
||||
),
|
||||
(
|
||||
json!([[format!(
|
||||
"compatible_dependency_project_ids:{dependency_project_id}"
|
||||
)]]),
|
||||
vec![7],
|
||||
),
|
||||
];
|
||||
// TODO: versions, game versions
|
||||
// Untested:
|
||||
@@ -151,11 +158,23 @@ async fn search_projects() {
|
||||
projects.hits[0].dependency_project_ids[0],
|
||||
dependency_project_id
|
||||
);
|
||||
assert_eq!(
|
||||
projects.hits[0].compatible_dependency_project_ids.len(),
|
||||
1
|
||||
);
|
||||
assert_eq!(
|
||||
projects.hits[0].compatible_dependency_project_ids[0],
|
||||
dependency_project_id
|
||||
);
|
||||
assert_eq!(projects.hits[0].dependencies.len(), 1);
|
||||
assert_eq!(
|
||||
projects.hits[0].dependencies[0].project_id,
|
||||
dependency_project_id
|
||||
);
|
||||
assert_eq!(
|
||||
projects.hits[0].dependencies[0].dependency_type,
|
||||
DependencyType::Required
|
||||
);
|
||||
assert!(
|
||||
projects.hits[0].dependencies[0]
|
||||
.slug
|
||||
|
||||
Reference in New Issue
Block a user