mirror of
https://github.com/safishamsi/graphify.git
synced 2026-10-14 07:59:40 +00:00
Add a test for rest pattern skip in destructured exports
A rest element does not correspond to one discrete exported name, so it must be skipped rather than mangled into a bogus node, and its sibling names must still extract cleanly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh
This commit is contained in:
1 parent
8fae543236
commit
7091925a3a
1 file changed
+13
@@ -71,3 +71,16 @@ def test_renamed_property_exports_under_its_key_not_its_local_alias(tmp_path):
|
||||
labels = set(lbl.values())
|
||||
assert "handlers" in labels
|
||||
assert "h" not in labels
|
||||
|
||||
|
||||
def test_rest_pattern_is_skipped_not_mangled(tmp_path):
|
||||
# `...rest` does not correspond to one discrete exported name; it must
|
||||
# not produce a node, and must not break extraction of its siblings.
|
||||
r, lbl = _extract(tmp_path, {
|
||||
"auth.ts": _NEXTAUTH_HELPER
|
||||
+ "export const { auth, ...rest } = NextAuth({});\n",
|
||||
})
|
||||
labels = set(lbl.values())
|
||||
assert "auth" in labels
|
||||
assert "rest" not in labels
|
||||
assert not any("rest" in label for label in labels)
|
||||
Reference in new issue
Block a user