From 7be28b1ca71d227d0dac0fba9aa8a2b982cbca19 Mon Sep 17 00:00:00 2001 From: ayushcodes10 Date: Mon, 14 Sep 2026 14:47:09 +0530 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh (cherry picked from commit 8fae5432366fad61078f61690b698581ad3220a2) --- tests/test_js_destructured_export.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_js_destructured_export.py b/tests/test_js_destructured_export.py index b558443c3..814bcdca8 100644 --- a/tests/test_js_destructured_export.py +++ b/tests/test_js_destructured_export.py @@ -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