You've already forked AstralRinth
forked from didirus/AstralRinth
Cleans up and removes TODOs, adds tests (#844)
* removes version ordering from v2; simplifies now-unecessary three-level faceting * resolved some todos * test for game version updating * merge fixes; display_categories fix
This commit is contained in:
@@ -90,7 +90,7 @@ async fn test_project_type_sanity() {
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: as we get more complicated strucures with v3 testing, and alpha/beta get more complicated, we should add more tests here,
|
||||
// As we get more complicated strucures with as v3 continues to expand, and alpha/beta get more complicated, we should add more tests here,
|
||||
// to ensure that projects created with v3 routes are still valid and work with v3 routes.
|
||||
})
|
||||
.await;
|
||||
@@ -397,7 +397,6 @@ async fn permissions_patch_project_v2() {
|
||||
with_test_environment(Some(8), |test_env: TestEnvironment<ApiV2>| async move {
|
||||
let api = &test_env.api;
|
||||
|
||||
// TODO: This only includes v2 ones (as it should. See v3)
|
||||
// For each permission covered by EDIT_DETAILS, ensure the permission is required
|
||||
let edit_details = ProjectPermissions::EDIT_DETAILS;
|
||||
let test_pairs = [
|
||||
|
||||
@@ -50,3 +50,32 @@ pub async fn project_version_create_scopes() {
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
pub async fn project_version_reads_scopes() {
|
||||
with_test_environment(None, |_test_env: TestEnvironment<ApiV2>| async move {
|
||||
// let api = &test_env.api;
|
||||
// let beta_file_hash = &test_env.dummy.project_beta.file_hash;
|
||||
|
||||
// let read_version = Scopes::VERSION_READ;
|
||||
|
||||
// Update individual version file
|
||||
// TODO: This scope currently fails still as the 'version' field of QueryProject only allows public versions.
|
||||
// TODO: This will be fixed when the 'extracts_versions' PR is merged.
|
||||
// let req_gen = |pat : Option<String>| async move {
|
||||
// api.update_individual_files("sha1", vec![
|
||||
// FileUpdateData {
|
||||
// hash: beta_file_hash.clone(),
|
||||
// loaders: None,
|
||||
// game_versions: None,
|
||||
// version_types: None
|
||||
// }
|
||||
// ], pat.as_deref())
|
||||
// .await
|
||||
// };
|
||||
// let (failure, success) = ScopeTest::new(&test_env).with_failure_code(200).test(req_gen, read_version).await.unwrap();
|
||||
// assert!(!failure.as_object().unwrap().contains_key(beta_file_hash));
|
||||
// assert!(success.as_object().unwrap().contains_key(beta_file_hash));
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -18,9 +18,6 @@ use std::sync::Arc;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn search_projects() {
|
||||
// TODO: ("Match changes in the 2 version of thee add_public_version_creation_data to those made in v3
|
||||
// It should drastically simplify this function
|
||||
|
||||
// Test setup and dummy data
|
||||
with_test_environment(Some(10), |test_env: TestEnvironment<ApiV2>| async move {
|
||||
let api = &test_env.api;
|
||||
@@ -399,6 +396,8 @@ async fn search_projects() {
|
||||
);
|
||||
assert!(hit.categories.contains(&"forge".to_string()));
|
||||
assert!(hit.categories.contains(&"fabric".to_string()));
|
||||
assert!(hit.display_categories.contains(&"forge".to_string()));
|
||||
assert!(hit.display_categories.contains(&"fabric".to_string()));
|
||||
|
||||
// Also, ensure author is correctly capitalized
|
||||
assert_eq!(hit.author, "User".to_string());
|
||||
|
||||
Reference in New Issue
Block a user