Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tests/test_journal_block_reports_its_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,4 @@ def test_a_heading_not_created_fails_instead_of_moving_the_blocks(monkeypatch, e
assert result.stdout == ""
error = json.loads(result.stderr)
assert (error["reason"], error["method"]) == ("write_not_verified", "appendBlockInPage")
assert "Could not find or create" not in result.stderr
assert double.tree("2026-01-05, Monday") == [("journal top", [])]
2 changes: 1 addition & 1 deletion tests/test_keep_block_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def test_top_level_roots_keep_their_ids_too(self, tmp_path):
assert result.exit_code == 0, result.output
_, siblings, i, parent = api.graph.locate(VALID)
assert parent is None and i == len(siblings) - 1
assert "cannot preserve" not in result.output
assert "id:: propert" not in result.output


class TestIdLinesAsLogseqReadsThem:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_keep_ids_every_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_with_keep_ids_the_id_is_kept_even_at_top_level(self, name):
assert _ids_asked_for(api) == [ID]
page, _, _, parent = api.graph.locate(ID)
assert parent is None
assert "cannot preserve" not in r.stderr
assert "id:: propert" not in r.stderr

def test_an_id_that_already_exists_is_refused_before_any_write(self, name):
api = _api(existing_ids=[ID])
Expand Down
13 changes: 13 additions & 0 deletions tests/test_read_errors_are_not_empty.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ def test_get_page_stats_does_not_report_zero_inbound_links_after_an_error():
assert json.loads(result.stderr)["backlinks_unread"] == ["Alpha"]


def test_get_page_stats_reports_the_inbound_count_when_the_scan_can_read_every_page():
"""The twin of the test above, and what keeps its ``"inbound_count" not in``
from going blind: were the field renamed, only a test that expects it
present would notice."""
api = _api("nobody") # no page fails to read
api.get_page_linked_references.side_effect = RuntimeError("HTTP 500") # falls back to the scan
result = _run(api, "get-page-stats", "--page", "Alpha")
assert result.exit_code == 0, result.stderr
stats = json.loads(result.stdout)
assert stats["inbound_links"] == sorted([JOURNAL, "Beta"])
assert stats["inbound_count"] == 2


@pytest.mark.parametrize("command", [
["analyze-graph"],
["find-knowledge-gaps"],
Expand Down
Loading