diff --git a/src/morethantext/store.rs b/src/morethantext/store.rs index 361e1ca..735f13b 100644 --- a/src/morethantext/store.rs +++ b/src/morethantext/store.rs @@ -32,7 +32,12 @@ impl Store { } pub fn list(&self) -> Vec { - Vec::new() + let mut names = Vec::new(); + for name in self.data.keys() { + names.push(name.to_string()); + } + names.sort(); + names } } @@ -90,4 +95,15 @@ mod storage { None => Ok(()), } } + + #[test] + fn get_list() { + let mut store = Store::new(); + let mut ids = ["one", "two", "three", "four", "five"]; + for name in ids { + store.add(name.to_string()).unwrap(); + } + ids.sort(); + assert_eq!(store.list(), ids); + } }