Skip to content

Commit 65e0da4

Browse files
committed
test(remix): Cover route resolution through the route provider
1 parent 11bfbeb commit 65e0da4

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as Sentry from '@sentry/remix';
2+
import { useEffect, useState } from 'react';
3+
4+
export default function RouteProvider() {
5+
const [route, setRoute] = useState<string>();
6+
7+
useEffect(() => {
8+
setRoute(Sentry.resolveCurrentRoute() ?? 'unresolved');
9+
}, []);
10+
11+
return <div id="resolved-route">{route}</div>;
12+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { expect, test } from '@playwright/test';
2+
3+
// The route provider is backed by the manifest the Vite plugin injects into the client bundle, so this
4+
// fails if that manifest never reaches the browser.
5+
test('resolves the parameterized route through the route provider', async ({ page }) => {
6+
await page.goto('/route-provider/123');
7+
8+
await expect(page.locator('#resolved-route')).toHaveText('/route-provider/:id');
9+
});

0 commit comments

Comments
 (0)