Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Frando committed Aug 29, 2024
1 parent 03b8a3e commit e5994b5
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions iroh/tests/spaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,37 +177,46 @@ async fn spaces_subscription() -> Result<()> {
.resume_subscription(0, Area::new_full(), Default::default())
.await?;

alfie_space
.insert_bytes(
EntryForm::new(alfie_user, Path::from_bytes(&[b"foo"])?),
"hi",
)
.await?;

betty_space
.insert_bytes(
EntryForm::new(betty_user, Path::from_bytes(&[b"foo"])?),
"hi",
)
.await?;

let ev = betty_sub.next().await.unwrap().unwrap();
println!("BETTY 1 {ev:?}");
assert!(matches!(ev, StoreEvent::Ingested(0, _, EntryOrigin::Local)));

let ev = alfie_sub.next().await.unwrap().unwrap();
println!("ALFIE 1 {ev:?}");
assert!(matches!(
ev,
StoreEvent::Ingested(0, _, EntryOrigin::Remote(_))
));

alfie_space
.insert_bytes(
EntryForm::new(alfie_user, Path::from_bytes(&[b"foo"])?),
EntryForm::new(alfie_user, Path::from_bytes(&[b"bar"])?),
"hi!!",
)
.await?;

let ev = alfie_sub.next().await.unwrap();
println!("ALFIE 2");
assert!(matches!(ev, StoreEvent::Ingested(0, _, EntryOrigin::Local)));
let ev = alfie_sub.next().await.unwrap().unwrap();
println!("ALFIE 2 {ev:?}");
assert!(matches!(ev, StoreEvent::Ingested(1, _, EntryOrigin::Local)));

let ev = betty_sub.next().await.unwrap();
println!("BETTY 2");
let ev = betty_sub.next().await.unwrap().unwrap();
println!("BETTY 2 {ev:?}");
assert!(matches!(
ev,
StoreEvent::Ingested(0, _, EntryOrigin::Remote(_))
StoreEvent::Ingested(1, _, EntryOrigin::Remote(_))
));

let resume_sub = alfie_space
.resume_subscription(0, Area::new_full(), Default::default())
.await?;
assert_eq!(resume_sub.count().await, 2);

Ok(())
}

0 comments on commit e5994b5

Please sign in to comment.