From 42f4fd00de1d67008404af70d28ef876ab9bd255 Mon Sep 17 00:00:00 2001 From: Jack Valinsky Date: Thu, 5 Jun 2025 16:15:26 -0400 Subject: [PATCH] fixes at-microcosm/links#24 updated assertions and make check passes all tests --- constellation/src/storage/mod.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/constellation/src/storage/mod.rs b/constellation/src/storage/mod.rs index 1c75417..332099a 100644 --- a/constellation/src/storage/mod.rs +++ b/constellation/src/storage/mod.rs @@ -150,6 +150,7 @@ mod tests { version: (0, 0), items: vec![], next: None, + total: 0, } ); assert_eq!( @@ -158,6 +159,7 @@ mod tests { version: (0, 0), items: vec![], next: None, + total: 0, } ); assert_eq!(storage.get_all_counts("bad-example.com")?, HashMap::new()); @@ -648,6 +650,7 @@ mod tests { rkey: "asdf".into(), }], next: None, + total: 1, } ); assert_eq!( @@ -656,6 +659,7 @@ mod tests { version: (1, 0), items: vec!["did:plc:asdf".into()], next: None, + total: 1, } ); assert_stats(storage.get_stats()?, 1..=1, 1..=1, 1..=1); @@ -697,6 +701,7 @@ mod tests { }, ], next: Some(3), + total: 5, } ); assert_eq!( @@ -705,6 +710,7 @@ mod tests { version: (5, 0), items: vec!["did:plc:asdf-5".into(), "did:plc:asdf-4".into()], next: Some(3), + total: 5, } ); let links = storage.get_links("a.com", "app.t.c", ".abc.uri", 2, links.next)?; @@ -726,6 +732,7 @@ mod tests { }, ], next: Some(1), + total: 5, } ); assert_eq!( @@ -734,6 +741,7 @@ mod tests { version: (5, 0), items: vec!["did:plc:asdf-3".into(), "did:plc:asdf-2".into()], next: Some(1), + total: 5, } ); let links = storage.get_links("a.com", "app.t.c", ".abc.uri", 2, links.next)?; @@ -748,6 +756,7 @@ mod tests { rkey: "asdf".into(), },], next: None, + total: 5, } ); assert_eq!( @@ -756,6 +765,7 @@ mod tests { version: (5, 0), items: vec!["did:plc:asdf-1".into()], next: None, + total: 5, } ); assert_stats(storage.get_stats()?, 5..=5, 1..=1, 5..=5); @@ -796,6 +806,7 @@ mod tests { }, ], next: Some(2), + total: 4, } ); let links = storage.get_links("a.com", "app.t.c", ".abc.uri", 2, links.next)?; @@ -816,6 +827,7 @@ mod tests { }, ], next: None, + total: 4, } ); assert_stats(storage.get_stats()?, 4..=4, 1..=1, 4..=4); @@ -856,6 +868,7 @@ mod tests { }, ], next: Some(2), + total: 4, } ); storage.push( @@ -890,6 +903,7 @@ mod tests { }, ], next: None, + total: 5, } ); assert_stats(storage.get_stats()?, 5..=5, 1..=1, 5..=5); @@ -930,6 +944,7 @@ mod tests { }, ], next: Some(2), + total: 4, } ); storage.push( @@ -951,6 +966,7 @@ mod tests { rkey: "asdf".into(), },], next: None, + total: 3, } ); assert_stats(storage.get_stats()?, 4..=4, 1..=1, 3..=3); @@ -991,6 +1007,7 @@ mod tests { }, ], next: Some(2), + total: 4, } ); storage.push( @@ -1008,6 +1025,7 @@ mod tests { rkey: "asdf".into(), },], next: None, + total: 4, } ); assert_stats(storage.get_stats()?, 4..=4, 1..=1, 4..=4); -- 2.51.2