mirror of
https://github.com/danbulant/Portfolio
synced 2026-07-07 12:00:43 +00:00
feat: test cache delete functions
This commit is contained in:
parent
b31b557ae0
commit
0465b46650
1 changed files with 57 additions and 0 deletions
|
|
@ -430,6 +430,20 @@ mod tests {
|
||||||
clear_data_store_temp_dir(temp_dir).await;
|
clear_data_store_temp_dir(temp_dir).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
#[serial]
|
||||||
|
async fn test_delete_cover_letter_from_cache() {
|
||||||
|
let (temp_dir, _, application_cache_dir) = create_data_store_temp_dir(APPLICATION_ID).await;
|
||||||
|
|
||||||
|
PortfolioService::add_cover_letter_to_cache(APPLICATION_ID, vec![0]).await.unwrap();
|
||||||
|
|
||||||
|
PortfolioService::delete_cover_letter_from_cache(APPLICATION_ID).await.unwrap();
|
||||||
|
|
||||||
|
assert!(tokio::fs::metadata(application_cache_dir.join("MOTIVACNI_DOPIS.pdf")).await.is_err());
|
||||||
|
|
||||||
|
clear_data_store_temp_dir(temp_dir).await;
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
#[serial]
|
||||||
async fn test_is_cover_letter() {
|
async fn test_is_cover_letter() {
|
||||||
|
|
@ -442,6 +456,21 @@ mod tests {
|
||||||
clear_data_store_temp_dir(temp_dir).await;
|
clear_data_store_temp_dir(temp_dir).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
#[serial]
|
||||||
|
async fn test_delete_cache_item() {
|
||||||
|
let (temp_dir, _, application_cache_dir) = create_data_store_temp_dir(APPLICATION_ID).await;
|
||||||
|
|
||||||
|
PortfolioService::add_cover_letter_to_cache(APPLICATION_ID, vec![0]).await.unwrap();
|
||||||
|
|
||||||
|
PortfolioService::delete_cache_item(APPLICATION_ID, FileType::CoverLetterPdf).await.unwrap();
|
||||||
|
|
||||||
|
assert!(tokio::fs::metadata(application_cache_dir.join("MOTIVACNI_DOPIS.pdf")).await.is_err());
|
||||||
|
|
||||||
|
clear_data_store_temp_dir(temp_dir).await;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
#[serial]
|
||||||
async fn test_add_portfolio_letter_to_cache() {
|
async fn test_add_portfolio_letter_to_cache() {
|
||||||
|
|
@ -454,6 +483,20 @@ mod tests {
|
||||||
clear_data_store_temp_dir(temp_dir).await;
|
clear_data_store_temp_dir(temp_dir).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
#[serial]
|
||||||
|
async fn test_delete_portfolio_letter_from_cache() {
|
||||||
|
let (temp_dir, _, application_cache_dir) = create_data_store_temp_dir(APPLICATION_ID).await;
|
||||||
|
|
||||||
|
PortfolioService::add_portfolio_letter_to_cache(APPLICATION_ID, vec![0]).await.unwrap();
|
||||||
|
|
||||||
|
PortfolioService::delete_portfolio_letter_from_cache(APPLICATION_ID).await.unwrap();
|
||||||
|
|
||||||
|
assert!(tokio::fs::metadata(application_cache_dir.join("PORTFOLIO.pdf")).await.is_err());
|
||||||
|
|
||||||
|
clear_data_store_temp_dir(temp_dir).await;
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
#[serial]
|
||||||
async fn test_is_portfolio_letter() {
|
async fn test_is_portfolio_letter() {
|
||||||
|
|
@ -478,6 +521,20 @@ mod tests {
|
||||||
clear_data_store_temp_dir(temp_dir).await;
|
clear_data_store_temp_dir(temp_dir).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
#[serial]
|
||||||
|
async fn test_delete_portfolio_zip_from_cache() {
|
||||||
|
let (temp_dir, _, application_cache_dir) = create_data_store_temp_dir(APPLICATION_ID).await;
|
||||||
|
|
||||||
|
PortfolioService::add_portfolio_zip_to_cache(APPLICATION_ID, vec![0]).await.unwrap();
|
||||||
|
|
||||||
|
PortfolioService::delete_portfolio_zip_from_cache(APPLICATION_ID).await.unwrap();
|
||||||
|
|
||||||
|
assert!(tokio::fs::metadata(application_cache_dir.join("PORTFOLIO.zip")).await.is_err());
|
||||||
|
|
||||||
|
clear_data_store_temp_dir(temp_dir).await;
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
#[serial]
|
||||||
async fn test_is_portfolio_zip() {
|
async fn test_is_portfolio_zip() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue