mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-08-07 01:33:52 +00:00
style: format cache tests and fix clippy import
This commit is contained in:
parent
299d315a16
commit
e20b41642f
2 changed files with 7 additions and 3 deletions
|
|
@ -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() {
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue