Skip to content

Commit e03aa6c

Browse files
committed
Change the test from a username too short to a username too long
1 parent d160495 commit e03aa6c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

crates/handlers/src/views/register.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ mod tests {
498498
}
499499

500500
#[sqlx::test(migrator = "mas_storage_pg::MIGRATOR")]
501-
async fn test_register_username_too_short(pool: PgPool) {
501+
async fn test_register_username_too_long(pool: PgPool) {
502502
setup();
503503
let state = TestState::from_pool(pool).await.unwrap();
504504
let cookies = CookieHelper::new();
@@ -524,7 +524,7 @@ mod tests {
524524
let request = Request::post(&*mas_router::Register::default().path_and_query()).form(
525525
serde_json::json!({
526526
"csrf": csrf_token,
527-
"username": "",
527+
"username": "a".repeat(256),
528528
"email": "[email protected]",
529529
"password": "hunter2",
530530
"password_confirm": "hunter2",
@@ -535,7 +535,11 @@ mod tests {
535535
let response = state.request(request).await;
536536
cookies.save_cookies(&response);
537537
response.assert_status(StatusCode::OK);
538-
assert!(response.body().contains("username too short"));
538+
assert!(
539+
response.body().contains("Username is too long"),
540+
"response body: {}",
541+
response.body()
542+
);
539543
}
540544

541545
/// When the user already exists in the database, it should give an error

0 commit comments

Comments
 (0)