refactor(frontend): centralize subdirectory URL prefixing behind nav helpers (#39925)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Evan <evan@preset.io>
This commit is contained in:
Joe Li
2026-07-01 11:20:13 -07:00
committed by GitHub
parent b7d5de8e52
commit bed1034c2f
200 changed files with 9886 additions and 659 deletions

View File

@@ -26,6 +26,9 @@ const PERMALINK_PAYLOAD = {
key: '123',
url: 'http://fakeurl.com/123',
};
// rewritePermalinkOrigin substitutes window.location.origin (jsdom: http://localhost)
// for the permalink's origin while preserving the path. See urlUtils.ts.
const REWRITTEN_URL = `${window.location.origin}/123`;
const FILTER_STATE_PAYLOAD = {
value: '{}',
};
@@ -58,9 +61,7 @@ test('renders overlay on click', async () => {
test('obtains short url', async () => {
render(<URLShortLinkButton {...props} />, { useRedux: true });
userEvent.click(screen.getByRole('button'));
expect(await screen.findByRole('tooltip')).toHaveTextContent(
PERMALINK_PAYLOAD.url,
);
expect(await screen.findByRole('tooltip')).toHaveTextContent(REWRITTEN_URL);
});
test('creates email anchor', async () => {
@@ -78,7 +79,7 @@ test('creates email anchor', async () => {
},
);
const href = `mailto:?Subject=${subject}%20&Body=${content}${PERMALINK_PAYLOAD.url}`;
const href = `mailto:?Subject=${subject}%20&Body=${content}${REWRITTEN_URL}`;
userEvent.click(screen.getByRole('button'));
expect(await screen.findByRole('link')).toHaveAttribute('href', href);
});