summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-07-01 00:31:09 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-07-01 02:00:17 -0400
commitb3ce81945621e9026e687b590e7aa541008575ac (patch)
treec4dcc161b5323ad6e08f5d7c79f395649203dc95 /src
parentc0c825477e476d6d7331bfc409bceff9c376b484 (diff)
Sending messages to a deleted channel should send to the deleted channel's ID, not to a fictitious ID.
The existing test scenario: * Create a channel (with ID C1). * Delete channel C1. * Roll the dice to invent a channel ID C2. * Send a message to channel C2. * Observe that sending fails. This was not verifying anything about the deleted channel C1 - it was basically reproducing the `nonexistent_channel` test scenario with the most marginal of garnishes on it. This is probably copy-paste damage from when this test was originally written. Sending did fail, so this test scenario passed, but it passed effectively by accident. The new test scenario: * Create a channel (with ID C1). * Delete channel C1. * Send a message to channel C1. * Observe that sending fails. Concerningly, sending does _not_ fail in this scenario (i.e., the test _does_ fail), so the broken test case was masking a real bug.
Diffstat (limited to 'src')
-rw-r--r--src/channel/handlers/send/test.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/channel/handlers/send/test.rs b/src/channel/handlers/send/test.rs
index 7204ca4..d77e07d 100644
--- a/src/channel/handlers/send/test.rs
+++ b/src/channel/handlers/send/test.rs
@@ -108,13 +108,12 @@ async fn deleted_channel() {
// Call the endpoint
let sent_at = fixtures::now();
- let channel = channel::Id::generate();
let request = super::Request {
body: fixtures::message::propose(),
};
let super::Error(error) = super::handler(
State(app),
- Path(channel.clone()),
+ Path(channel.id.clone()),
sent_at,
sender,
Json(request),
@@ -126,6 +125,6 @@ async fn deleted_channel() {
assert!(matches!(
error,
- SendError::ChannelNotFound(error_channel) if channel == error_channel
+ SendError::ChannelNotFound(error_channel) if channel.id == error_channel
));
}