From 4e0c0d615c3915c485697a7db580d985de77fde5 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Mon, 7 Sep 2026 02:05:56 +0200 Subject: test(hub): the folder-name test was reading the ".." row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `test_a_folder_name_carries_no_trailing_slash` sliced from the first `dir-row` in files-app.js. Since the parent-directory row was added, that is the ".." row, whose only cell is an ellipsis — so the slice contained no `${d}` and the test failed on a name it had never looked at. The directory row itself has always rendered `${d}` with no trailing slash. Anchored on `key=${full}` instead, with an assertion that the anchor still lands on a `dir-row` so the next move fails loudly rather than silently reading the wrong markup again. Pre-existing: it fails the same way on main. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_011pvMdvLBG92jyhvD5pD6us --- packages/meshbay-hub/tests/test_transfers.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/meshbay-hub/tests/test_transfers.py b/packages/meshbay-hub/tests/test_transfers.py index 86d58cd..3316615 100644 --- a/packages/meshbay-hub/tests/test_transfers.py +++ b/packages/meshbay-hub/tests/test_transfers.py @@ -208,9 +208,17 @@ def test_the_colour_is_defined_for_that_mark(): # ── The file list ─────────────────────────────────────────────────────────── def test_a_folder_name_carries_no_trailing_slash(): - """The folder icon in the cell beside it already says what it is.""" + """ + The folder icon in the cell beside it already says what it is. + + Anchored on `key=${full}`, which is the row that renders a directory. The + first `dir-row` in the file is the ".." row added later, whose only cell is + an ellipsis — slicing from there found no `${d}` and failed on a name it + had never looked at. + """ source = STATIC.joinpath("files-app.js").read_text(encoding="utf-8") - row = source[source.index('class="file-row dir-row"'):] - row = row[:row.index("")] + start = source.rindex("", start)] + assert "dir-row" in row, "the anchor no longer lands on the directory row" assert "${d}/" not in row, "the folder name is rendered with a trailing slash" assert "${d}" in row -- cgit v1.2.3