Browse Source

fix

pull/1693/head
o2sh 1 month ago
parent
commit
34311fb1bd
No known key found for this signature in database
GPG Key ID: 312D4049F1925763
  1. 21
      manifest/tests/fixtures/npm_only_dependencies_counted/package.json
  2. 10
      manifest/tests/fixtures/npm_without_dependencies/package.json
  3. 20
      manifest/tests/npm.rs

21
manifest/tests/fixtures/npm_only_dependencies_counted/package.json vendored

@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
{
"name": "mixed_deps_package",
"version": "1.2.3",
"dependencies": {
"a": "^1.0.0",
"b": "^2.0.0"
},
"devDependencies": {
"c": "^3.0.0"
},
"peerDependencies": {
"d": "^4.0.0",
"e": "^5.0.0"
},
"optionalDependencies": {
"f": "^6.0.0"
},
"bundledDependencies": [
"g"
]
}

10
manifest/tests/fixtures/npm_without_dependencies/package.json vendored

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
{
"name": "no_runtime_deps_package",
"version": "0.0.1",
"devDependencies": {
"typescript": "^5.0.0"
},
"peerDependencies": {
"react": "^19.0.0"
}
}

20
manifest/tests/npm.rs

@ -17,23 +17,3 @@ fn should_detect_and_parse_npm_manifest() -> Result<()> { @@ -17,23 +17,3 @@ fn should_detect_and_parse_npm_manifest() -> Result<()> {
assert_eq!(npm_manifest.license, Some("ISC".into()));
Ok(())
}
#[test]
fn should_only_count_dependencies_for_npm_manifest() -> Result<()> {
let manifests = get_manifests("tests/fixtures/npm_only_dependencies_counted")?;
assert_eq!(manifests.len(), 1);
let npm_manifest = manifests.first().unwrap();
assert_eq!(npm_manifest.manifest_type, ManifestType::Npm);
assert_eq!(npm_manifest.number_of_dependencies, 2);
Ok(())
}
#[test]
fn should_count_zero_when_npm_dependencies_field_is_missing() -> Result<()> {
let manifests = get_manifests("tests/fixtures/npm_without_dependencies")?;
assert_eq!(manifests.len(), 1);
let npm_manifest = manifests.first().unwrap();
assert_eq!(npm_manifest.manifest_type, ManifestType::Npm);
assert_eq!(npm_manifest.number_of_dependencies, 0);
Ok(())
}

Loading…
Cancel
Save