From 3464fbb2e893cb2d7a48b57303b0300def09c886 Mon Sep 17 00:00:00 2001 From: Wyatt Verchere Date: Tue, 9 Jan 2024 12:42:17 -0800 Subject: [PATCH] fixes capitalization issue; modifies existing test to check for it (#841) --- src/search/indexing/mod.rs | 2 +- tests/common/dummy_data.rs | 2 +- tests/files/dummy_data.sql | 10 +++++----- tests/v2/search.rs | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/search/indexing/mod.rs b/src/search/indexing/mod.rs index bf6a801d3..ec4f9f107 100644 --- a/src/search/indexing/mod.rs +++ b/src/search/indexing/mod.rs @@ -97,7 +97,7 @@ pub async fn index_projects( let id_chunk = id_chunk .into_iter() .map(|(version_id, project_id, owner_username)| { - (version_id, (project_id, owner_username.to_lowercase())) + (version_id, (project_id, owner_username)) }) .collect::>(); let uploads = index_local(&pool, &redis, id_chunk).await?; diff --git a/tests/common/dummy_data.rs b/tests/common/dummy_data.rs index 585405b90..6b3843b2b 100644 --- a/tests/common/dummy_data.rs +++ b/tests/common/dummy_data.rs @@ -27,7 +27,7 @@ use super::{ use super::{database::USER_USER_ID, get_json_val_str}; -pub const DUMMY_DATA_UPDATE: i64 = 6; +pub const DUMMY_DATA_UPDATE: i64 = 7; #[allow(dead_code)] pub const DUMMY_CATEGORIES: &[&str] = &[ diff --git a/tests/files/dummy_data.sql b/tests/files/dummy_data.sql index d322eb38d..457353d3b 100644 --- a/tests/files/dummy_data.sql +++ b/tests/files/dummy_data.sql @@ -4,11 +4,11 @@ -- Inserts 5 dummy users for testing, with slight differences -- 'Friend' and 'enemy' function like 'user', but we can use them to simulate 'other' users that may or may not be able to access certain things -- IDs 1-5, 1-5 -INSERT INTO users (id, username, name, email, role) VALUES (1, 'admin', 'Administrator Test', 'admin@modrinth.com', 'admin'); -INSERT INTO users (id, username, name, email, role) VALUES (2, 'moderator', 'Moderator Test', 'moderator@modrinth.com', 'moderator'); -INSERT INTO users (id, username, name, email, role) VALUES (3, 'user', 'User Test', 'user@modrinth.com', 'developer'); -INSERT INTO users (id, username, name, email, role) VALUES (4, 'friend', 'Friend Test', 'friend@modrinth.com', 'developer'); -INSERT INTO users (id, username, name, email, role) VALUES (5, 'enemy', 'Enemy Test', 'enemy@modrinth.com', 'developer'); +INSERT INTO users (id, username, name, email, role) VALUES (1, 'Admin', 'Administrator Test', 'admin@modrinth.com', 'admin'); +INSERT INTO users (id, username, name, email, role) VALUES (2, 'Moderator', 'Moderator Test', 'moderator@modrinth.com', 'moderator'); +INSERT INTO users (id, username, name, email, role) VALUES (3, 'User', 'User Test', 'user@modrinth.com', 'developer'); +INSERT INTO users (id, username, name, email, role) VALUES (4, 'Friend', 'Friend Test', 'friend@modrinth.com', 'developer'); +INSERT INTO users (id, username, name, email, role) VALUES (5, 'Enemy', 'Enemy Test', 'enemy@modrinth.com', 'developer'); -- Full PATs for each user, with different scopes -- These are not legal PATs, as they contain all scopes- they mimic permissions of a logged in user diff --git a/tests/v2/search.rs b/tests/v2/search.rs index 61b36aef5..c4d4066f4 100644 --- a/tests/v2/search.rs +++ b/tests/v2/search.rs @@ -391,6 +391,7 @@ async fn search_projects() { .await; for hit in game_versions.hits { assert_eq!(hit.versions, vec!["1.20.5".to_string()]); + assert_eq!(hit.author, "User".to_string()); } }) .await;