Skip to content

Commit

Permalink
feat(#9): init, clean
Browse files Browse the repository at this point in the history
  • Loading branch information
h1alexbel committed Jun 5, 2024
1 parent f7f8828 commit 7de02f0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/xml/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use std::fs::File;

use log::info;

pub fn xml() {
pub fn init() {
let path = "fakehub.xml";
info!("Initializing XML storage: {path}");
File::create(path).unwrap();
Expand All @@ -32,15 +32,21 @@ pub fn xml() {

#[cfg(test)]
mod tests {
use std::fs;
use std::path::Path;

use crate::xml::storage::init;

use crate::xml::storage::xml;
fn clean() {
fs::remove_file("fakehub.xml").unwrap();
}

#[test]
fn creates_xml_storage() {
xml();
init();
let storage = "fakehub.xml";
let exists = Path::new(storage).exists();
assert!(exists, "storage file {storage} was not created, but should")
assert!(exists, "storage file {storage} was not created, but should");
clean();
}
}

0 comments on commit 7de02f0

Please sign in to comment.