summaryrefslogtreecommitdiff
path: root/src/event/handlers/stream/test/message.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-06-30 22:00:57 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-07-03 22:43:42 -0400
commita15e3d580124f561864c6a39f1e035eb1b3aab13 (patch)
treeef80f725e7b02547a23b5c29a482fbf3fd188c0d /src/event/handlers/stream/test/message.rs
parent5af4aea1e2f143499529b70f9cf191c6994265c6 (diff)
Rename "channel" to "conversation" within the server.
I've split this from the schema and API changes because, frankly, it's huge. Annoyingly so. There are no semantic changes in this, it's all symbol changes, but there are a _lot_ of them because the term "channel" leaks all over everything in a service whose primary role is managing messages sent to channels (now, conversations). I found a buggy test while working on this! It's not fixed in this commit, because it felt mean to hide a real change in the middle of this much chaff.
Diffstat (limited to 'src/event/handlers/stream/test/message.rs')
-rw-r--r--src/event/handlers/stream/test/message.rs65
1 files changed, 34 insertions, 31 deletions
diff --git a/src/event/handlers/stream/test/message.rs b/src/event/handlers/stream/test/message.rs
index 4369996..3fba317 100644
--- a/src/event/handlers/stream/test/message.rs
+++ b/src/event/handlers/stream/test/message.rs
@@ -12,7 +12,7 @@ async fn sending() {
// Set up the environment
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 resume_point = fixtures::boot::resume_point(&app).await;
// Call the endpoint
@@ -33,7 +33,7 @@ async fn sending() {
let message = app
.messages()
.send(
- &channel.id,
+ &conversation.id,
&sender,
&fixtures::now(),
&fixtures::message::propose(),
@@ -57,7 +57,7 @@ async fn previously_sent() {
// Set up the environment
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 resume_point = fixtures::boot::resume_point(&app).await;
// Send a message
@@ -66,7 +66,7 @@ async fn previously_sent() {
let message = app
.messages()
.send(
- &channel.id,
+ &conversation.id,
&sender,
&fixtures::now(),
&fixtures::message::propose(),
@@ -98,27 +98,30 @@ async fn previously_sent() {
}
#[tokio::test]
-async fn sent_in_multiple_channels() {
+async fn sent_in_multiple_conversations() {
// Set up the environment
let app = fixtures::scratch_app().await;
let sender = fixtures::user::create(&app, &fixtures::now()).await;
let resume_point = fixtures::boot::resume_point(&app).await;
- let channels = [
- fixtures::channel::create(&app, &fixtures::now()).await,
- fixtures::channel::create(&app, &fixtures::now()).await,
+ let conversations = [
+ fixtures::conversation::create(&app, &fixtures::now()).await,
+ fixtures::conversation::create(&app, &fixtures::now()).await,
];
- let messages = stream::iter(channels)
- .then(|channel| {
- let app = app.clone();
- let sender = sender.clone();
- let channel = channel.clone();
- async move { fixtures::message::send(&app, &channel, &sender, &fixtures::now()).await }
- })
- .collect::<Vec<_>>()
- .await;
+ let messages =
+ stream::iter(conversations)
+ .then(|conversation| {
+ let app = app.clone();
+ let sender = sender.clone();
+ let conversation = conversation.clone();
+ async move {
+ fixtures::message::send(&app, &conversation, &sender, &fixtures::now()).await
+ }
+ })
+ .collect::<Vec<_>>()
+ .await;
// Call the endpoint
@@ -152,14 +155,14 @@ async fn sent_sequentially() {
// Set up the environment
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 sender = fixtures::user::create(&app, &fixtures::now()).await;
let resume_point = fixtures::boot::resume_point(&app).await;
let messages = vec![
- fixtures::message::send(&app, &channel, &sender, &fixtures::now()).await,
- fixtures::message::send(&app, &channel, &sender, &fixtures::now()).await,
- fixtures::message::send(&app, &channel, &sender, &fixtures::now()).await,
+ fixtures::message::send(&app, &conversation, &sender, &fixtures::now()).await,
+ fixtures::message::send(&app, &conversation, &sender, &fixtures::now()).await,
+ fixtures::message::send(&app, &conversation, &sender, &fixtures::now()).await,
];
// Subscribe
@@ -196,9 +199,9 @@ async fn expiring() {
// Set up the environment
let app = fixtures::scratch_app().await;
- let channel = fixtures::channel::create(&app, &fixtures::ancient()).await;
+ let conversation = fixtures::conversation::create(&app, &fixtures::ancient()).await;
let sender = fixtures::user::create(&app, &fixtures::ancient()).await;
- let message = fixtures::message::send(&app, &channel, &sender, &fixtures::ancient()).await;
+ let message = fixtures::message::send(&app, &conversation, &sender, &fixtures::ancient()).await;
let resume_point = fixtures::boot::resume_point(&app).await;
// Subscribe
@@ -235,9 +238,9 @@ async fn previously_expired() {
// Set up the environment
let app = fixtures::scratch_app().await;
- let channel = fixtures::channel::create(&app, &fixtures::ancient()).await;
+ let conversation = fixtures::conversation::create(&app, &fixtures::ancient()).await;
let sender = fixtures::user::create(&app, &fixtures::ancient()).await;
- let message = fixtures::message::send(&app, &channel, &sender, &fixtures::ancient()).await;
+ let message = fixtures::message::send(&app, &conversation, &sender, &fixtures::ancient()).await;
let resume_point = fixtures::boot::resume_point(&app).await;
// Expire messages
@@ -274,9 +277,9 @@ async fn deleting() {
// Set up the environment
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 sender = fixtures::user::create(&app, &fixtures::now()).await;
- let message = fixtures::message::send(&app, &channel, &sender, &fixtures::now()).await;
+ let message = fixtures::message::send(&app, &conversation, &sender, &fixtures::now()).await;
let resume_point = fixtures::boot::resume_point(&app).await;
// Subscribe
@@ -313,9 +316,9 @@ async fn previously_deleted() {
// Set up the environment
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 sender = fixtures::user::create(&app, &fixtures::now()).await;
- let message = fixtures::message::send(&app, &channel, &sender, &fixtures::now()).await;
+ let message = fixtures::message::send(&app, &conversation, &sender, &fixtures::now()).await;
let resume_point = fixtures::boot::resume_point(&app).await;
// Delete the message
@@ -352,9 +355,9 @@ async fn previously_purged() {
// Set up the environment
let app = fixtures::scratch_app().await;
- let channel = fixtures::channel::create(&app, &fixtures::ancient()).await;
+ let conversation = fixtures::conversation::create(&app, &fixtures::ancient()).await;
let sender = fixtures::user::create(&app, &fixtures::ancient()).await;
- let message = fixtures::message::send(&app, &channel, &sender, &fixtures::ancient()).await;
+ let message = fixtures::message::send(&app, &conversation, &sender, &fixtures::ancient()).await;
let resume_point = fixtures::boot::resume_point(&app).await;
// Purge the message