Skip to content

Commit 8e81fed

Browse files
committed
Update tests
1 parent 58d5667 commit 8e81fed

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

packages/react-router/__tests__/useHref-test.tsx

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as TestRenderer from "react-test-renderer";
33
import { MemoryRouter, Routes, Route, useHref } from "react-router";
44

55
function ShowHref({ to }: { to: string }) {
6-
return <p>{useHref(to)}</p>;
6+
return <pre>{useHref(to)}</pre>;
77
}
88

99
describe("useHref", () => {
@@ -24,9 +24,9 @@ describe("useHref", () => {
2424
});
2525

2626
expect(renderer.toJSON()).toMatchInlineSnapshot(`
27-
<p>
27+
<pre>
2828
/courses/advanced-react
29-
</p>
29+
</pre>
3030
`);
3131
});
3232

@@ -47,9 +47,9 @@ describe("useHref", () => {
4747
});
4848

4949
expect(renderer.toJSON()).toMatchInlineSnapshot(`
50-
<p>
50+
<pre>
5151
/courses/advanced-react
52-
</p>
52+
</pre>
5353
`);
5454
});
5555
});
@@ -71,9 +71,9 @@ describe("useHref", () => {
7171
});
7272

7373
expect(renderer.toJSON()).toMatchInlineSnapshot(`
74-
<p>
74+
<pre>
7575
/courses/advanced-react/
76-
</p>
76+
</pre>
7777
`);
7878
});
7979
});
@@ -93,9 +93,9 @@ describe("useHref", () => {
9393
});
9494

9595
expect(renderer.toJSON()).toMatchInlineSnapshot(`
96-
<p>
96+
<pre>
9797
/about
98-
</p>
98+
</pre>
9999
`);
100100
});
101101

@@ -113,9 +113,9 @@ describe("useHref", () => {
113113
});
114114

115115
expect(renderer.toJSON()).toMatchInlineSnapshot(`
116-
<p>
116+
<pre>
117117
/about
118-
</p>
118+
</pre>
119119
`);
120120
});
121121
});
@@ -134,9 +134,9 @@ describe("useHref", () => {
134134
});
135135

136136
expect(renderer.toJSON()).toMatchInlineSnapshot(`
137-
<p>
137+
<pre>
138138
/about/
139-
</p>
139+
</pre>
140140
`);
141141
});
142142
});
@@ -158,9 +158,9 @@ describe("useHref", () => {
158158
});
159159

160160
expect(renderer.toJSON()).toMatchInlineSnapshot(`
161-
<p>
161+
<pre>
162162
/courses
163-
</p>
163+
</pre>
164164
`);
165165
});
166166

@@ -180,9 +180,9 @@ describe("useHref", () => {
180180
});
181181

182182
expect(renderer.toJSON()).toMatchInlineSnapshot(`
183-
<p>
183+
<pre>
184184
/courses
185-
</p>
185+
</pre>
186186
`);
187187
});
188188
});
@@ -206,9 +206,9 @@ describe("useHref", () => {
206206
});
207207

208208
expect(renderer.toJSON()).toMatchInlineSnapshot(`
209-
<p>
209+
<pre>
210210
/courses/
211-
</p>
211+
</pre>
212212
`);
213213
});
214214
});
@@ -231,9 +231,9 @@ describe("useHref", () => {
231231
});
232232

233233
expect(renderer.toJSON()).toMatchInlineSnapshot(`
234-
<p>
234+
<pre>
235235
/users
236-
</p>
236+
</pre>
237237
`);
238238
});
239239
});
@@ -257,9 +257,9 @@ describe("useHref", () => {
257257
});
258258

259259
expect(renderer.toJSON()).toMatchInlineSnapshot(`
260-
<p>
260+
<pre>
261261
/courses
262-
</p>
262+
</pre>
263263
`);
264264
});
265265

@@ -277,9 +277,9 @@ describe("useHref", () => {
277277
});
278278

279279
expect(renderer.toJSON()).toMatchInlineSnapshot(`
280-
<p>
280+
<pre>
281281
/
282-
</p>
282+
</pre>
283283
`);
284284
});
285285
});

packages/react-router/__tests__/useLocation-test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import * as React from "react";
22
import * as TestRenderer from "react-test-renderer";
33
import { MemoryRouter, Routes, Route, useLocation } from "react-router";
44

5+
function ShowPath() {
6+
let { pathname, search, hash } = useLocation();
7+
return <pre>{JSON.stringify({ pathname, search, hash })}</pre>;
8+
}
9+
510
describe("useLocation", () => {
611
it("returns the current location object", () => {
7-
function Home() {
8-
let { pathname, search, hash } = useLocation();
9-
return <pre>{JSON.stringify({ pathname, search, hash })}</pre>;
10-
}
11-
1212
let renderer: TestRenderer.ReactTestRenderer;
1313
TestRenderer.act(() => {
1414
renderer = TestRenderer.create(
1515
<MemoryRouter initialEntries={["/home?the=search#the-hash"]}>
1616
<Routes>
17-
<Route path="/home" element={<Home />} />
17+
<Route path="/home" element={<ShowPath />} />
1818
</Routes>
1919
</MemoryRouter>
2020
);

0 commit comments

Comments
 (0)