Browse Source
refactor(marriage): add visibility control to entry route resolver
refactor(marriage): add visibility control to entry route resolver
Introduces `anonymousEntryVisible` prop to `EntryRouteResolver` to conditionally prevent redirection to the intro page. Also removes the legacy `bridgeWaitTimeout` logic and cleans up the effect dependencies.Dev
5 changed files with 111 additions and 16 deletions
-
10src/app/[lang]/page.tsx
-
6src/components/Componentes/entry-route-resolver.test.tsx
-
22src/components/Componentes/entry-route-resolver.tsx
-
57src/components/Componentes/network-image.test.tsx
-
30src/hooks/marriage/use-profile-main.test.ts
@ -0,0 +1,57 @@ |
|||
import { render, screen, fireEvent, cleanup } from "@testing-library/react"; |
|||
import { describe, expect, it, afterEach } from "vitest"; |
|||
import NetworkImage from "./network-image"; |
|||
|
|||
describe("NetworkImage", () => { |
|||
afterEach(() => { |
|||
cleanup(); |
|||
}); |
|||
|
|||
it("renders fallback image when src is not provided", () => { |
|||
render( |
|||
<NetworkImage |
|||
fallbackSrc="/assets/images/Frame 2095586523.png" |
|||
alt="fallback image" |
|||
width={300} |
|||
height={200} |
|||
/>, |
|||
); |
|||
|
|||
const img = screen.getByAltText("fallback image"); |
|||
expect(img).toBeDefined(); |
|||
expect(img.getAttribute("src")).toContain("Frame%202095586523.png"); |
|||
}); |
|||
|
|||
it("renders provided src when available", () => { |
|||
render( |
|||
<NetworkImage |
|||
src="https://example.com/custom-thumbnail.jpg" |
|||
fallbackSrc="/assets/images/Frame 2095586523.png" |
|||
alt="custom image" |
|||
width={300} |
|||
height={200} |
|||
/>, |
|||
); |
|||
|
|||
const img = screen.getByAltText("custom image"); |
|||
expect(img).toBeDefined(); |
|||
expect(img.getAttribute("src")).toBe("https://example.com/custom-thumbnail.jpg"); |
|||
}); |
|||
|
|||
it("switches to fallbackSrc on image load error", () => { |
|||
render( |
|||
<NetworkImage |
|||
src="https://example.com/broken-image.jpg" |
|||
fallbackSrc="/assets/images/Frame 2095586523.png" |
|||
alt="broken image" |
|||
width={300} |
|||
height={200} |
|||
/>, |
|||
); |
|||
|
|||
const img = screen.getByAltText("broken image"); |
|||
fireEvent.error(img); |
|||
|
|||
expect(img.getAttribute("src")).toContain("Frame%202095586523.png"); |
|||
}); |
|||
}); |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue