Skip to content

Commit

Permalink
chore(docs): fix budget feature flag [#236]
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Dec 12, 2024
1 parent 19923b9 commit cac3473
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 31 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spider/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider"
version = "2.21.17"
version = "2.21.18"
authors = [
"j-mendez <[email protected]>"
]
Expand Down
4 changes: 2 additions & 2 deletions spider/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ impl Configuration {
self
}

/// Set a crawl page limit. If the value is 0 there is no limit. This does nothing without the feat flag `budget` enabled.
/// Set a crawl page limit. If the value is 0 there is no limit.
pub fn with_limit(&mut self, limit: u32) -> &mut Self {
self.with_budget(Some(hashbrown::HashMap::from([("*", limit)])));
self
Expand Down Expand Up @@ -693,7 +693,7 @@ impl Configuration {
self
}

/// Set a crawl depth limit. If the value is 0 there is no limit. This does nothing without the feat flag `budget` enabled.
/// Set a crawl depth limit. If the value is 0 there is no limit.
pub fn with_depth(&mut self, depth: usize) -> &mut Self {
self.depth = depth;
self
Expand Down
4 changes: 2 additions & 2 deletions spider/src/website.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3914,7 +3914,7 @@ impl Website {
self.configuration.budget = budget;
}

/// Set a crawl depth limit. If the value is 0 there is no limit. This does nothing without the feat flag `budget` enabled.
/// Set a crawl depth limit. If the value is 0 there is no limit.
pub fn with_depth(&mut self, depth: usize) -> &mut Self {
self.configuration.with_depth(depth);
self
Expand Down Expand Up @@ -4079,7 +4079,7 @@ impl Website {
self
}

/// Set a crawl page limit. If the value is 0 there is no limit. This does nothing without the feat flag `budget` enabled.
/// Set a crawl page limit. If the value is 0 there is no limit.
pub fn with_limit(&mut self, limit: u32) -> &mut Self {
self.configuration.with_limit(limit);
self
Expand Down
2 changes: 1 addition & 1 deletion spider_chrome/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_chrome"
version = "2.21.17"
version = "2.21.18"
rust-version = "1.70"
authors = [
"j-mendez <[email protected]>"
Expand Down
45 changes: 30 additions & 15 deletions spider_chrome/src/handler/blockers/intercept_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ impl NetworkInterceptManager {
}
}


#[cfg(test)]
mod tests {
use super::*;
Expand All @@ -95,15 +94,30 @@ mod tests {
("https://facebook.com", NetworkInterceptManager::Facebook),
("https://www.amazon.com", NetworkInterceptManager::Amazon),
("https://subdomain.x.com", NetworkInterceptManager::X),
("https://linkedin.com/in/someone", NetworkInterceptManager::LinkedIn),
("https://www.netflix.com/browse", NetworkInterceptManager::Netflix),
(
"https://linkedin.com/in/someone",
NetworkInterceptManager::LinkedIn,
),
(
"https://www.netflix.com/browse",
NetworkInterceptManager::Netflix,
),
("https://medium.com", NetworkInterceptManager::Medium),
("https://sub.upwork.com", NetworkInterceptManager::Upwork),
("https://glassdoor.com", NetworkInterceptManager::Glassdoor),
("https://ebay.com", NetworkInterceptManager::Ebay),
("https://nytimes.com/section/world", NetworkInterceptManager::Nytimes),
("https://en.wikipedia.org/wiki/Rust", NetworkInterceptManager::Wikipedia),
("https://market.tcgplayer.com", NetworkInterceptManager::Tcgplayer),
(
"https://nytimes.com/section/world",
NetworkInterceptManager::Nytimes,
),
(
"https://en.wikipedia.org/wiki/Rust",
NetworkInterceptManager::Wikipedia,
),
(
"https://market.tcgplayer.com",
NetworkInterceptManager::Tcgplayer,
),
];

for (url, expected) in cases {
Expand All @@ -121,21 +135,22 @@ mod tests {
];

for url in cases {
assert_eq!(NetworkInterceptManager::new(&create_url(url)), NetworkInterceptManager::Unknown);
assert_eq!(
NetworkInterceptManager::new(&create_url(url)),
NetworkInterceptManager::Unknown
);
}
}

#[test]
fn test_invalid_urls() {
let cases = vec![
"not-a-url",
"ftp://invalid.protocol.com",
"http://",
"",
];
let cases = vec!["not-a-url", "ftp://invalid.protocol.com", "http://", ""];

for url in cases {
assert_eq!(NetworkInterceptManager::new(&create_url(url)), NetworkInterceptManager::Unknown);
assert_eq!(
NetworkInterceptManager::new(&create_url(url)),
NetworkInterceptManager::Unknown
);
}
}
}
}
2 changes: 1 addition & 1 deletion spider_cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_cli"
version = "2.21.17"
version = "2.21.18"
authors = [
"j-mendez <[email protected]>"
]
Expand Down
2 changes: 1 addition & 1 deletion spider_transformations/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_transformations"
version = "2.21.17"
version = "2.21.18"
authors = [
"j-mendez <[email protected]>"
]
Expand Down
2 changes: 1 addition & 1 deletion spider_utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_utils"
version = "2.21.17"
version = "2.21.18"
authors = [
"j-mendez <[email protected]>"
]
Expand Down
2 changes: 1 addition & 1 deletion spider_worker/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_worker"
version = "2.21.17"
version = "2.21.18"
authors = [
"j-mendez <[email protected]>"
]
Expand Down

0 comments on commit cac3473

Please sign in to comment.