Skip to content

Commit

Permalink
Verify logics for converting files to webp image
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallku committed Sep 4, 2024
1 parent a621032 commit ce8e4e0
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/controllers/__tests__/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,25 @@ mod tests {
assert_eq!(response.status(), StatusCode::NOT_FOUND);
assert!(!local_file_path.exists());
}

#[tokio::test]
async fn test_response_webp_file() {
let app = app();
let state = AppState::from_env();
let file_path = "/images/hpp/ic_wahlberg_product_core_48.png8.png.webp";
let response = app
.with_state(state)
.oneshot(
Request::builder()
.uri(format!("{}{}", URI, file_path))
.body(Body::empty())
.unwrap(),
)
.await
.unwrap();
let local_file_path = PathBuf::from(format!("{}{}{}", CDN_ROOT, URI, file_path));

assert_eq!(response.status(), StatusCode::OK);
assert!(local_file_path.exists());
}
}

0 comments on commit ce8e4e0

Please sign in to comment.