diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-07 02:05:56 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-07 02:05:56 +0200 |
| commit | 4e0c0d615c3915c485697a7db580d985de77fde5 (patch) | |
| tree | bf505fd6cc6b7fc7064805b1dd30e89b2da8ebaf /packages/meshbay-hub/tests | |
| parent | fbcb3461c5bfc0f9b902287896d655da6f0bfcd0 (diff) | |
| download | meshbay-4e0c0d615c3915c485697a7db580d985de77fde5.tar.gz | |
test(hub): the folder-name test was reading the ".." row
`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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011pvMdvLBG92jyhvD5pD6us
Diffstat (limited to 'packages/meshbay-hub/tests')
| -rw-r--r-- | packages/meshbay-hub/tests/test_transfers.py | 14 |
1 files changed, 11 insertions, 3 deletions
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("</tr>")] + start = source.rindex("<tr", 0, source.index("key=${full}")) + row = source[start:source.index("</tr>", 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 |