<repo_name>chuckdishmon/patrick-temp<file_sep>/src/reducers/user/user.test.js
import * as types from '../../ActionTypes';
import users from './';

const unauthState = { status: 'UNAUTH', access: 'guest' };

it('should be defined', () => {
	expect(users).not.toBe(undefined);
});

it('should initialize state if left undefined', () => {
	const action = { type: '@@INIT' };
	const nextState = users(undefined, action);
	expect(nextState).toEqual(unauthState);
});

it('should subscribe to LOGIN_SUCCESS and add user details', () => {
	const prevState = { status: 'PENDING' };
	const action = {
		type: 'LOGIN_SUCCESS',
		user: {
			name: 'Pat',
			access: 'admin',
			token: '<PASSWORD>'
		}
	};
	const expectedState = {
		...action.user,
		status: 'AUTH'
	};
	const nextState = users(prevState, action);
	expect(nextState).toEqual(expectedState);
});

it('should subscribe to LOGIN_PENDING and update user status', () => {
	const prevState = unauthState;
	const action = {
		type: 'LOGIN_PENDING'
	};
	const expectedState = {
		status: 'PENDING'
	};
	const nextState = users(prevState, action);
	expect(nextState).toEqual(expectedState);
});

it('should subscribe to LOGIN_FAILURE and update user status', () => {
	const prevState = { status: 'PENDING' };
	const action = {
		type: 'LOGIN_FAILURE'
	};
	const nextState = users(prevState, action);
	expect(nextState).toEqual(unauthState);
});
<file_sep>/src/containers/RSVPForm/RSVPFormComponent.js
import React from 'react';
import { Field } from 'redux-form';

const Form = ({ handleSubmit, reset }) => {
	const submit = (e) => {
		handleSubmit(e);
		reset();
	}
	return (
		<form onSubmit={ submit }>
			<div>
				<label htmlFor="name">username</label>
				<Field name="name" component="input" type="text" />
			</div>
			<div>
				<label htmlFor="password">password</label>
				<Field name="password" component="input" type="text" />
			</div>
			<button type="submit">RSVP</button>
		</form>
	);
};

export default Form;
<file_sep>/src/containers/App/index.js
import React from 'react';
import { Match } from 'react-router';
import AdminOnly from '../../hocs/AdminOnly';
import LandingPage from '../LandingPage';
import GuestManagement from '../GuestManagement';

export default (props) => (
  <div>
    <Match exactly pattern='/' component={ LandingPage } />
    <Match pattern='/guest-management' component={ AdminOnly(GuestManagement) }/>
  </div>
);
