ci: Prettier纳入两层防御体系 (#520)
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Successful in 1m6s
CI Build & Deploy Pipeline / Build Staging Web Image (push) Successful in 1m49s
CI Build & Deploy Pipeline / Build Production API Image (push) Has been skipped
CI Build & Deploy Pipeline / Build Production Web Image (push) Has been skipped
CI Build & Deploy Pipeline / Build Production Worker Image (push) Has been skipped
CI Build & Deploy Pipeline / Deploy Production (push) Has been skipped
CI Build & Deploy Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Validate Code Quality And Tests (push) Successful in 3m1s
CI/CD Pipeline / Unit Tests (push) Successful in 3m20s
CI/CD Pipeline / Integration Tests (push) Successful in 1m29s
CI Build & Deploy Pipeline / Build Staging API Image (push) Successful in 7m4s
CI Build & Deploy Pipeline / Build Staging Worker Image (push) Successful in 7m54s
CI Build & Deploy Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 45s
CI Build & Deploy Pipeline / Staging E2E Tests (push) Failing after 2m50s
CI Build & Deploy Pipeline / Staging API Integration Tests (push) Successful in 3m28s
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Successful in 1m6s
CI Build & Deploy Pipeline / Build Staging Web Image (push) Successful in 1m49s
CI Build & Deploy Pipeline / Build Production API Image (push) Has been skipped
CI Build & Deploy Pipeline / Build Production Web Image (push) Has been skipped
CI Build & Deploy Pipeline / Build Production Worker Image (push) Has been skipped
CI Build & Deploy Pipeline / Deploy Production (push) Has been skipped
CI Build & Deploy Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Validate Code Quality And Tests (push) Successful in 3m1s
CI/CD Pipeline / Unit Tests (push) Successful in 3m20s
CI/CD Pipeline / Integration Tests (push) Successful in 1m29s
CI Build & Deploy Pipeline / Build Staging API Image (push) Successful in 7m4s
CI Build & Deploy Pipeline / Build Staging Worker Image (push) Successful in 7m54s
CI Build & Deploy Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 45s
CI Build & Deploy Pipeline / Staging E2E Tests (push) Failing after 2m50s
CI Build & Deploy Pipeline / Staging API Integration Tests (push) Successful in 3m28s
Co-authored-by: xiaoxia <dev@xiaoxiajianji.com> Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
This commit was merged in pull request #520.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* Login 组件单元测试
|
||||
*/
|
||||
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { BrowserRouter } from "react-router-dom";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import Login from "@/pages/auth/Login";
|
||||
import { render, screen, fireEvent, waitFor } from "@testing-library/react"
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { BrowserRouter } from "react-router-dom"
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
|
||||
import Login from "@/pages/auth/Login"
|
||||
|
||||
const renderLogin = () => {
|
||||
const queryClient = new QueryClient({
|
||||
@@ -13,7 +13,7 @@ const renderLogin = () => {
|
||||
queries: { retry: false },
|
||||
mutations: { retry: false },
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
return render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
@@ -21,34 +21,34 @@ const renderLogin = () => {
|
||||
<Login />
|
||||
</BrowserRouter>
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
describe.skip("Login Component", () => {
|
||||
it("should render login form", () => {
|
||||
renderLogin();
|
||||
renderLogin()
|
||||
|
||||
expect(screen.getByPlaceholderText("邮箱")).toBeInTheDocument();
|
||||
expect(screen.getByPlaceholderText("密码")).toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "登录" })).toBeInTheDocument();
|
||||
});
|
||||
expect(screen.getByPlaceholderText("邮箱")).toBeInTheDocument()
|
||||
expect(screen.getByPlaceholderText("密码")).toBeInTheDocument()
|
||||
expect(screen.getByRole("button", { name: "登录" })).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("should show validation errors for empty fields", async () => {
|
||||
renderLogin();
|
||||
renderLogin()
|
||||
|
||||
const submitButton = screen.getByRole("button", { name: "登录" });
|
||||
fireEvent.click(submitButton);
|
||||
const submitButton = screen.getByRole("button", { name: "登录" })
|
||||
fireEvent.click(submitButton)
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("请输入邮箱")).toBeInTheDocument();
|
||||
expect(screen.getByText("请输入密码")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
expect(screen.getByText("请输入邮箱")).toBeInTheDocument()
|
||||
expect(screen.getByText("请输入密码")).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
it("should navigate to register page", () => {
|
||||
renderLogin();
|
||||
renderLogin()
|
||||
|
||||
const registerLink = screen.getByText("立即注册");
|
||||
expect(registerLink).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
const registerLink = screen.getByText("立即注册")
|
||||
expect(registerLink).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user