Skip to content

Commit

Permalink
fix: update ClientRoutes.test.js and Menu.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavkparti committed Jul 19, 2023
1 parent ab9b2de commit af3bbeb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
17 changes: 13 additions & 4 deletions src/components/Routes/ClientRoutes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ import ClientRoutes from './ClientRoutes';
import { render, screen } from '@testing-library/react';
import { ThemeProvider } from '@mui/material';
import theme from '../UI/theme';
import AuthProvider from '../../store/AuthProvider';
import AuthContext from '../../store/auth-context';


describe('ClientRoutes component', () => {

const TestWrapper = (props) => {
return <ThemeProvider theme={theme}>
<Router>{props.children}</Router>
<Router>
<AuthContext.Provider value={{ isLoggedIn: true }}>
{props.children}
</AuthContext.Provider>
</Router>
</ThemeProvider>
;
};
Expand All @@ -27,9 +34,11 @@ describe('ClientRoutes component', () => {
await screen.findAllByRole('link');
await screen.findByAltText(/Greenstand logo/);

//Logo, Home and Send Tokens for now
expect(screen.getAllByRole('link')).toHaveLength(4);
expect(screen.getAllByRole('button')).toHaveLength(3);
// screen.getByRole('');

//Logo, Home, Send Tokens, and My Trasnfers for now
expect(await screen.findAllByRole('link')).toHaveLength(4);
expect(screen.getAllByRole('button')).toHaveLength(4);

expect(screen.getByText(/Home/)).toBeInTheDocument();
expect(screen.getByText(/Send Tokens/)).toBeInTheDocument();
Expand Down
12 changes: 6 additions & 6 deletions src/components/layout/Menu/Menu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ describe('Menu component', () => {
await screen.findAllByRole('link');
await screen.findByAltText(/Greenstand logo/);

//Logo, Home and Send Tokens for now
expect(screen.getAllByRole('link')).toHaveLength(3);
expect(screen.getAllByRole('button')).toHaveLength(4);

expect(screen.getByText(/Home/)).toBeInTheDocument();
expect(screen.getByText(/Send Tokens/)).toBeInTheDocument();
//Logo, Home, Send Tokens, My Transfers for now
expect(screen.getAllByRole('link')).toHaveLength(4);
expect(screen.getAllByRole('button')).toHaveLength(5);
expect(screen.getByRole('button', {
name: /open drawer/,
})).toBeInTheDocument();

expect(screen.getByText(/Home/)).toBeInTheDocument();
expect(screen.getByText(/Send Tokens/)).toBeInTheDocument();
expect(screen.getByText(/My Transfers/)).toBeInTheDocument();
});
});

0 comments on commit af3bbeb

Please sign in to comment.