@@ -28,7 +28,11 @@ describe('Explorer', () => {
2828 queryClient . clear ( )
2929 } )
3030
31- function renderExplorer ( props : Parameters < typeof Explorer > [ 0 ] ) {
31+ function renderExplorer (
32+ props : Parameters < typeof Explorer > [ 0 ] ,
33+ options : { theme ?: 'dark' | 'light' } = { } ,
34+ ) {
35+ const theme = options . theme ?? 'dark'
3236 return render ( ( ) => (
3337 < QueryDevtoolsContext . Provider
3438 value = { {
@@ -38,7 +42,7 @@ describe('Explorer', () => {
3842 onlineManager,
3943 } }
4044 >
41- < ThemeContext . Provider value = { ( ) => 'dark' } >
45+ < ThemeContext . Provider value = { ( ) => theme } >
4246 < Explorer { ...props } />
4347 </ ThemeContext . Provider >
4448 </ QueryDevtoolsContext . Provider >
@@ -562,4 +566,26 @@ describe('Explorer', () => {
562566 expect ( queryClient . getQueryData ( [ 'data' ] ) ) . toEqual ( { } )
563567 } )
564568 } )
569+
570+ describe ( 'theme' , ( ) => {
571+ it ( 'should render without throwing under the "light" theme' , ( ) => {
572+ const value = { items : [ 'a' ] , flag : true }
573+ queryClient . setQueryData ( [ 'data' ] , value )
574+
575+ expect ( ( ) =>
576+ renderExplorer (
577+ {
578+ label : 'Data' ,
579+ value,
580+ defaultExpanded : [ 'Data' ] ,
581+ editable : true ,
582+ activeQuery : queryClient
583+ . getQueryCache ( )
584+ . find ( { queryKey : [ 'data' ] } ) as Query ,
585+ } ,
586+ { theme : 'light' } ,
587+ ) ,
588+ ) . not . toThrow ( )
589+ } )
590+ } )
565591} )
0 commit comments