Skip to content

Commit 1bc2f73

Browse files
committed
refactor: Rename 'description' to 'about' in PersonCard component and update related tests
- Changed 'description' field to 'about' in the PersonCard component and its associated tests - Updated stories to reflect the new 'about' prop for consistency across components
1 parent d606499 commit 1bc2f73

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/Components/PersonCard/PersonCard.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const meta: Meta<typeof PersonCard> = {
2727
showSocialLinks: {
2828
control: { type: "boolean" }
2929
},
30-
showDescription: {
30+
about: {
3131
control: { type: "boolean" }
3232
},
3333
maxTags: {

src/Components/PersonCard/PersonCard.test.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ import { IPerson, IPersonAction } from "./types";
77

88
const mockPerson: IPerson = {
99
id: 1,
10-
firstName: "Ada",
11-
lastName: "Lovelace",
10+
name: "Ada Lovelace",
1211
username: "ada_lovelace",
1312
email: "ada@lovelace.com",
1413
avatar: "https://example.com/avatar.jpg",
15-
description: "Pioneer in computer science and mathematics",
14+
about: "Pioneer in computer science and mathematics",
1615
role: "Software Engineer",
1716
location: "London, UK",
1817
badge: {
@@ -183,19 +182,24 @@ describe("PersonCard", () => {
183182
});
184183

185184
it("hides sections based on props", () => {
185+
const personWithoutAbout = {
186+
...mockPerson,
187+
about: undefined
188+
};
189+
186190
render(
187191
<PersonCard
188-
person={mockPerson}
192+
person={personWithoutAbout}
189193
showTags={false}
190194
showSocialLinks={false}
191-
showDescription={false}
192195
/>
193196
);
194197

195198
expect(screen.queryByText("JavaScript")).not.toBeInTheDocument();
196199
expect(
197200
screen.queryByText("Pioneer in computer science and mathematics")
198201
).not.toBeInTheDocument();
202+
199203
expect(screen.queryByTitle("github")).not.toBeInTheDocument();
200204
});
201205

@@ -211,8 +215,7 @@ describe("PersonCard", () => {
211215
it("handles missing optional fields gracefully", () => {
212216
const minimalPerson: IPerson = {
213217
id: 1,
214-
firstName: "John",
215-
lastName: "Doe"
218+
name: "John Doe"
216219
};
217220

218221
render(<PersonCard person={minimalPerson} />);
@@ -285,7 +288,7 @@ describe("PersonCard", () => {
285288
"This is a very long description that should be truncated";
286289
const personWithLongDescription = {
287290
...mockPerson,
288-
description: longDescription
291+
about: longDescription
289292
};
290293

291294
render(
@@ -319,7 +322,7 @@ describe("PersonCardSkeleton", () => {
319322
<PersonCardSkeleton
320323
showTags={false}
321324
showSocialLinks={false}
322-
showDescription={false}
325+
about={false}
323326
/>
324327
);
325328

0 commit comments

Comments
 (0)