From b3ce81945621e9026e687b590e7aa541008575ac Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Tue, 1 Jul 2025 00:31:09 -0400 Subject: 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. --- src/channel/handlers/send/test.rs | 5 ++--- 1 file 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 )); } -- cgit v1.2.3