Skip to content

Commit

Permalink
fixed account test
Browse files Browse the repository at this point in the history
  • Loading branch information
mcjoynt committed Apr 29, 2021
1 parent 02009cb commit bc0220b
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions client/src/test/Account.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,36 @@ import { render, screen } from '@testing-library/react';
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';
import store from '../store';
import configureStore from 'redux-mock-store';
import Account from '../components/account/Account';

const mockStore = configureStore([]);

const authenticatedStore = mockStore({
auth: {
token: localStorage.getItem('token'),
isAuthenticated: true,
user: {
first_name: 'Matt',
last_name: 'McJoynt',
username: 'mcjoynt',
email: 'user@email.com',
phone_number: '1234567890',
old_password: '123abc',
new_password: '1234abc',
confirmed_newpassword: '1234abc'
},
loading: false,
}
});

test('renders without crashing', () => {
render(
<Provider store={store}>
<Provider store={authenticatedStore}>
<BrowserRouter>
<Account />
</BrowserRouter>
</Provider>
);
// expect(screen.getByText('Account Update')).toBeInTheDocument();
expect(screen.getByText('Account Update')).toBeInTheDocument();
});

0 comments on commit bc0220b

Please sign in to comment.