[segment cache]: fix trailingSlash handling with output: export (#84465)
When `output: export`, `experimental.clientSegmentCache`, and
`trailingSlash: true` were all enabled, clicking links would update the
URL but fail to render the page content. The issue was in how segment
cache URLs were being constructed for static export mode.
When a URL had a trailing slash (like /another/), the code tried to
strip it using `substring(0, -1)`. However, substring() treats negative
indices as 0, so this became `substring(0, 0)` and returned an empty
string. This meant URLs like /another/ would generate segment requests
to `/__next._tree.txt` instead of `/another/__next._tree.txt`.
I also updated the brittle snapshot-like tests that were in here as well
since we output more files with segment cache. I don't think this type
of test adds that much value but didn't want to change any test
behavior.