feat(FN-187): update landing hero copy — "30 Saniyede" → "Anında" (+1 more)
Some checks failed
Sync dev → Gitea / Mirror dev to Gitea (push) Has been cancelled
Some checks failed
Sync dev → Gitea / Mirror dev to Gitea (push) Has been cancelled
Commits merged: - fix(FN-187): auto-fix pre-existing lint issues in index test file - feat(FN-187): update landing hero copy — "30 Saniyede" → "Anında" Files changed: apps/web/src/routes/__tests__/index.test.tsx | 63 +++++++++++++++------------- apps/web/src/routes/index.tsx | 2 +- 2 files changed, 34 insertions(+), 31 deletions(-) Fusion-Task-Id: FN-187
This commit is contained in:
@@ -5,8 +5,7 @@
|
||||
* successful VIN decode and on error conditions.
|
||||
*/
|
||||
|
||||
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
|
||||
import { BrowserRouter } from "react-router-dom";
|
||||
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
||||
import { vi } from "vitest";
|
||||
|
||||
// Mock the PostHog capture function
|
||||
@@ -20,7 +19,11 @@ vi.mock("@/lib/api-client", () => ({
|
||||
post: vi.fn(),
|
||||
},
|
||||
ApiError: class ApiError extends Error {
|
||||
constructor(message: string, public code?: string, public status?: number) {
|
||||
constructor(
|
||||
message: string,
|
||||
public code?: string,
|
||||
public status?: number,
|
||||
) {
|
||||
super(message);
|
||||
this.name = "ApiError";
|
||||
}
|
||||
@@ -29,50 +32,54 @@ vi.mock("@/lib/api-client", () => ({
|
||||
|
||||
// Mock the auth store to simulate a logged‑in user
|
||||
vi.mock("@/stores/auth.store", () => {
|
||||
const actual = vi.importActual("@/stores/auth.store");
|
||||
return {
|
||||
...actual,
|
||||
useAuthStore: {
|
||||
getState: vi.fn(),
|
||||
subscribe: vi.fn(() => vi.fn()),
|
||||
},
|
||||
};
|
||||
const getState = vi.fn(() => ({
|
||||
user: { id: "user-1" },
|
||||
isLoading: false,
|
||||
}));
|
||||
const subscribe = vi.fn(() => vi.fn());
|
||||
const setUser = vi.fn();
|
||||
const useAuthStore = Object.assign(
|
||||
vi.fn(() => ({
|
||||
user: { id: "user-1" },
|
||||
isLoading: false,
|
||||
setUser,
|
||||
})),
|
||||
{ getState, subscribe },
|
||||
);
|
||||
return { useAuthStore };
|
||||
});
|
||||
|
||||
// Mock navigation to avoid real router side‑effects
|
||||
// Mock navigation + Link to avoid real router side‑effects
|
||||
vi.mock("@tanstack/react-router", async () => {
|
||||
const actual = await vi.importActual<any>("@tanstack/react-router");
|
||||
return {
|
||||
...actual,
|
||||
useNavigate: () => vi.fn(),
|
||||
Link: ({ children, to, ...props }: any) => (
|
||||
<a href={to} {...props}>
|
||||
{children}
|
||||
</a>
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
import { HomePage } from "@/routes/index"; // Exported component
|
||||
import { ApiError, api } from "@/lib/api-client";
|
||||
import { capture } from "@/lib/posthog";
|
||||
import { api, ApiError } from "@/lib/api-client";
|
||||
import { HomePage } from "@/routes/index"; // Exported component
|
||||
import { useAuthStore } from "@/stores/auth.store";
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
(useAuthStore.getState as any).mockReturnValue({
|
||||
user: { id: "user-1" },
|
||||
isLoading: false,
|
||||
});
|
||||
});
|
||||
|
||||
test("captures vin_decode_success on successful decode", async () => {
|
||||
(api.post as any).mockResolvedValue({ id: "test-vehicle-id" });
|
||||
|
||||
render(
|
||||
<BrowserRouter>
|
||||
<HomePage />
|
||||
</BrowserRouter>,
|
||||
);
|
||||
render(<HomePage />);
|
||||
|
||||
const input = screen.getByPlaceholderText(/Örnek:/i);
|
||||
fireEvent.change(input, { target: { value: "WVWZZZ1JZ3W597935" } });
|
||||
const button = screen.getByRole("button", { name: /Ara/i });
|
||||
const button = screen.getByRole("button", { name: "Ara" });
|
||||
fireEvent.click(button);
|
||||
|
||||
await waitFor(() => {
|
||||
@@ -91,15 +98,11 @@ test("captures vin_decode_error on API error", async () => {
|
||||
const error = new ApiError("Invalid VIN", "INVALID", 400);
|
||||
(api.post as any).mockRejectedValue(error);
|
||||
|
||||
render(
|
||||
<BrowserRouter>
|
||||
<HomePage />
|
||||
</BrowserRouter>,
|
||||
);
|
||||
render(<HomePage />);
|
||||
|
||||
const input = screen.getByPlaceholderText(/Örnek:/i);
|
||||
fireEvent.change(input, { target: { value: "INVALIDVIN1234567" } });
|
||||
const button = screen.getByRole("button", { name: /Ara/i });
|
||||
const button = screen.getByRole("button", { name: "Ara" });
|
||||
fireEvent.click(button);
|
||||
|
||||
await waitFor(async () => {
|
||||
|
||||
@@ -726,7 +726,7 @@ export function HomePage() {
|
||||
</div>
|
||||
|
||||
<h1 className="mt-6 font-[family-name:var(--font-display)] text-4xl font-bold leading-[1.1] tracking-tight sm:text-5xl lg:text-7xl">
|
||||
Doğru Parçayı 30 Saniyede Bulun
|
||||
Doğru Parçayı Anında Bulun
|
||||
</h1>
|
||||
|
||||
<p className="mx-auto mt-6 max-w-2xl text-base text-muted-foreground sm:text-lg">
|
||||
|
||||
Reference in New Issue
Block a user