mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
Lint
This commit is contained in:
@ -11,7 +11,7 @@ interface FieldError {
|
|||||||
detail: string
|
detail: string
|
||||||
}
|
}
|
||||||
|
|
||||||
type FieldErrors = Record<FieldError["field"], FieldError["detail"]>
|
export type FieldErrors = Record<FieldError["field"], FieldError["detail"]>
|
||||||
|
|
||||||
export interface ApiErrorResponse {
|
export interface ApiErrorResponse {
|
||||||
message: string
|
message: string
|
||||||
|
@ -4,9 +4,9 @@ import { rest } from "msw"
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { Language as FormLanguage } from "../../../components/CreateUserForm/CreateUserForm"
|
import { Language as FormLanguage } from "../../../components/CreateUserForm/CreateUserForm"
|
||||||
import { Language as FooterLanguage } from "../../../components/FormFooter/FormFooter"
|
import { Language as FooterLanguage } from "../../../components/FormFooter/FormFooter"
|
||||||
import { Language as UserLanguage } from "../../../xServices/users/usersXService"
|
|
||||||
import { history, render } from "../../../testHelpers"
|
import { history, render } from "../../../testHelpers"
|
||||||
import { server } from "../../../testHelpers/server"
|
import { server } from "../../../testHelpers/server"
|
||||||
|
import { Language as UserLanguage } from "../../../xServices/users/usersXService"
|
||||||
import { CreateUserPage, Language } from "./CreateUserPage"
|
import { CreateUserPage, Language } from "./CreateUserPage"
|
||||||
|
|
||||||
const fillForm = async ({
|
const fillForm = async ({
|
||||||
@ -54,13 +54,18 @@ describe("Create User Page", () => {
|
|||||||
const fieldErrorMessage = "username already in use"
|
const fieldErrorMessage = "username already in use"
|
||||||
server.use(
|
server.use(
|
||||||
rest.post("/api/v2/users", (req, res, ctx) => {
|
rest.post("/api/v2/users", (req, res, ctx) => {
|
||||||
return res(ctx.status(400), ctx.json({
|
return res(
|
||||||
|
ctx.status(400),
|
||||||
|
ctx.json({
|
||||||
message: "invalid field",
|
message: "invalid field",
|
||||||
errors: [{
|
errors: [
|
||||||
|
{
|
||||||
detail: fieldErrorMessage,
|
detail: fieldErrorMessage,
|
||||||
field: "username"
|
field: "username",
|
||||||
}]
|
},
|
||||||
}))
|
],
|
||||||
|
}),
|
||||||
|
)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
render(<CreateUserPage />)
|
render(<CreateUserPage />)
|
||||||
|
Reference in New Issue
Block a user