Skip to content

Commit 3d501e0

Browse files
antonok-edmatuchin-m
authored andcommitted
respect default list metadata during live tests
1 parent ecd3adb commit 3d501e0

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tests/live.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ fn load_requests() -> Vec<RequestRuleMatch> {
4646
#[derive(serde::Deserialize, Debug)]
4747
pub struct RemoteFilterCatalogEntry {
4848
pub title: String,
49+
#[serde(default)]
50+
pub default_enabled: bool,
51+
#[serde(default)]
52+
pub platforms: Vec<String>,
4953
pub sources: Vec<RemoteFilterSource>,
5054
}
5155

@@ -83,8 +87,17 @@ static ALL_FILTERS: once_cell::sync::Lazy<std::sync::Mutex<adblock::lists::Filte
8387
}
8488
.await;
8589

86-
// 0th entry is the main default lists
87-
let default_lists = &default_catalog[0].sources;
90+
let default_lists: Vec<_> = default_catalog
91+
.iter()
92+
.filter(|comp| comp.default_enabled)
93+
.filter(|comp| {
94+
comp.platforms.is_empty()
95+
|| comp.platforms.iter().any(|platform| {
96+
["LINUX", "WINDOWS", "MAC"].contains(&platform.as_str())
97+
})
98+
})
99+
.flat_map(|comp| &comp.sources)
100+
.collect();
88101

89102
assert!(default_lists.len() > 10); // sanity check
90103

0 commit comments

Comments
 (0)