Skip to content

Commit 7845314

Browse files
committed
test for card
1 parent 783aa61 commit 7845314

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import Card from "../Card";
2+
import { render, screen } from "@testing-library/react";
3+
4+
test("should render a title", () => {
5+
render(
6+
<Card
7+
title="countryName"
8+
url="https://example.com"
9+
image="test-image.jpg"
10+
/>
11+
);
12+
const titleElement = screen.getAllByText("countryName");
13+
expect(titleElement).toBeInTheDocument();
14+
});
15+
16+
test("should render a link with the correct URL", () => {
17+
render(
18+
<Card title="Manchester" url="https://example.com" image="test-image.jpg" />
19+
);
20+
const linkElement = screen.getByRole("link", { name: "Manchester" });
21+
expect(linkElement).toBeInTheDocument();
22+
expect(linkElement).toHaveAttribute("href", "https://example.com");
23+
});
24+
25+
test("should render an image with alt text", () => {
26+
render(
27+
<Card title="Manchester" url="https://example.com" image="test-image.jpg" />
28+
);
29+
const imageElement = screen.getByAltText("Manchester");
30+
expect(imageElement).toBeInTheDocument();
31+
});

witch main

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Feature-Active-row
2+
Feature-Search-State
3+
Feature-implement-Search-functionality
4+
FeatureCalculateDuration
5+
Search-onSubmit
6+
feature-booking-state
7+
* feature-card
8+
feature-deck
9+
fetch-bookings
10+
main
11+
search-results

0 commit comments

Comments
 (0)