summaryrefslogtreecommitdiff
path: root/src/channel/routes/test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/channel/routes/test.rs')
-rw-r--r--src/channel/routes/test.rs27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/channel/routes/test.rs b/src/channel/routes/test.rs
index 10b1e8d..cba8f2e 100644
--- a/src/channel/routes/test.rs
+++ b/src/channel/routes/test.rs
@@ -16,6 +16,7 @@ async fn new_channel() {
let app = fixtures::scratch_app().await;
let creator = fixtures::identity::create(&app, &fixtures::now()).await;
+ let resume_point = fixtures::boot::resume_point(&app).await;
// Call the endpoint
@@ -44,7 +45,7 @@ async fn new_channel() {
let mut events = app
.events()
- .subscribe(None)
+ .subscribe(resume_point)
.await
.expect("subscribing never fails")
.filter_map(fixtures::event::channel)
@@ -116,6 +117,30 @@ async fn conflicting_canonical_name() {
}
#[tokio::test]
+async fn invalid_name() {
+ // Set up the environment
+
+ let app = fixtures::scratch_app().await;
+ let creator = fixtures::identity::create(&app, &fixtures::now()).await;
+
+ // Call the endpoint
+
+ let name = fixtures::channel::propose_invalid_name();
+ let request = post::Request { name: name.clone() };
+ let post::Error(error) =
+ post::handler(State(app.clone()), creator, fixtures::now(), Json(request))
+ .await
+ .expect_err("invalid channel name should fail the request");
+
+ // Verify the structure of the response
+
+ assert!(matches!(
+ error,
+ app::CreateError::InvalidName(error_name) if name == error_name
+ ));
+}
+
+#[tokio::test]
async fn name_reusable_after_delete() {
// Set up the environment