/** @format */ import React, { ReactNode } from 'react' import SiteContextProvider, { PlausibleSite } from '../js/dashboard/site-context' import UserContextProvider, { Role } from '../js/dashboard/user-context' import { MemoryRouter, MemoryRouterProps } from 'react-router-dom' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import QueryContextProvider from '../js/dashboard/query-context' import { getRouterBasepath } from '../js/dashboard/router' type TestContextProvidersProps = { children: ReactNode routerProps?: Pick siteOptions?: Partial } export const TestContextProviders = ({ children, routerProps, siteOptions }: TestContextProvidersProps) => { const defaultSite: PlausibleSite = { domain: 'plausible.io/unit', offset: 0, hasGoals: false, hasProps: false, funnelsAvailable: false, propsAvailable: false, conversionsOptedOut: false, funnelsOptedOut: false, propsOptedOut: false, revenueGoals: [], funnels: [], statsBegin: '', nativeStatsBegin: '', embedded: false, background: '', isDbip: false, flags: {}, validIntervalsByPeriod: {}, shared: false } const site = { ...defaultSite, ...siteOptions } const queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false } } }) const defaultInitialEntries = [getRouterBasepath(site)] return ( // not interactive component, default value is suitable {children} // ) }