Skip to content

Commit

Permalink
fix: add StickyProvider to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nunogois committed Oct 18, 2023
1 parent a2e559a commit 48394f2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
17 changes: 11 additions & 6 deletions frontend/src/component/changeRequest/ChangeRequest.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AccessProvider } from '../providers/AccessProvider/AccessProvider';
import { AnnouncerProvider } from '../common/Announcer/AnnouncerProvider/AnnouncerProvider';
import { testServerRoute, testServerSetup } from '../../utils/testServer';
import { UIProviderContainer } from '../providers/UIProvider/UIProviderContainer';
import { StickyProvider } from 'component/common/Sticky/StickyProvider';

const server = testServerSetup();

Expand Down Expand Up @@ -227,12 +228,16 @@ const UnleashUiSetup: FC<{ path: string; pathTemplate: string }> = ({
<MemoryRouter initialEntries={[path]}>
<ThemeProvider>
<AnnouncerProvider>
<Routes>
<Route
path={pathTemplate}
element={<MainLayout>{children}</MainLayout>}
/>
</Routes>
<StickyProvider>
<Routes>
<Route
path={pathTemplate}
element={
<MainLayout>{children}</MainLayout>
}
/>
</Routes>
</StickyProvider>
</AnnouncerProvider>
</ThemeProvider>
</MemoryRouter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FC } from 'react';
import { IPermission } from '../../interfaces/user';
import { SWRConfig } from 'swr';
import { ProjectMode } from '../project/Project/hooks/useProjectEnterpriseSettingsForm';
import { StickyProvider } from 'component/common/Sticky/StickyProvider';

const server = testServerSetup();

Expand Down Expand Up @@ -186,9 +187,14 @@ const UnleashUiSetup: FC<{ path: string; pathTemplate: string }> = ({
<MemoryRouter initialEntries={[path]}>
<ThemeProvider>
<AnnouncerProvider>
<Routes>
<Route path={pathTemplate} element={children} />
</Routes>
<StickyProvider>
<Routes>
<Route
path={pathTemplate}
element={children}
/>
</Routes>
</StickyProvider>
</AnnouncerProvider>
</ThemeProvider>
</MemoryRouter>
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,14 @@ import '@testing-library/jest-dom';
import 'whatwg-fetch';
import 'regenerator-runtime';

class ResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
}

if (!window.ResizeObserver) {
window.ResizeObserver = ResizeObserver;
}

process.env.TZ = 'UTC';

0 comments on commit 48394f2

Please sign in to comment.