Refactoring

This commit is contained in:
2026-07-13 12:01:33 -04:00
parent 6df5361b2c
commit d5ad2a696d
3 changed files with 8 additions and 248 deletions
+7 -7
View File
@@ -172,8 +172,8 @@ mod tests {
const TEST_NUMBERS_0: &str = "tests/numbers-0.txt";
#[test]
fn test_file_dump() {
#[tokio::test]
async fn test_file_dump() {
let file_exists = {
let path = std::path::Path::new(TEST_NUMBERS_0);
path.exists()
@@ -218,7 +218,7 @@ mod tests {
},
];
match async_std::task::block_on(prsr.file_dump()) {
match prsr.file_dump().await {
Ok(contacts) => {
assert!((contacts.len() > 0), "No contacts has been parsed");
@@ -234,17 +234,17 @@ mod tests {
};
}
#[test]
fn test_save_file() {
#[tokio::test]
async fn test_save_file() {
let prsr = super::NumberParser {
filepath: String::from(TEST_NUMBERS_0),
};
let results = async_std::task::block_on(prsr.file_dump());
let results = prsr.file_dump().await;
assert!(results.is_ok(), "File dump not successful");
let test_output_file: &str = "test-numbers.json";
let contacts = results.unwrap();
async_std::task::block_on(prsr.save_file(contacts, test_output_file));
prsr.save_file(contacts, test_output_file).await;
let file_exists = {
let path = std::path::Path::new(test_output_file);
path.exists()