Skip to content

Commit c00ea27

Browse files
authored
test(query-devtools/{DevtoolsComponent,DevtoolsPanelComponent}): add tests for rendering with all props (#10752)
1 parent fe54a9c commit c00ea27

2 files changed

Lines changed: 42 additions & 2 deletions

File tree

packages/query-devtools/src/__tests__/DevtoolsComponent.test.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('DevtoolsComponent', () => {
6161
queryClient.clear()
6262
})
6363

64-
it('should render without throwing', () => {
64+
it('should render without throwing when only required props are provided', () => {
6565
expect(() =>
6666
render(() => (
6767
<DevtoolsComponent
@@ -73,4 +73,25 @@ describe('DevtoolsComponent', () => {
7373
)),
7474
).not.toThrow()
7575
})
76+
77+
it('should render without throwing when all props are provided', () => {
78+
expect(() =>
79+
render(() => (
80+
<DevtoolsComponent
81+
client={queryClient}
82+
queryFlavor="TanStack Query"
83+
version="5"
84+
onlineManager={onlineManager}
85+
buttonPosition="top-left"
86+
position="left"
87+
initialIsOpen={true}
88+
errorTypes={[
89+
{ name: 'NetworkError', initializer: () => new Error('Network') },
90+
]}
91+
hideDisabledQueries={true}
92+
theme="dark"
93+
/>
94+
)),
95+
).not.toThrow()
96+
})
7697
})

packages/query-devtools/src/__tests__/DevtoolsPanelComponent.test.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('DevtoolsPanelComponent', () => {
7777
document.documentElement.style.fontSize = previousRootFontSize
7878
})
7979

80-
it('should render the panel without throwing', () => {
80+
it('should render the panel without throwing when only required props are provided', () => {
8181
expect(() =>
8282
render(() => (
8383
<DevtoolsPanelComponent
@@ -90,6 +90,25 @@ describe('DevtoolsPanelComponent', () => {
9090
).not.toThrow()
9191
})
9292

93+
it('should render the panel without throwing when all props are provided', () => {
94+
expect(() =>
95+
render(() => (
96+
<DevtoolsPanelComponent
97+
client={queryClient}
98+
queryFlavor="TanStack Query"
99+
version="5"
100+
onlineManager={onlineManager}
101+
errorTypes={[
102+
{ name: 'NetworkError', initializer: () => new Error('Network') },
103+
]}
104+
hideDisabledQueries={true}
105+
theme="dark"
106+
onClose={() => {}}
107+
/>
108+
)),
109+
).not.toThrow()
110+
})
111+
93112
it('should not render the open devtools button in panel-only mode', () => {
94113
const rendered = render(() => (
95114
<DevtoolsPanelComponent

0 commit comments

Comments
 (0)