Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
refactor: remove the user name
  • Loading branch information
BrunoQuaresma committed Apr 26, 2022
commit f225f18e9e2eeefa95c63366014efde070b97d37
2 changes: 0 additions & 2 deletions site/src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export interface UserResponse {
readonly username: string
readonly email: string
readonly created_at: string
readonly name: string
}

/**
Expand Down Expand Up @@ -100,5 +99,4 @@ export interface WorkspaceAutostopRequest {
export interface UpdateProfileRequest {
readonly username: string
readonly email: string
readonly name: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ interface AccountFormValues {
}

export const Language = {
nameLabel: "Name",
usernameLabel: "Username",
emailLabel: "Email",
emailInvalid: "Please enter a valid email address.",
Expand All @@ -24,7 +23,6 @@ export const Language = {

const validationSchema = Yup.object({
email: Yup.string().trim().email(Language.emailInvalid).required(Language.emailRequired),
name: Yup.string().optional(),
username: Yup.string().trim(),
})

Expand Down Expand Up @@ -55,14 +53,6 @@ export const AccountForm: React.FC<AccountFormProps> = ({
<>
<form onSubmit={form.handleSubmit}>
<Stack>
<TextField
{...getFieldHelpers("name")}
autoFocus
autoComplete="name"
fullWidth
label={Language.nameLabel}
variant="outlined"
/>
<TextField
{...getFieldHelpers("email")}
onChange={onChangeTrimmed(form)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ const renderPage = () => {
}

const newData = {
name: "User",
email: "user@coder.com",
username: "user",
}

const fillAndSubmitForm = async () => {
await waitFor(() => screen.findByLabelText("Name"))
fireEvent.change(screen.getByLabelText("Name"), { target: { value: newData.name } })
await waitFor(() => screen.findByLabelText("Email"))
fireEvent.change(screen.getByLabelText("Email"), { target: { value: newData.email } })
fireEvent.change(screen.getByLabelText("Username"), { target: { value: newData.username } })
fireEvent.click(screen.getByText(AccountForm.Language.updatePreferences))
Expand Down
2 changes: 0 additions & 2 deletions site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const MockBuildInfo: BuildInfoResponse = {
}

export const MockUser: UserResponse = {
name: "Test User",
id: "test-user",
username: "TestUser",
email: "test@coder.com",
Expand All @@ -30,7 +29,6 @@ export const MockUser: UserResponse = {

export const MockUser2: UserResponse = {
id: "test-user-2",
name: "Test User 2",
username: "TestUser2",
email: "test2@coder.com",
created_at: "",
Expand Down