Skip to content

Commit

Permalink
Merge branch 'main' into ai-prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
jbouder committed Jul 31, 2024
2 parents dea6f0a + 8aaceb1 commit 1e28c27
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 55 deletions.
52 changes: 0 additions & 52 deletions src/components/header/header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { BrowserRouter } from 'react-router-dom';

import { AuthProvider } from 'react-oidc-context';
import { RecoilRoot } from 'recoil';
import * as useAuthMock from '../../hooks/use-auth';
import { User } from '../../types/user';
import { Header } from './header';

describe('Header', () => {
Expand All @@ -26,56 +24,6 @@ describe('Header', () => {
});
});

test('should navigate away from home', async () => {
vi.spyOn(useAuthMock, 'default').mockReturnValue({
isSignedIn: true,
isLoading: false,
currentUserData: {} as User,
error: null,
signIn: vi.fn(),
signOut: vi.fn(),
});

render(headerComponent);

await userEvent.click(screen.getByText('Dashboard', { selector: 'a' }));
expect(window.location.pathname).toBe('/dashboard');
});

test('should handle sign in', async () => {
vi.spyOn(useAuthMock, 'default').mockReturnValue({
isSignedIn: false,
isLoading: false,
currentUserData: {} as User,
error: null,
signIn: vi.fn(),
signOut: vi.fn(),
});

const { baseElement } = render(headerComponent);
await act(async () => {
expect(baseElement).toBeTruthy();
fireEvent.click(screen.getByText('Sign In'));
});
});

test('should handle sign out', async () => {
vi.spyOn(useAuthMock, 'default').mockReturnValue({
isSignedIn: true,
isLoading: false,
currentUserData: {} as User,
error: null,
signIn: vi.fn(),
signOut: vi.fn(),
});

const { baseElement } = render(headerComponent);
await act(async () => {
expect(baseElement).toBeTruthy();
fireEvent.click(screen.getByText('Sign Out'));
});
});

test('should display menu when button is clicked', async () => {
vi.spyOn(window, 'scrollTo').mockImplementation(() => {});
const { baseElement } = render(headerComponent);
Expand Down
3 changes: 0 additions & 3 deletions src/components/search/search.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ describe('Search', () => {
const { baseElement } = render(componentWrapper);
await act(async () => {
expect(baseElement).toBeTruthy();
expect(baseElement.querySelector('h1')?.textContent).toEqual(
'Search Results',
);
});
});
});

0 comments on commit 1e28c27

Please sign in to comment.