-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Front end registration page to match API
- Loading branch information
Showing
11 changed files
with
81 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,9 @@ export const EXISTING_TEST_USER: TestUser = { | |
emailConfirmedAt: null, | ||
email: "[email protected]", | ||
password: "password", | ||
firstName: "Test", | ||
lastName: "Example", | ||
phoneNumber: "(123) 456-7890", | ||
firstname: "Test", | ||
lastname: "Example", | ||
phone_number: "(123) 456-7890", | ||
role: "Public" | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,9 @@ describe("api", () => { | |
active: true, | ||
email: "[email protected]", | ||
emailConfirmedAt: null, | ||
firstName: "Test", | ||
lastName: "Example", | ||
phoneNumber: "(123) 456-7890", | ||
firstname: "Test", | ||
lastname: "Example", | ||
phone_number: "(123) 456-7890", | ||
role: "Public" | ||
}) | ||
}) | ||
|
@@ -43,27 +43,27 @@ describe("api", () => { | |
const newUser: api.NewUser = { | ||
email: uniqueEmail(), | ||
password: "password", | ||
firstName: "June", | ||
lastName: "Grey", | ||
phoneNumber: "(555) 555-5555" | ||
firstname: "June", | ||
lastname: "Grey", | ||
phone_number: "(555) 555-5555" | ||
} | ||
|
||
const accessToken = await api.register(newUser) | ||
expect(accessToken).toBeTruthy() | ||
const user = await api.whoami({ accessToken }) | ||
|
||
expect(user.email).toEqual(newUser.email) | ||
expect(user.firstName).toEqual(newUser.firstName) | ||
expect(user.lastName).toEqual(newUser.lastName) | ||
expect(user.phoneNumber).toEqual(newUser.phoneNumber) | ||
expect(user.firstname).toEqual(newUser.firstname) | ||
expect(user.lastname).toEqual(newUser.lastname) | ||
expect(user.phone_number).toEqual(newUser.phone_number) | ||
}) | ||
|
||
it("rejects existing accounts", async () => { | ||
const newUser: api.NewUser = { | ||
email: EXISTING_TEST_USER.email, | ||
password: "password", | ||
firstName: "June", | ||
lastName: "Grey" | ||
firstname: "June", | ||
lastname: "Grey" | ||
} | ||
|
||
let error = await api.register(newUser).catch((e) => e) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,9 +18,9 @@ describe("behaviors", () => { | |
email: getByRole("textbox", { name: /email address/i }), | ||
createPassword: getByLabelText(/create password/i), | ||
confirmPassword: getByLabelText(/confirm password/i), | ||
firstName: getByRole("textbox", { name: /first name/i }), | ||
lastName: getByRole("textbox", { name: /last name/i }), | ||
phoneNumber: getByRole("textbox", { name: /phone number/i }), | ||
firstname: getByRole("textbox", { name: /first name/i }), | ||
lastname: getByRole("textbox", { name: /last name/i }), | ||
phone_number: getByRole("textbox", { name: /phone number/i }), | ||
submit: getByRole("button", { name: /submit/i }) | ||
} | ||
} | ||
|
@@ -38,9 +38,9 @@ describe("behaviors", () => { | |
"email", | ||
"createPassword", | ||
"confirmPassword", | ||
"firstName", | ||
"lastName", | ||
"phoneNumber" | ||
"firstname", | ||
"lastname", | ||
"phone_number" | ||
]) { | ||
expect(elements[k].getAttribute("aria-invalid")).toBeTruthy() | ||
} | ||
|
@@ -49,7 +49,7 @@ describe("behaviors", () => { | |
it("checks phone number length", async () => { | ||
const r = renderPage() | ||
act(() => { | ||
userEvent.type(r.phoneNumber, "5555555555555") | ||
userEvent.type(r.phone_number, "5555555555555") | ||
userEvent.click(r.submit) | ||
}) | ||
await expect(r.findByText(/phone number is required/)).resolves.toBeInTheDocument() | ||
|
@@ -79,10 +79,10 @@ describe("behaviors", () => { | |
it("requires matching passwords", async () => { | ||
const r = renderPage() | ||
act(() => { | ||
userEvent.type(r.firstName, "Spencer") | ||
userEvent.type(r.lastName, "Bool") | ||
userEvent.type(r.firstname, "Spencer") | ||
userEvent.type(r.lastname, "Bool") | ||
userEvent.type(r.email, "[email protected]") | ||
userEvent.type(r.phoneNumber, "555 555 5555") | ||
userEvent.type(r.phone_number, "555 555 5555") | ||
userEvent.type(r.createPassword, "aA1!asdfasdf") | ||
userEvent.type(r.confirmPassword, "mistmatch") | ||
userEvent.click(r.submit) | ||
|
@@ -93,10 +93,10 @@ describe("behaviors", () => { | |
it("should create a new user", async () => { | ||
const r = renderPage() | ||
act(() => { | ||
userEvent.type(r.firstName, "Spencer") | ||
userEvent.type(r.lastName, "Bool") | ||
userEvent.type(r.firstname, "Spencer") | ||
userEvent.type(r.lastname, "Bool") | ||
userEvent.type(r.email, uniqueEmail()) | ||
userEvent.type(r.phoneNumber, "555 555 5555") | ||
userEvent.type(r.phone_number, "555 555 5555") | ||
userEvent.type(r.createPassword, "aA1!asdfasdf") | ||
userEvent.type(r.confirmPassword, "aA1!asdfasdf") | ||
|
||
|
@@ -108,10 +108,10 @@ describe("behaviors", () => { | |
it("should reject existing accounts", async () => { | ||
const r = renderPage() | ||
act(() => { | ||
userEvent.type(r.firstName, "Spencer") | ||
userEvent.type(r.lastName, "Bool") | ||
userEvent.type(r.firstname, "Spencer") | ||
userEvent.type(r.lastname, "Bool") | ||
userEvent.type(r.email, "[email protected]") | ||
userEvent.type(r.phoneNumber, "555 555 5555") | ||
userEvent.type(r.phone_number, "555 555 5555") | ||
userEvent.type(r.createPassword, "aA1!asdfasdf") | ||
userEvent.type(r.confirmPassword, "aA1!asdfasdf") | ||
|
||
|