Skip to content

Commit

Permalink
Updating more suggest store tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bendk committed May 28, 2024
1 parent d73a4c7 commit be2d22f
Show file tree
Hide file tree
Showing 6 changed files with 497 additions and 1,690 deletions.
4 changes: 2 additions & 2 deletions components/suggest/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
use crate::rs::{DownloadedGlobalConfig, DownloadedWeatherData};

/// Global Suggest configuration data.
#[derive(Clone, Default, Debug, Deserialize, Serialize)]
#[derive(Clone, Default, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct SuggestGlobalConfig {
pub show_less_frequently_cap: i32,
}
Expand All @@ -22,7 +22,7 @@ impl From<&DownloadedGlobalConfig> for SuggestGlobalConfig {
}

/// Per-provider configuration data.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub enum SuggestProviderConfig {
Weather { min_keyword_length: i32 },
}
Expand Down
16 changes: 16 additions & 0 deletions components/suggest/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ impl SuggestionQuery {
}
}

pub fn mdn(keyword: &str) -> Self {
Self {
keyword: keyword.into(),
providers: vec![SuggestionProvider::Mdn],
limit: None,
}
}

pub fn weather(keyword: &str) -> Self {
Self {
keyword: keyword.into(),
providers: vec![SuggestionProvider::Weather],
limit: None,
}
}

pub fn limit(self, limit: i32) -> Self {
Self {
limit: Some(limit),
Expand Down
Loading

0 comments on commit be2d22f

Please sign in to comment.