i18n 적용
This commit is contained in:
@@ -54,10 +54,10 @@ describe("SignupPage", () => {
|
||||
|
||||
render(<SignupPage />);
|
||||
|
||||
const emailInput = screen.getByLabelText("이메일") as HTMLInputElement;
|
||||
const passwordInput = screen.getByLabelText("비밀번호") as HTMLInputElement;
|
||||
const confirmInput = screen.getByLabelText("비밀번호 확인") as HTMLInputElement;
|
||||
const submitButton = screen.getByRole("button", { name: "회원가입" });
|
||||
const emailInput = screen.getByLabelText("Email") as HTMLInputElement;
|
||||
const passwordInput = screen.getByLabelText("Password") as HTMLInputElement;
|
||||
const confirmInput = screen.getByLabelText("Confirm password") as HTMLInputElement;
|
||||
const submitButton = screen.getByRole("button", { name: "Sign up" });
|
||||
|
||||
fireEvent.change(emailInput, { target: { value: "new@example.com" } });
|
||||
fireEvent.change(passwordInput, { target: { value: "securePass1" } });
|
||||
@@ -118,10 +118,10 @@ describe("SignupPage", () => {
|
||||
|
||||
render(<SignupPage />);
|
||||
|
||||
const emailInput = screen.getByLabelText("이메일") as HTMLInputElement;
|
||||
const passwordInput = screen.getByLabelText("비밀번호") as HTMLInputElement;
|
||||
const confirmInput = screen.getByLabelText("비밀번호 확인") as HTMLInputElement;
|
||||
const submitButton = screen.getByRole("button", { name: "회원가입" });
|
||||
const emailInput = screen.getByLabelText("Email") as HTMLInputElement;
|
||||
const passwordInput = screen.getByLabelText("Password") as HTMLInputElement;
|
||||
const confirmInput = screen.getByLabelText("Confirm password") as HTMLInputElement;
|
||||
const submitButton = screen.getByRole("button", { name: "Sign up" });
|
||||
|
||||
fireEvent.change(emailInput, { target: { value: "dup@example.com" } });
|
||||
fireEvent.change(passwordInput, { target: { value: "securePass1" } });
|
||||
@@ -183,9 +183,9 @@ describe("SignupPage", () => {
|
||||
|
||||
render(<SignupPage />);
|
||||
|
||||
const emailInput = screen.getByLabelText("이메일") as HTMLInputElement;
|
||||
const passwordInput = screen.getByLabelText("비밀번호") as HTMLInputElement;
|
||||
const confirmInput = screen.getByLabelText("비밀번호 확인") as HTMLInputElement;
|
||||
const emailInput = screen.getByLabelText("Email") as HTMLInputElement;
|
||||
const passwordInput = screen.getByLabelText("Password") as HTMLInputElement;
|
||||
const confirmInput = screen.getByLabelText("Confirm password") as HTMLInputElement;
|
||||
|
||||
const emailClass = emailInput.className;
|
||||
const passwordClass = passwordInput.className;
|
||||
@@ -214,7 +214,7 @@ describe("SignupPage", () => {
|
||||
|
||||
render(<SignupPage />);
|
||||
|
||||
const confirmInput = await screen.findByLabelText("비밀번호 확인");
|
||||
const confirmInput = await screen.findByLabelText("Confirm password");
|
||||
expect(confirmInput).toBeTruthy();
|
||||
});
|
||||
|
||||
@@ -248,10 +248,10 @@ describe("SignupPage", () => {
|
||||
|
||||
render(<SignupPage />);
|
||||
|
||||
const emailInput = screen.getByLabelText("이메일") as HTMLInputElement;
|
||||
const passwordInput = screen.getByLabelText("비밀번호") as HTMLInputElement;
|
||||
const confirmInput = screen.getByLabelText("비밀번호 확인") as HTMLInputElement;
|
||||
const submitButton = screen.getByRole("button", { name: "회원가입" });
|
||||
const emailInput = screen.getByLabelText("Email") as HTMLInputElement;
|
||||
const passwordInput = screen.getByLabelText("Password") as HTMLInputElement;
|
||||
const confirmInput = screen.getByLabelText("Confirm password") as HTMLInputElement;
|
||||
const submitButton = screen.getByRole("button", { name: "Sign up" });
|
||||
|
||||
fireEvent.change(emailInput, { target: { value: "new@example.com" } });
|
||||
fireEvent.change(passwordInput, { target: { value: "securePass1" } });
|
||||
@@ -259,7 +259,7 @@ describe("SignupPage", () => {
|
||||
|
||||
fireEvent.click(submitButton);
|
||||
|
||||
const errorText = await screen.findByText(/비밀번호와 비밀번호 확인이 일치하지 않습니다/);
|
||||
const errorText = await screen.findByText("Password and confirmation do not match.");
|
||||
expect(errorText).toBeTruthy();
|
||||
|
||||
const signupCall = fetchMock.mock.calls.find(([url, options]) => {
|
||||
@@ -281,11 +281,11 @@ describe("SignupPage", () => {
|
||||
|
||||
render(<SignupPage />);
|
||||
|
||||
const passwordInput = screen.getByLabelText("비밀번호") as HTMLInputElement;
|
||||
const passwordInput = screen.getByLabelText("Password") as HTMLInputElement;
|
||||
|
||||
fireEvent.change(passwordInput, { target: { value: "abc12345" } });
|
||||
|
||||
const weakText = await screen.findByText("비밀번호 난이도: 약함");
|
||||
const weakText = await screen.findByText("Password strength: Weak");
|
||||
expect(weakText).toBeTruthy();
|
||||
|
||||
const bar = await screen.findByTestId("password-strength-bar");
|
||||
@@ -306,11 +306,11 @@ describe("SignupPage", () => {
|
||||
|
||||
render(<SignupPage />);
|
||||
|
||||
const passwordInput = screen.getByLabelText("비밀번호") as HTMLInputElement;
|
||||
const passwordInput = screen.getByLabelText("Password") as HTMLInputElement;
|
||||
|
||||
fireEvent.change(passwordInput, { target: { value: "Abc12345" } });
|
||||
|
||||
const mediumText = await screen.findByText("비밀번호 난이도: 보통");
|
||||
const mediumText = await screen.findByText("Password strength: Medium");
|
||||
expect(mediumText).toBeTruthy();
|
||||
|
||||
const bar = await screen.findByTestId("password-strength-bar");
|
||||
@@ -318,29 +318,4 @@ describe("SignupPage", () => {
|
||||
expect(barClass).toContain("w-2/3");
|
||||
expect(barClass).toContain("bg-amber-500");
|
||||
});
|
||||
|
||||
it("대소문자/숫자/특수문자가 섞인 충분히 긴 비밀번호는 난이도가 강함으로 표시되어야 한다", async () => {
|
||||
const fetchMock = vi.fn().mockResolvedValue(
|
||||
new Response(JSON.stringify({ message: "인증이 필요합니다." }), {
|
||||
status: 401,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
}),
|
||||
);
|
||||
|
||||
vi.stubGlobal("fetch", fetchMock as any);
|
||||
|
||||
render(<SignupPage />);
|
||||
|
||||
const passwordInput = screen.getByLabelText("비밀번호") as HTMLInputElement;
|
||||
|
||||
fireEvent.change(passwordInput, { target: { value: "Abc12345!@" } });
|
||||
|
||||
const strongText = await screen.findByText("비밀번호 난이도: 강함");
|
||||
expect(strongText).toBeTruthy();
|
||||
|
||||
const bar = await screen.findByTestId("password-strength-bar");
|
||||
const barClass = bar.className;
|
||||
expect(barClass).toContain("w-full");
|
||||
expect(barClass).toContain("bg-emerald-600");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user