Skip to content

Commit

Permalink
added small Register test
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreacy002 committed Jun 19, 2020
1 parent e33ae8e commit b68d5ea
Show file tree
Hide file tree
Showing 4 changed files with 299 additions and 4 deletions.
18 changes: 15 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
]
},
"devDependencies": {
"react-bootstrap": "^1.0.1"
"react-bootstrap": "^1.0.1",
"react-test-renderer": "^16.13.1"
}
}
9 changes: 9 additions & 0 deletions src/tests/Register.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import Register from "../register/Register";

test('renders Register', () => {
const renderer = new ShallowRenderer();
renderer.render(<Register />);
expect(renderer.getRenderOutput()).toMatchSnapshot()
});
273 changes: 273 additions & 0 deletions src/tests/__snapshots__/Register.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders Register 1`] = `
<div
className="container"
>
<div
className="row mb-5"
>
<div
className="col-lg-12 text-center"
>
<h1
className="mt-5"
>
Register Form
</h1>
</div>
</div>
<div
className="row"
>
<div
className="col-lg-12"
>
<form
className="register-form mx-auto"
onSubmit={[Function]}
>
<form-group
controlId="formName"
>
<p
className="input-control"
>
<label
htmlFor="name"
>
Name :
</label>
<input
className="field"
maxLength={30}
minLength={2}
name="name"
onChange={[Function]}
pattern="^[a-zA-Z\\\\s\\\\-]+$"
placeholder="Full Name"
required={true}
type="text"
/>
</p>
</form-group>
<div>
<br />
</div>
<form-group
controlId="formUserame"
>
<p
className="input-control"
>
<label
htmlFor="username"
>
Username :
</label>
<input
className="field"
maxLength={25}
minLength={5}
name="username"
onChange={[Function]}
pattern="^[a-zA-Z0-9/_]+$"
placeholder="Username"
required={true}
type="text"
/>
</p>
</form-group>
<div>
<br />
</div>
<form-group
controlId="formEmail"
>
<p
className="input-control"
>
<label
htmlFor="email"
>
Email :
</label>
<input
className="field"
name="email"
onChange={[Function]}
pattern="^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\\\.[a-zA-Z0-9-.]+$"
placeholder="Email"
required={true}
type="email"
/>
</p>
</form-group>
<div>
<br />
</div>
<form-group
controlId="formPassword"
>
<p
className="input-control"
>
<label
htmlFor="password"
>
Password :
</label>
<input
className="field"
maxLength={64}
minLength={8}
name="password"
onChange={[Function]}
placeholder="Password"
required={true}
type="password"
/>
</p>
</form-group>
<div>
<br />
</div>
<div>
<br />
</div>
<form-group>
<div
className="row"
>
<div
className="col-sm text-center"
>
<label
htmlFor="availability"
>
Available to be a :
</label>
<form-group>
<div
className="mb-3"
>
<div
className="row"
>
<div
className="col-sm"
>
<input
id="inline-checkbox-1"
name="available_to_mentor"
onChange={[Function]}
type="checkbox"
value={true}
/>
<label
htmlFor="mentor"
>
Mentor
</label>
</div>
<div
className="col-sm"
>
<input
id="inline-checkbox-2"
name="need_mentoring"
onChange={[Function]}
type="checkbox"
value={true}
/>
<label
htmlFor="mentee"
>
Mentee
</label>
</div>
</div>
</div>
</form-group>
</div>
</div>
</form-group>
<form-group
controlId="formTermsCheck"
>
<div
className="row"
>
<div
className="col-sm"
>
<p
className="input-control"
>
<input
name="terms_and_conditions_checked"
onChange={[Function]}
required={true}
type="checkbox"
value={true}
/>
</p>
</div>
<div
className="col-sm-10"
>
<label>
By checking this box, I affirm that I have read and accept to be bound by the AnitaB.org Code of Conduct, Terms, and Privacy Policy. Further I consent to the use of my information for the stated purpose.
</label>
</div>
</div>
</form-group>
<div />
<div
className="row"
>
<label>
Already register? Login here.
</label>
</div>
<div
className="row button-group"
>
<div
className="col-sm"
>
<div
className="row"
>
<a
className="btn btn-primary"
href="/login"
id="loginbtn"
role="button"
>
Login
</a>
</div>
</div>
<div
className="col-sm"
/>
<div
className="col-sm"
>
<button
className="btn btn-success"
name="submit"
type="submit"
value="Signup"
variant="success"
>
Sign Up
</button>
</div>
</div>
</form>
</div>
</div>
</div>
`;

0 comments on commit b68d5ea

Please sign in to comment.