Skip to content

The API allows adding categories with empty name #288

@josecelano

Description

@josecelano

Check this test:

#[tokio::test]
async fn it_should_allow_adding_empty_categories() {
    // code-review: this is a bit weird, is it a intended behavior?

    let mut env = TestEnv::new();
    env.start(api::Version::V1).await;

    if env.is_shared() {
        // This test cannot be run in a shared test env because it will fail
        // when the empty category already exits
        println!("Skipped");
        return;
    }

    let logged_in_admin = new_logged_in_admin(&env).await;
    let client = Client::authenticated(&env.server_socket_addr().unwrap(), &logged_in_admin.token);

    let category_name = String::new();

    let response = client
        .add_category(AddCategoryForm {
            name: category_name.to_string(),
            icon: None,
        })
        .await;

    assert_added_category_response(&response, &category_name);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIncorrect BehaviorEasyGood for Newcomers

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions