Skip to content

Commit 8a025da

Browse files
committed
restore comments
1 parent f79b789 commit 8a025da

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/registry_client.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ pub trait RegistryClient: std::fmt::Debug + Send + Sync {
4646
async fn fetch(&self, update_url: &UpdateUrl) -> Result<AllPackageVersions, RegistryError>;
4747
}
4848

49-
/// Production registry client that makes actual HTTP requests
49+
/// The real implementation of RegistryClientTrait which makes actual network
50+
/// requests
5051
#[derive(Debug)]
5152
pub struct LiveRegistryClient {
5253
pub client: Client,

src/registry_client_test.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,33 @@ use {
88

99
#[test]
1010
fn filters_out_deprecated_versions() {
11+
// Simulate npm registry response with deprecated versions
1112
let package_meta = PackageMeta {
1213
name: "@eslint/js".to_string(),
1314
versions: {
1415
let mut versions = BTreeMap::new();
16+
// Regular version
1517
versions.insert("9.38.0".to_string(), json!({"version": "9.38.0"}));
18+
// Deprecated version
1619
versions.insert(
1720
"10.0.0".to_string(),
1821
json!({"version": "10.0.0", "deprecated": "This version should not be used."}),
1922
);
23+
// Another regular version
2024
versions.insert("9.39.0".to_string(), json!({"version": "9.39.0"}));
2125
versions
2226
},
2327
};
2428

29+
// Extract versions using the filtering logic
2530
let versions: Vec<String> = package_meta
2631
.versions
2732
.into_iter()
2833
.filter(|(_, metadata)| metadata.get("deprecated").is_none())
2934
.map(|(version, _)| version)
3035
.collect();
3136

37+
// Should only include non-deprecated versions
3238
assert_eq!(versions.len(), 2);
3339
assert!(versions.contains(&"9.38.0".to_string()));
3440
assert!(versions.contains(&"9.39.0".to_string()));

0 commit comments

Comments
 (0)