Skip to content

Commit dfc6ebf

Browse files
committed
Test default prefetch
1 parent 9f897cc commit dfc6ebf

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

src/shared/ContentsTable/TableEntries/BaseEntries/DirEntry.test.tsx

+3-23
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,8 @@ const wrapper: React.FC<React.PropsWithChildren> = ({ children }) => (
1212

1313
describe('DirEntry', () => {
1414
it('displays the directory name', () => {
15-
const runPrefetchMock = vi.fn()
1615
render(
17-
<DirEntry
18-
linkRef="branch"
19-
name="dir"
20-
urlPath="path/to/directory"
21-
runPrefetch={runPrefetchMock}
22-
/>,
16+
<DirEntry linkRef="branch" name="dir" urlPath="path/to/directory" />,
2317
{ wrapper }
2418
)
2519

@@ -29,14 +23,8 @@ describe('DirEntry', () => {
2923

3024
describe('path is given', () => {
3125
it('sets the correct href', () => {
32-
const runPrefetchMock = vi.fn()
3326
render(
34-
<DirEntry
35-
linkRef="branch"
36-
name="dir"
37-
urlPath="path/to/directory"
38-
runPrefetch={runPrefetchMock}
39-
/>,
27+
<DirEntry linkRef="branch" name="dir" urlPath="path/to/directory" />,
4028
{ wrapper }
4129
)
4230

@@ -50,11 +38,7 @@ describe('DirEntry', () => {
5038

5139
describe('no path is given', () => {
5240
it('sets the correct href', () => {
53-
const runPrefetchMock = vi.fn()
54-
render(
55-
<DirEntry linkRef="branch" name="dir" runPrefetch={runPrefetchMock} />,
56-
{ wrapper }
57-
)
41+
render(<DirEntry linkRef="branch" name="dir" />, { wrapper })
5842

5943
const a = screen.getByRole('link')
6044
expect(a).toHaveAttribute('href', '/gh/codecov/test-repo/tree/branch/dir')
@@ -63,12 +47,10 @@ describe('DirEntry', () => {
6347

6448
describe('query params value is passed', () => {
6549
it('sets the correct href', () => {
66-
const runPrefetchMock = vi.fn()
6750
render(
6851
<DirEntry
6952
linkRef="branch"
7053
name="dir"
71-
runPrefetch={runPrefetchMock}
7254
queryParams={{ flags: ['flag-1'] }}
7355
/>,
7456
{ wrapper }
@@ -102,13 +84,11 @@ describe('DirEntry', () => {
10284

10385
describe('pageName prop is passed', () => {
10486
it('sets the correct href', () => {
105-
const runPrefetchMock = vi.fn()
10687
render(
10788
<DirEntry
10889
commitSha="coolCommitSha"
10990
name="dir"
11091
urlPath="path/to/directory"
111-
runPrefetch={runPrefetchMock}
11292
pageName="commitTreeView"
11393
/>,
11494
{ wrapper }

0 commit comments

Comments
 (0)