MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / build

Function build

tests/test_js_import_resolution.py:136–158  ·  view source on GitHub ↗
(checkout: Path)

Source from the content-addressed store, hash-verified

134 statement: str,
135):
136 def build(checkout: Path) -> dict:
137 root = tmp_path / checkout
138 if target_path is not None:
139 _write(root / target_path, "export interface Value { id: string }\n")
140 barrel = _write(root / "index.ts", statement.format(specifier=specifier))
141
142 result = _extract_for([barrel], root)
143 projection = {
144 "nodes": result["nodes"],
145 "edges": result["edges"],
146 }
147 serialized = json.dumps(projection, sort_keys=True)
148 assert str(root) not in serialized
149 assert _make_id(str(root)) not in serialized
150
151 expected_target = _unresolved_reexport_id(Path(specifier.removeprefix("./")))
152 reexport_targets = {
153 edge["target"]
154 for edge in result["edges"]
155 if edge["relation"] == "re_exports"
156 }
157 assert expected_target in reexport_targets
158 return projection
159
160 first = build(Path("checkout-a"))
161 second = build(Path("nested/checkout-b"))

Calls 5

_make_idFunction · 0.90
_file_node_idFunction · 0.90
_extract_forFunction · 0.85
_unresolved_reexport_idFunction · 0.85
_writeFunction · 0.70

Tested by

no test coverage detected