Skip to content

Commit

Permalink
Improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
codingjoe committed Jan 25, 2024
1 parent 9fbe375 commit 251cbd2
Show file tree
Hide file tree
Showing 17 changed files with 70 additions and 3 deletions.
2 changes: 1 addition & 1 deletion django_esm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def parse_package_json(path: Path = None):
try:
module = exports["default"]
yield from get_static_from_abs_path(
str(Path(name) / module),
name,
path / module,
settings.BASE_DIR / "node_modules",
)
Expand Down
27 changes: 26 additions & 1 deletion tests/node_modules/.package-lock.json

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

7 changes: 6 additions & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
"#htmx": "https://unpkg.com/htmx.org@1.9.10"
},
"dependencies": {
"deep": "file:packages/deep",
"flat": "file:packages/flat",
"flat2": "file:packages/flat2",
"htmx.org": "^1.9.9",
"lit": "^3.1.0"
"list": "file:packages/list",
"lit": "^3.1.0",
"string": "file:packages/string"
}
}
Empty file.
Empty file.
Empty file added tests/packages/deep/index.js
Empty file.
10 changes: 10 additions & 0 deletions tests/packages/deep/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "deep",
"exports": {
".": {
"import": "./index.js"
},
"./*": "./*",
"./utils": ["./utils/a.js"]
}
}
Empty file added tests/packages/deep/utils/a.js
Empty file.
Empty file added tests/packages/flat/index.js
Empty file.
6 changes: 6 additions & 0 deletions tests/packages/flat/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "flat",
"exports": {
"default": "./index.js"
}
}
Empty file added tests/packages/flat2/index.js
Empty file.
7 changes: 7 additions & 0 deletions tests/packages/flat2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "flat2",
"exports": {
"node": "./index.js",
"import": "./index.js"
}
}
Empty file added tests/packages/list/index.js
Empty file.
4 changes: 4 additions & 0 deletions tests/packages/list/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "list",
"exports": ["./index.js"]
}
4 changes: 4 additions & 0 deletions tests/packages/string/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "string",
"exports": "./index.js"
}
6 changes: 6 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ def test_parse_dependencies(package_json):
import_map["@lit/reactive-element"]
== "@lit/reactive-element/reactive-element.js"
)
assert import_map["string"] == "string/index.js"
assert import_map["list/index.js"] == "list/index.js"
assert import_map["flat"] == "flat/index.js"
assert import_map["flat2"] == "flat2/index.js"
assert import_map["deep"] == "deep/index.js"
assert import_map["deep/features/a.js"] == "deep/features/a.js"


def test_parse_root_package__bad_imports(package_json):
Expand Down
Empty file.

0 comments on commit 251cbd2

Please sign in to comment.