Skip to content

Commit

Permalink
Fixed issue #150
Browse files Browse the repository at this point in the history
  • Loading branch information
tisnik committed Mar 20, 2019
1 parent d3b2f28 commit 42a8d60
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/files/npm-list-transitive-dependencies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"dependencies": {
"body-parser": {
"version": "1.18.2",
"dependencies": {
"debug": {
"version": "2.6.9",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"dependencies": {
"ms": {
"version": "2.0.0",
"from": "[email protected]",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz"
}
}
}
}
}
}
}
21 changes: 21 additions & 0 deletions tests/test_node_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ def test_node_parser():
with (Path(__file__).parent / "files/npm-list.json").open('rb') as f:
direct_dependencies, transitive_dependencies = \
NodeParser.parse_output_files([FileStorage(f)])

assert direct_dependencies is not None
assert transitive_dependencies is not None

assert direct_dependencies == {
"npm:github-url-to-object:4.0.4",
"npm:lodash:4.17.10",
Expand All @@ -33,3 +37,20 @@ def test_node_parser():
"npm:is-url:1.2.4",
"npm:semver:5.5.1"
}


def test_node_parser_transitive_dependencies():
"""Test node parser for transitive dependencies."""
with (Path(__file__).parent / "files/npm-list-transitive-dependencies.json").open('rb') as f:
direct_dependencies, transitive_dependencies = \
NodeParser.parse_output_files([FileStorage(f)])

assert direct_dependencies is not None
assert transitive_dependencies is not None

assert direct_dependencies == {
"npm:body-parser:1.18.2"
}
assert transitive_dependencies == {
"npm:ms:2.0.0"
}

0 comments on commit 42a8d60

Please sign in to comment.