Skip to content

Commit a4da3d4

Browse files
authored
Fix failing test for v0.28.0 (#322)
* Fix some forgotton tests for v0.28.0 * Remove unecessary comment * Fix tests * Fix closing brackets
1 parent e63cfea commit a4da3d4

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/client.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,10 @@ impl Client {
481481
/// # futures::executor::block_on(async move {
482482
/// let client = Client::new(MEILISEARCH_HOST, MEILISEARCH_API_KEY);
483483
/// # let key = client.get_keys().await.unwrap().results.into_iter()
484-
/// .find(|k| k.name.as_ref().map_or(false, |name| name.starts_with("Default Search API Key")));
485-
/// let key_id = key.unwrap().key; // enter your API key here, for the example we use the search API key.
486-
/// let key = client.get_key(key_id).await.unwrap();
484+
/// .find(|k| k.name.as_ref().map_or(false, |name| name.starts_with("Default Search API Key")))
485+
/// .unwrap();
486+
///
487+
/// let key = client.get_key(key).await.unwrap();
487488
///
488489
/// assert_eq!(key.name, Some("Default Search API Key".to_string()));
489490
/// # });
@@ -741,12 +742,10 @@ impl Client {
741742
/// #
742743
/// # futures::executor::block_on(async move {
743744
/// # let client = client::Client::new(MEILISEARCH_HOST, MEILISEARCH_API_KEY);
745+
///
744746
/// let mut query = tasks::TasksQuery::new(&client);
745747
/// query.with_index_uid(["get_tasks_with"]);
746748
/// let tasks = client.get_tasks_with(&query).await.unwrap();
747-
///
748-
/// # assert!(tasks.results.len() > 0);
749-
/// # client.index("get_tasks_with").delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
750749
/// # });
751750
/// ```
752751
pub async fn get_tasks_with(

src/indexes.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ impl Index {
407407
pub async fn get_documents_with<T: DeserializeOwned + 'static>(
408408
&self,
409409
documents_query: &DocumentsQuery<'_>,
410+
) -> Result<DocumentsResults<T>, Error> {
410411
let url = format!("{}/indexes/{}/documents", self.client.host, self.uid);
411412
request::<&DocumentsQuery, DocumentsResults<T>>(
412413
&url,
@@ -467,7 +468,7 @@ impl Index {
467468
/// client.wait_for_task(task, None, None).await.unwrap();
468469
///
469470
/// let movies = movie_index.get_documents::<Movie>().await.unwrap();
470-
/// assert!(movies.len() >= 3);
471+
/// assert!(movies.results.len() >= 3);
471472
/// # movie_index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
472473
/// # });
473474
/// ```
@@ -545,7 +546,7 @@ impl Index {
545546
/// client.wait_for_task(task, None, None).await.unwrap();
546547
///
547548
/// let movies = movie_index.get_documents::<Movie>().await.unwrap();
548-
/// assert!(movies.len() >= 3);
549+
/// assert!(movies.results.len() >= 3);
549550
/// # movie_index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
550551
/// # });
551552
/// ```

src/tasks.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ impl Task {
279279
/// # let task = client.create_index("unwrap_failure", None).await.unwrap();
280280
/// # let index = client.wait_for_task(task, None, None).await.unwrap().try_make_index(&client).unwrap();
281281
///
282-
/// // TODO: fails until http method are implemented
283282
/// let task = index.set_ranking_rules(["wrong_ranking_rule"])
284283
/// .await
285284
/// .unwrap()

0 commit comments

Comments
 (0)