Skip to content

Commit

Permalink
fixing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
diyahir committed Sep 5, 2024
1 parent a647ae5 commit 941c0ae
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions test-utils/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,24 +708,19 @@ pub mod common {
}

pub fn get_absolute_path_from_relative(relative_path: &str) -> String {
let mut path = env::current_dir().unwrap();
// println!("Current directory: {:?}", path);
let fluid_protocol_index = path
.to_str()
.unwrap()
.find("fluid-protocol/")
.unwrap_or_else(|| path.to_str().unwrap().len());

path.push("fluid-protocol/");
// length of fluid procol
let len = "fluid-protocol/".len();
let current_dir = env::current_dir().unwrap();

let mut result =
path.to_str().unwrap().to_string()[..fluid_protocol_index + len].to_string();
let fluid_protocol_path = current_dir
.ancestors()
.find(|p| p.ends_with("fluid-protocol"))
.unwrap_or(&current_dir)
.to_path_buf();

result.push_str(relative_path);

result
fluid_protocol_path
.join(relative_path)
.to_str()
.unwrap()
.to_string()
}

pub async fn add_asset(
Expand Down

0 comments on commit 941c0ae

Please sign in to comment.