mkstack/src/test/TestApp.tsx

45 lines
1.3 KiB
TypeScript
Raw Normal View History

import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
2025-06-07 15:13:00 -05:00
import { createHead, UnheadProvider } from '@unhead/react/client';
import { BrowserRouter } from 'react-router-dom';
import { NostrLoginProvider } from '@nostrify/react/login';
import NostrProvider from '@/components/NostrProvider';
2025-06-02 21:44:52 -05:00
import { AppProvider } from '@/components/AppProvider';
2025-06-04 10:04:39 -05:00
import { AppConfig } from '@/contexts/AppContext';
interface TestAppProps {
children: React.ReactNode;
}
export function TestApp({ children }: TestAppProps) {
2025-06-07 15:13:00 -05:00
const head = createHead();
const queryClient = new QueryClient({
defaultOptions: {
queries: { retry: false },
mutations: { retry: false },
},
});
2025-06-04 10:04:39 -05:00
const defaultConfig: AppConfig = {
theme: 'light',
relayUrl: 'wss://relay.nostr.band',
};
return (
2025-06-07 15:13:00 -05:00
<UnheadProvider head={head}>
2025-06-04 10:04:39 -05:00
<AppProvider storageKey='test-app-config' defaultConfig={defaultConfig}>
2025-06-02 21:44:52 -05:00
<QueryClientProvider client={queryClient}>
<NostrLoginProvider storageKey='test-login'>
<NostrProvider>
2025-06-07 15:13:00 -05:00
<BrowserRouter>
{children}
</BrowserRouter>
2025-06-02 21:44:52 -05:00
</NostrProvider>
</NostrLoginProvider>
</QueryClientProvider>
</AppProvider>
2025-06-07 15:13:00 -05:00
</UnheadProvider>
);
}
export default TestApp;