Skip to content

Commit 4fe85c5

Browse files
committed
fix tests and things
1 parent 5ff6491 commit 4fe85c5

File tree

8 files changed

+36
-35
lines changed

8 files changed

+36
-35
lines changed

exercises/02.linking/01.problem.achors/tests/router.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { test, expect } from '@playwright/test'
22

3-
test('Hello World! should be rendered', async ({ page }) => {
3+
test('gratitext should be rendered', async ({ page }) => {
44
await page.goto('/')
55

6-
const helloWorld = page.getByText(/hello world/i)
7-
await expect(helloWorld).toBeVisible({ timeout: 500 })
6+
const gratitext = page.getByRole('banner').getByText(/gratitext/)
7+
await expect(gratitext).toBeVisible({ timeout: 500 })
88
})
99

1010
test('About should be rendered', async ({ page }) => {

exercises/02.linking/01.solution.achors/tests/router.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { test, expect } from '@playwright/test'
22

3-
test('Hello World! should be rendered', async ({ page }) => {
3+
test('gratitext should be rendered', async ({ page }) => {
44
await page.goto('/')
55

6-
const helloWorld = page.getByText(/hello world/i)
7-
await expect(helloWorld).toBeVisible({ timeout: 500 })
6+
const gratitext = page.getByRole('banner').getByText(/gratitext/)
7+
await expect(gratitext).toBeVisible({ timeout: 500 })
88
})
99

1010
test('About should be rendered', async ({ page }) => {

exercises/02.linking/02.problem.links/tests/router.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { test, expect } from '@playwright/test'
22

3-
test('Hello World! should be rendered', async ({ page }) => {
3+
test('gratitext should be rendered', async ({ page }) => {
44
await page.goto('/')
55

6-
const helloWorld = page.getByText(/hello world/i)
7-
await expect(helloWorld).toBeVisible({ timeout: 500 })
6+
const gratitext = page.getByRole('banner').getByText(/gratitext/)
7+
await expect(gratitext).toBeVisible({ timeout: 500 })
88
})
99

1010
test('About should be rendered', async ({ page }) => {

exercises/02.linking/02.solution.links/tests/router.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { test, expect } from '@playwright/test'
22

3-
test('Hello World! should be rendered', async ({ page }) => {
3+
test('gratitext should be rendered', async ({ page }) => {
44
await page.goto('/')
55

6-
const helloWorld = page.getByText(/hello world/i)
7-
await expect(helloWorld).toBeVisible({ timeout: 500 })
6+
const gratitext = page.getByRole('banner').getByText(/gratitext/)
7+
await expect(gratitext).toBeVisible({ timeout: 500 })
88
})
99

1010
test('About should be rendered', async ({ page }) => {

exercises/02.linking/03.problem.custom-link/tests/router.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { test, expect } from '@playwright/test'
22

3-
test('Hello World! should be rendered', async ({ page }) => {
3+
test('gratitext should be rendered', async ({ page }) => {
44
await page.goto('/')
55

6-
const helloWorld = page.getByText(/hello world/i)
7-
await expect(helloWorld).toBeVisible({ timeout: 500 })
6+
const gratitext = page.getByRole('banner').getByText(/gratitext/)
7+
await expect(gratitext).toBeVisible({ timeout: 500 })
88
})
99

1010
test('About should be rendered', async ({ page }) => {

exercises/02.linking/03.solution.custom-link/tests/router.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { test, expect } from '@playwright/test'
22

3-
test('Hello World! should be rendered', async ({ page }) => {
3+
test('gratitext should be rendered', async ({ page }) => {
44
await page.goto('/')
55

6-
const helloWorld = page.getByText(/hello world/i)
7-
await expect(helloWorld).toBeVisible({ timeout: 500 })
6+
const gratitext = page.getByRole('banner').getByText(/gratitext/)
7+
await expect(gratitext).toBeVisible({ timeout: 500 })
88
})
99

1010
test('About should be rendered', async ({ page }) => {

exercises/99.final/01.solution.final/src/routes.tsx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
createBrowserRouter,
33
createRoutesFromElements,
44
Route,
5-
useRouteError,
65
} from 'react-router'
76
import { NotFoundRoute } from './routes/404.tsx'
87
import { AppLayout } from './routes/app/layout.tsx'
@@ -15,6 +14,7 @@ import {
1514
RecipientRoute,
1615
} from './routes/app/recipient.tsx'
1716
import { RecipientsRoute } from './routes/app/recipients.tsx'
17+
import { UnknownErrorBoundary } from './routes/error-boundary.tsx'
1818
import { SignupRoute } from './routes/signup.tsx'
1919

2020
export const router = createBrowserRouter(
@@ -38,19 +38,3 @@ export const router = createBrowserRouter(
3838
</Route>,
3939
),
4040
)
41-
42-
function UnknownErrorBoundary() {
43-
const error = useRouteError()
44-
45-
return (
46-
<div className="bg-danger-background text-danger-foreground mt-20 flex h-full flex-col items-center justify-center px-8 py-12">
47-
<h1 className="text-2xl font-bold">Unknown error</h1>
48-
<p className="text-danger-foreground/80 text-sm">
49-
An unknown error occurred. Please try again later.
50-
</p>
51-
<pre className="text-danger-foreground/80 bg-danger-foreground/10 mt-4 max-h-[50vh] overflow-auto rounded-lg p-4 text-sm break-all whitespace-break-spaces">
52-
{error instanceof Error ? error.message : 'Unknown error'}
53-
</pre>
54-
</div>
55-
)
56-
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { useRouteError } from 'react-router'
2+
3+
export function UnknownErrorBoundary() {
4+
const error = useRouteError()
5+
6+
return (
7+
<div className="bg-danger-background text-danger-foreground mt-20 flex h-full flex-col items-center justify-center px-8 py-12">
8+
<h1 className="text-2xl font-bold">Unknown error</h1>
9+
<p className="text-danger-foreground/80 text-sm">
10+
An unknown error occurred. Please try again later.
11+
</p>
12+
<pre className="text-danger-foreground/80 bg-danger-foreground/10 mt-4 max-h-[50vh] overflow-auto rounded-lg p-4 text-sm break-all whitespace-break-spaces">
13+
{error instanceof Error ? error.message : 'Unknown error'}
14+
</pre>
15+
</div>
16+
)
17+
}

0 commit comments

Comments
 (0)