test_definitions_in_plain_javascript_and_tsx

Tests › tests/test_jsts.py

passed Passed in the packaged run.

What this test is for

Why it exists

The test says nothing about why.

Given

  1. js = b"/** Adds. */\nfunction add(a, b) { return a + b; }\nmodule.exports = { add };\n"
  2. tsx = b"export function App() { return <div>{x}</div>; }\n"
→

When

  1. —
→

Then

  1. ✓ [f["name"] for f in harvest_definitions(_tree("javascript", js), js)["functions"]] equals [ "add" ]
  2. ✓ [f["name"] for f in harvest_definitions(_tree("tsx", tsx), tsx)["functions"]] equals ["App"]

What it exercises

The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.

`main` (clew/guard/main.py) · 16 of 357 steps

… 127 earlier steps

program launcherprogram launcherprogram launcherprogram launcherprogram launcherclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyother filesother filesother filesother filesother filesloop (line 647)loopopt (line 658)optopt (line 377)optalt (line 380)altopt (line 383)optopt (line 384)optopt (line 400)optopt (line 681)optopt (line 683)optmain128. _append_declaration → _extract_signature128_extract_signature129. _collect_functions → _resolve_function_node129_resolve_function_node130. _resolve_function_node → _unwrap_decorated130_unwrap_decorated▶ test enters131. _resolve_function_node → _bound_function131_bound_function132–134. _collect_functions → _extract_function_name132_extract_function_name +2 more135. _function_carrier → _bound_function135_bound_function136. _collect_functions → _find_preceding_doxygen136_find_preceding_doxygen137. _find_preceding_doxygen → _preceding_node137_preceding_node▶ test enters138–140. _find_preceding_doxygen → _collect_rust_doc138_collect_rust_doc +2 more141. _find_preceding_doxygen → _collect_c_comment141_collect_c_comment142. _find_preceding_doxygen → _find_python_docstring_block142_find_python_docstring_block143. _find_preceding_doxygen → parse_doxygen_tags143parse_doxygen_tags144. _find_preceding_doxygen → apply_autobrief144apply_autobrief145. _find_preceding_doxygen → _last_row145_last_row146–147. _collect_functions → _qualified_enclosing146_qualified_enclosing +1 more148. _extract_signature → _function_carrier148_function_carrier▶ test enters149–151. _collect_functions → _js_returns_void149_js_returns_void +2 more152. _produced_class → _function_carrier152_function_carrier▶ test enters153–154. _collect_functions → _collect_functions153_collect_functions +1 more

… 8 steps between

program launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyother filesother filesother filesother filesopt (line 1198)optloop (line 143)looploop (line 146)loopopt (line 149)optopt (line 1171)optloop (line 181)loopmain163. _extract_file_block_text → _docstring_block163_docstring_block164. _check_file_block_tags → parse_doxygen_tags164parse_doxygen_tags165–166. parse_doxygen_tags → _mask_escaped_at165_mask_escaped_at +1 more167–169. parse_doxygen_tags → _finalize_tag167_finalize_tag +2 more170. parse_doxygen_tags → _finalize_tag170_finalize_tag171. _check_file_block_tags → apply_autobrief171apply_autobrief172–174. apply_autobrief → _mask_escaped_at172_mask_escaped_at +2 more175. validate_file → check_presence175check_presence176. check_presence → get_validate176get_validate

… 181 later steps

tests/test_jsts.py:90 · its file's page

What it checks (2)

  1. assert [f["name"] for f in harvest_definitions(_tree("javascript", js), js)["functions"]] == [ "add" ] observes _tree
  2. assert [f["name"] for f in harvest_definitions(_tree("tsx", tsx), tsx)["functions"]] == ["App"] observes _tree

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_definitions_in_plain_javascript_and_tsx→_tree

What it reaches

Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.

Also reaches 5 requirements

Its run touches their code; that is reach, not proof.