Skip to content

Commit

Permalink
Assert routes creation
Browse files Browse the repository at this point in the history
  • Loading branch information
muhamadazmy committed Sep 20, 2023
1 parent 00b2e3b commit 86ed118
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ mod test {

let writer = meta::Writer::new(root.join("meta.fl")).await.unwrap();

// while we at it we can already create 2 stores and create a router store on top
// of that.
let store0 = DirStore::new(root.join("store0")).await.unwrap();
let store1 = DirStore::new(root.join("store1")).await.unwrap();
let mut store = Router::new();
Expand All @@ -283,11 +285,27 @@ mod test {
let cache = Cache::new(root.join("cache"), store);

let reader = meta::Reader::new(root.join("meta.fl")).await.unwrap();
// validate reader store routing
let routers = reader.routes().await.unwrap();
assert_eq!(2, routers.len());
assert_eq!(routers[0].url, "dir:///tmp/pack-unpack-test/store0");
assert_eq!(routers[1].url, "dir:///tmp/pack-unpack-test/store1");

assert_eq!((routers[0].start, routers[0].end), (0x00, 0x7f));
assert_eq!((routers[1].start, routers[1].end), (0x80, 0xff));

unpack(&reader, &cache, root.join("destination"))
.await
.unwrap();

//TODO compare source and destination
// compare that source directory is exactly the same as target directory
let status = std::process::Command::new("diff")
.arg(root.join("source"))
.arg(root.join("destination"))
.status()
.unwrap();

assert!(status.success());
}

struct WalkTest;
Expand Down

0 comments on commit 86ed118

Please sign in to comment.