Repository: meilisearch/meilisearch
File: crates/meilisearch/tests/search/facet_search.rs (Rust)

Code before:
            "id": "166428",
        },
        {
            "title": "Gläss",
            "genres": ["Thriller"],
            "id": "450465",
        }
    ])
});

async fn test_settings_documents_indexing_swapping_and_facet_search(
    documents: &Value,
    settings: &Value,
    query: &Value,
    test: impl Fn(Value, actix_http::StatusCode) + std::panic::UnwindSafe + Clone,
) {
    let temp = TempDir::new().unwrap();
    let server = Server::new_with_options(Opt { ..default_settings(temp.path()) }).await.unwrap();

    eprintln!("Documents -> Settings -> test");
    let index = server.index("test");

    let (task, code) = index.add_documents(documents.clone(), None).await;
    assert_eq!(code, 202, "{}", task);
    let response = index.wait_task(task.uid()).await.succeeded();
    assert!(response.is_success(), "{response:?}");

    let (task, code) = index.update_settings(settings.clone()).await;
    assert_eq!(code, 202, "{}", task);
    let response = index.wait_task(task.uid()).await.succeeded();
    assert!(response.is_success(), "{response:?}");

    let (response, code) = index.facet_search(query.clone()).await;
    insta::allow_duplicates! {
        test(response, code);
    }

    let (task, code) = server.delete_index("test").await;
    assert_eq!(code, 202, "{}", task);
    let response = server.wait_task(task.uid()).await.succeeded();
    assert!(response.is_success(), "{response:?}");

    eprintln!("Settings -> Documents -> test");
    let index = server.index("test");

    let (task, code) = index.update_settings(settings.clone()).await;
    assert_eq!(code, 202, "{}", task);
    let response = index.wait_task(task.uid()).await.succeeded();
    assert!(response.is_success(), "{response:?}");

    let (task, code) = index.add_documents(documents.clone(), None).await;

Review comment (suggestion):
both lines are checking the same thing, see the [succeeded method implementation](https://github.com/meilisearch/meilisearch/blob/d416b3b3905ebe684e0aabc6a8c5343ad4aa5df7/crates/meilisearch/tests/common/mod.rs#L53-L58).

```suggestion
    let response = index.wait_task(task.uid()).await.succeeded();
```

Same everywhere in the file

Code after:
            "id": "166428",
        },
        {
            "title": "Gläss",
            "genres": ["Thriller"],
            "id": "450465",
        }
    ])
});

async fn test_settings_documents_indexing_swapping_and_facet_search(
    documents: &Value,
    settings: &Value,
    query: &Value,
    test: impl Fn(Value, actix_http::StatusCode) + std::panic::UnwindSafe + Clone,
) {
    let temp = TempDir::new().unwrap();
    let server = Server::new_with_options(Opt { ..default_settings(temp.path()) }).await.unwrap();

    eprintln!("Documents -> Settings -> test");
    let index = server.index("test");

    let (task, code) = index.add_documents(documents.clone(), None).await;
    assert_eq!(code, 202, "{}", task);
    index.wait_task(task.uid()).await.succeeded();

    let (task, code) = index.update_settings(settings.clone()).await;
    assert_eq!(code, 202, "{}", task);
    index.wait_task(task.uid()).await.succeeded();

    let (response, code) = index.facet_search(query.clone()).await;
    insta::allow_duplicates! {
        test(response, code);
    }

    let (task, code) = server.delete_index("test").await;
    assert_eq!(code, 202, "{}", task);
    server.wait_task(task.uid()).await.succeeded();

    eprintln!("Settings -> Documents -> test");
    let index = server.index("test");

    let (task, code) = index.update_settings(settings.clone()).await;
    assert_eq!(code, 202, "{}", task);
    index.wait_task(task.uid()).await.succeeded();

    let (task, code) = index.add_documents(documents.clone(), None).await;
    assert_eq!(code, 202, "{}", task);
    index.wait_task(task.uid()).await.succeeded();

    let (response, code) = index.facet_search(query.clone()).await;