diff --git a/src/features/pets/components/pet-card/PetCard.test.tsx b/src/features/pets/components/pet-card/PetCard.test.tsx index ab4fd23..ef1254f 100644 --- a/src/features/pets/components/pet-card/PetCard.test.tsx +++ b/src/features/pets/components/pet-card/PetCard.test.tsx @@ -26,8 +26,8 @@ describe(PetCard.name, () => { expect(screen.queryAllByTestId("pet-tag")).toHaveLength(0) }) - it("should display exactly 5 tags", () => { - const tags = ["vacinado", "treinado", "amigável", "tímido", "sociável"] + it("should display exactly 4 tags", () => { + const tags = ["vacinado", "treinado", "amigável", "tímido"] const pet = { ...petResponseMock, tags } renderWithProviders() @@ -37,19 +37,12 @@ describe(PetCard.name, () => { expect(screen.queryByText("...")).not.toBeInTheDocument() }) - it("should display ellipsis when more than 5 tags", () => { - const tags = [ - "vacinado", - "treinado", - "amigável", - "tímido", - "sociável", - "castrado", - ] + it("should display ellipsis when more than 4 tags", () => { + const tags = ["vacinado", "treinado", "amigável", "tímido", "sociável"] const pet = { ...petResponseMock, tags } render() - tags.slice(0, 5).forEach((tag) => { + tags.slice(0, 4).forEach((tag) => { expect(screen.getByText(tag)).toBeInTheDocument() }) expect(screen.getByText("...")).toBeInTheDocument() diff --git a/src/features/pets/components/pet-card/PetCard.tsx b/src/features/pets/components/pet-card/PetCard.tsx index 84470e4..0e5dab4 100644 --- a/src/features/pets/components/pet-card/PetCard.tsx +++ b/src/features/pets/components/pet-card/PetCard.tsx @@ -11,22 +11,22 @@ export function PetCard({ pet }: PetCardProps) { return ( -
+
-
+

{pet.name}

-

{pet.specieName}

+

{pet.species}

-
- {pet.tags.slice(0, 5).map((tag) => ( +
+ {pet.tags.slice(0, 4).map((tag) => ( ))} - {pet.tags.length > 5 && ( + {pet.tags.length > 4 && ( ... )}
diff --git a/src/features/pets/types/pets.types.ts b/src/features/pets/types/pets.types.ts index db4b577..df4b4a8 100644 --- a/src/features/pets/types/pets.types.ts +++ b/src/features/pets/types/pets.types.ts @@ -3,7 +3,7 @@ import { PetStatus } from "../enums/pet-status.enum" export interface Pet { id: string name: string - specieName: string + species: string status: PetStatus tags: string[] } diff --git a/src/shared/test-utils/mocks/pets-mocks.ts b/src/shared/test-utils/mocks/pets-mocks.ts index 20aea7e..1ac7e58 100644 --- a/src/shared/test-utils/mocks/pets-mocks.ts +++ b/src/shared/test-utils/mocks/pets-mocks.ts @@ -13,7 +13,7 @@ export const petMock: PetSchema = { export const petResponseMock: Pet = { id: "d8906906-5136-4ce5-825a-73ee95a267a1", name: "Rex", - specieName: "Cachorro", + species: "Cachorro", status: PetStatus.AVAILABLE, tags: ["vacinado", "treinado"], }