diff options
Diffstat (limited to 'src/boot/handlers')
| -rw-r--r-- | src/boot/handlers/boot/test.rs | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/src/boot/handlers/boot/test.rs b/src/boot/handlers/boot/test.rs index 1e590a7..c7c511a 100644 --- a/src/boot/handlers/boot/test.rs +++ b/src/boot/handlers/boot/test.rs @@ -37,9 +37,9 @@ async fn includes_users() { } #[tokio::test] -async fn includes_channels() { +async fn includes_conversations() { let app = fixtures::scratch_app().await; - let channel = fixtures::channel::create(&app, &fixtures::now()).await; + let conversation = fixtures::conversation::create(&app, &fixtures::now()).await; let viewer = fixtures::identity::fictitious(); let response = super::handler(State(app), viewer) @@ -50,19 +50,19 @@ async fn includes_channels() { .snapshot .events .into_iter() - .filter_map(fixtures::event::channel) - .filter_map(fixtures::event::channel::created) + .filter_map(fixtures::event::conversation) + .filter_map(fixtures::event::conversation::created) .exactly_one() - .expect("only one channel has been created"); - assert_eq!(channel, created.channel); + .expect("only one conversation has been created"); + assert_eq!(conversation, created.conversation); } #[tokio::test] async fn includes_messages() { let app = fixtures::scratch_app().await; let sender = fixtures::user::create(&app, &fixtures::now()).await; - let channel = fixtures::channel::create(&app, &fixtures::now()).await; - let message = fixtures::message::send(&app, &channel, &sender, &fixtures::now()).await; + let conversation = fixtures::conversation::create(&app, &fixtures::now()).await; + let message = fixtures::message::send(&app, &conversation, &sender, &fixtures::now()).await; let viewer = fixtures::identity::fictitious(); let response = super::handler(State(app), viewer) @@ -84,9 +84,9 @@ async fn includes_messages() { async fn includes_expired_messages() { let app = fixtures::scratch_app().await; let sender = fixtures::user::create(&app, &fixtures::ancient()).await; - let channel = fixtures::channel::create(&app, &fixtures::ancient()).await; + let conversation = fixtures::conversation::create(&app, &fixtures::ancient()).await; let expired_message = - fixtures::message::send(&app, &channel, &sender, &fixtures::ancient()).await; + fixtures::message::send(&app, &conversation, &sender, &fixtures::ancient()).await; app.messages() .expire(&fixtures::now()) @@ -126,8 +126,9 @@ async fn includes_expired_messages() { async fn includes_deleted_messages() { let app = fixtures::scratch_app().await; let sender = fixtures::user::create(&app, &fixtures::now()).await; - let channel = fixtures::channel::create(&app, &fixtures::now()).await; - let deleted_message = fixtures::message::send(&app, &channel, &sender, &fixtures::now()).await; + let conversation = fixtures::conversation::create(&app, &fixtures::now()).await; + let deleted_message = + fixtures::message::send(&app, &conversation, &sender, &fixtures::now()).await; app.messages() .delete(&sender, &deleted_message.id, &fixtures::now()) @@ -164,11 +165,11 @@ async fn includes_deleted_messages() { } #[tokio::test] -async fn includes_expired_channels() { +async fn includes_expired_conversations() { let app = fixtures::scratch_app().await; - let expired_channel = fixtures::channel::create(&app, &fixtures::ancient()).await; + let expired_conversation = fixtures::conversation::create(&app, &fixtures::ancient()).await; - app.channels() + app.conversations() .expire(&fixtures::now()) .await .expect("expiry never fails"); @@ -183,34 +184,34 @@ async fn includes_expired_channels() { .events .iter() .cloned() - .filter_map(fixtures::event::channel) - .filter_map(fixtures::event::channel::created) + .filter_map(fixtures::event::conversation) + .filter_map(fixtures::event::conversation::created) .exactly_one() - .expect("only one channel has been created"); - // We don't expect `expired_channel` to match the event exactly, as the name will have been - // tombstoned and the channel given a `deleted_at` date. - assert_eq!(expired_channel.id, created.channel.id); + .expect("only one conversation has been created"); + // We don't expect `expired_conversation` to match the event exactly, as the name will + // have been tombstoned and the conversation given a `deleted_at` date. + assert_eq!(expired_conversation.id, created.conversation.id); let deleted = response .snapshot .events .into_iter() - .filter_map(fixtures::event::channel) - .filter_map(fixtures::event::channel::deleted) + .filter_map(fixtures::event::conversation) + .filter_map(fixtures::event::conversation::deleted) .exactly_one() - .expect("only one channel has expired"); - assert_eq!(expired_channel.id, deleted.id); + .expect("only one conversation has expired"); + assert_eq!(expired_conversation.id, deleted.id); } #[tokio::test] -async fn includes_deleted_channels() { +async fn includes_deleted_conversations() { let app = fixtures::scratch_app().await; - let deleted_channel = fixtures::channel::create(&app, &fixtures::now()).await; + let deleted_conversation = fixtures::conversation::create(&app, &fixtures::now()).await; - app.channels() - .delete(&deleted_channel.id, &fixtures::now()) + app.conversations() + .delete(&deleted_conversation.id, &fixtures::now()) .await - .expect("deleting a valid channel succeeds"); + .expect("deleting a valid conversation succeeds"); let viewer = fixtures::identity::fictitious(); let response = super::handler(State(app), viewer) @@ -222,21 +223,21 @@ async fn includes_deleted_channels() { .events .iter() .cloned() - .filter_map(fixtures::event::channel) - .filter_map(fixtures::event::channel::created) + .filter_map(fixtures::event::conversation) + .filter_map(fixtures::event::conversation::created) .exactly_one() - .expect("only one channel has been created"); - // We don't expect `deleted_channel` to match the event exactly, as the name will have been - // tombstoned and the channel given a `deleted_at` date. - assert_eq!(deleted_channel.id, created.channel.id); + .expect("only one conversation has been created"); + // We don't expect `deleted_conversation` to match the event exactly, as the name will + // have been tombstoned and the conversation given a `deleted_at` date. + assert_eq!(deleted_conversation.id, created.conversation.id); let deleted = response .snapshot .events .into_iter() - .filter_map(fixtures::event::channel) - .filter_map(fixtures::event::channel::deleted) + .filter_map(fixtures::event::conversation) + .filter_map(fixtures::event::conversation::deleted) .exactly_one() - .expect("only one channel has been deleted"); - assert_eq!(deleted_channel.id, deleted.id); + .expect("only one conversation has been deleted"); + assert_eq!(deleted_conversation.id, deleted.id); } |
