Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(test): assert hop one end-to-end and hop two at source level\n\nCI failed with 'expected /settings/integrations to be /connections'. The test\nasserted the END of the two-hop chain, but it mocks `./pages/Settings`, so the\nsettings route table that owns hop two never renders — the chain can only reach\n/settings/integrations.\n\nUn-mocking Settings is not the fix: `settingsRouteElements.tsx` eagerly imports\nall 34 panels, so a route test would pull the whole settings tree in.\n\nHop one is now asserted end-to-end (search and hash both survive), and hop two\nis pinned by reading the route table for `ForwardSearch` — the same technique\nAppRoutes.redirects.test.tsx uses. A revert to a bare <Navigate> on either hop\nstill fails.\n\nVerified by reading, not executed.\n

M3gA-Mindbbc12352cc48
diff --git a/app/src/AppRoutes.webhooks.test.tsx b/app/src/AppRoutes.webhooks.test.tsx
index 23489a9aac..23fba102f4 100644
--- a/app/src/AppRoutes.webhooks.test.tsx
+++ b/app/src/AppRoutes.webhooks.test.tsx
@@ -63,11 +63,18 @@ const AppRoutes = (await import('./AppRoutes')).default;
* `/webhooks?tab=inbound#delivery-3` arrived at a bare `/connections`.
*
* Fixing only the first hop would not have been enough: the fragment would have
- * reached `/settings/integrations` and been dropped by the second. These tests
- * assert the end of the chain, so they fail if EITHER hop regresses.
+ * reached `/settings/integrations` and been dropped by the second.
+ *
+ * These tests assert HOP ONE end-to-end, and hop two at the source level.
+ * They cannot render hop two: it lives in `settingsRouteElements.tsx`, which
+ * eagerly imports all 34 settings panels, so pulling it into a route test drags
+ * the whole settings tree in. `./pages/Settings` is mocked here precisely to
+ * avoid that — which means the rendered chain stops at `/settings/integrations`.
+ * The second hop is therefore pinned by reading the route table, the same
+ * technique `AppRoutes.redirects.test.tsx` uses.
*/
describe('/webhooks two-hop back-compat redirect', () => {
- it('lands on /connections', () => {
+ it('lands on /settings/integrations (hop one)', () => {
const loc = { pathname: '', search: '', hash: '' };
render(
<MemoryRouter initialEntries={['/webhooks']}>
@@ -75,7 +82,7 @@ describe('/webhooks two-hop back-compat redirect', () => {
<LocationSpy onCapture={l => Object.assign(loc, l)} />
</MemoryRouter>
);
- expect(loc.pathname).toBe('/connections');
+ expect(loc.pathname).toBe('/settings/integrations');
});
it('carries a query string across both hops', () => {
@@ -86,7 +93,7 @@ describe('/webhooks two-hop back-compat redirect', () => {
<LocationSpy onCapture={l => Object.assign(loc, l)} />
</MemoryRouter>
);
- expect(loc.pathname).toBe('/connections');
+ expect(loc.pathname).toBe('/settings/integrations');
expect(loc.search).toBe('?tab=inbound');
});
@@ -99,7 +106,7 @@ describe('/webhooks two-hop back-compat redirect', () => {
<LocationSpy onCapture={l => Object.assign(loc, l)} />
</MemoryRouter>
);
- expect(loc.pathname).toBe('/connections');
+ expect(loc.pathname).toBe('/settings/integrations');
expect(loc.hash).toBe('#delivery-3');
});
@@ -111,7 +118,7 @@ describe('/webhooks two-hop back-compat redirect', () => {
<LocationSpy onCapture={l => Object.assign(loc, l)} />
</MemoryRouter>
);
- expect(loc.pathname).toBe('/connections');
+ expect(loc.pathname).toBe('/settings/integrations');
expect(loc.search).toBe('?tab=inbound');
expect(loc.hash).toBe('#delivery-3');
});
@@ -125,7 +132,7 @@ describe('/webhooks two-hop back-compat redirect', () => {
<LocationSpy onCapture={l => Object.assign(loc, l)} />
</MemoryRouter>
);
- expect(loc.pathname).toBe('/connections');
+ expect(loc.pathname).toBe('/settings/integrations');
expect(loc.search).toBe('');
expect(loc.hash).toBe('');
});
@@ -140,8 +147,24 @@ describe('/webhooks two-hop back-compat redirect', () => {
<LocationSpy onCapture={l => Object.assign(loc, l)} />
</MemoryRouter>
);
- expect(loc.pathname).toBe('/connections');
+ expect(loc.pathname).toBe('/settings/integrations');
expect(loc.search).toBe('?tab=inbound');
expect(loc.hash).toBe('#delivery-3');
});
+
+ // Hop two, asserted at the source level because it cannot be rendered here.
+ // If someone reverts `settingsRouteElements.tsx` to a bare `<Navigate>`, the
+ // deep link is dropped on the second hop and no rendered test above would see
+ // it — this is what catches that.
+ it('hop two forwards the deep link rather than dropping it', () => {
+ const fs = require('node:fs') as typeof import('node:fs');
+ const path = require('node:path') as typeof import('node:path');
+ const source = fs.readFileSync(
+ path.resolve('src/components/settings/settingsRouteElements.tsx'),
+ 'utf8'
+ );
+ const route = source.match(/<Route\s+path="integrations"[^>]*>/);
+ expect(route, 'the settings `integrations` route should exist').not.toBeNull();
+ expect(route?.[0]).toContain('ForwardSearch');
+ });
});