Add a test for renamed property export naming

A renamed destructured property must export under its property key,
never under the local alias it is bound to, since that alias is not
what an importer would ever bind by.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh
(cherry picked from commit 8fae543236)
This commit is contained in:
ayushcodes10 authored and safishamsi committed 2026-09-14 18:49:19 +01:00
1 parent 37b3db9654
commit 7be28b1ca7
1 file changed
+12
+12
View File
@@ -59,3 +59,15 @@ def test_single_name_import_resolves_to_its_own_node(tmp_path):
for e in r["edges"] if e["relation"] == "calls"]
assert ("useAuth()", "auth") in calls, \
f"call through the destructured import did not resolve; calls={calls}"
def test_renamed_property_exports_under_its_key_not_its_local_alias(tmp_path):
# `handlers: h` is imported elsewhere as `handlers` (the property key) --
# the local alias `h` is never a valid import name for it.
r, lbl = _extract(tmp_path, {
"auth.ts": _NEXTAUTH_HELPER
+ "export const { handlers: h } = NextAuth({});\n",
})
labels = set(lbl.values())
assert "handlers" in labels
assert "h" not in labels