style: format cache tests and fix clippy import

This commit is contained in:
Rasyidan Akbar F. 2026-03-17 08:52:00 +07:00
commit e20b41642f
2 changed files with 7 additions and 3 deletions

View file

@ -30,7 +30,6 @@ pub(crate) fn parse_fundamentals_from_str(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::{parse_fundamentals_from_str, parse_quote_from_str}; use super::{parse_fundamentals_from_str, parse_quote_from_str};
use crate::api::types::Period;
#[test] #[test]
fn parses_quote_fixture_json() { fn parses_quote_fixture_json() {

View file

@ -275,7 +275,9 @@ mod tests {
assert!(path.exists(), "corrupted file should exist before get()"); assert!(path.exists(), "corrupted file should exist before get()");
// get() should return Ok(None), not an error // get() should return Ok(None), not an error
let result: Option<T> = cache.get("quote", "CORRUPT.JK").expect("get should not error"); let result: Option<T> = cache
.get("quote", "CORRUPT.JK")
.expect("get should not error");
assert_eq!(result, None, "corrupted entry should be treated as miss"); assert_eq!(result, None, "corrupted entry should be treated as miss");
// The corrupted file should be deleted // The corrupted file should be deleted
@ -294,7 +296,10 @@ mod tests {
} }
fs::write(&path, "{ not valid json at all").expect("write corrupted cache"); fs::write(&path, "{ not valid json at all").expect("write corrupted cache");
assert!(path.exists(), "corrupted file should exist before get_stale()"); assert!(
path.exists(),
"corrupted file should exist before get_stale()"
);
// get_stale() should return Ok(None), not an error // get_stale() should return Ok(None), not an error
let result: Option<T> = cache let result: Option<T> = cache