added add_cache function.

This commit is contained in:
Jeff Baskin 2022-12-03 09:15:58 -05:00
parent 4e4344624e
commit 8f704844c3

View File

@ -5,6 +5,10 @@ use error::DBError;
const DATA: &str = "data"; const DATA: &str = "data";
enum CacheEntry {
Raw(String),
}
#[derive(Clone)] #[derive(Clone)]
pub struct MoreThanText; pub struct MoreThanText;
@ -23,6 +27,10 @@ impl MoreThanText {
} }
Ok(Self {}) Ok(Self {})
} }
async fn add_entry(&self, _entry: CacheEntry) -> String {
"fred".to_string()
}
} }
#[cfg(test)] #[cfg(test)]
@ -64,3 +72,19 @@ mod init {
}; };
} }
} }
#[cfg(test)]
mod cache {
use super::*;
use tempfile::tempdir;
#[async_std::test]
async fn add_entry() {
let dir = tempdir().unwrap();
let db = MoreThanText::new(dir.path().to_str().unwrap()).await.unwrap();
let data = CacheEntry::Raw("something".to_string());
db.add_entry(data).await;
drop(db);
dir.close().unwrap();
}
}