Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions components/JourneyCard/JourneyCard.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { JourneyCard } from './JourneyCard';
import { render, screen } from '@testing-library/react';
import { formatDate } from '@/lib/utils';
Comment on lines +1 to +3
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing copyright header. Other test files in the codebase include '// Copyright (c) Gridiron Survivor.' and '// Licensed under the MIT License.' at the top of the file.

Copilot uses AI. Check for mistakes.

describe('JourneyCard Component', () => {

it('Renders the JourneyCard component with props when an exchange group is entered', () => {
render(<JourneyCard drawingDate='2025-10-31T05:00:00+00:00' exchangeDate='2025-11-27T06:00:00+00:00'/>);

// Verify component renders to the document
const journeyCardElement = screen.getByTestId('journey-card');
expect(journeyCardElement).toBeInTheDocument();

});

it('Verify each journey step is rendered to the document', () => {
render(<JourneyCard drawingDate='2025-10-31T05:00:00+00:00' exchangeDate='2025-11-27T06:00:00+00:00'/>);

const journeyStepOneElement = screen.getByTestId('journey-step-1');
const journeyStepTwoElement = screen.getByTestId('journey-step-2');
const journeyStepThreeElement = screen.getByTestId('journey-step-3');
const journeyStepFourElement = screen.getByTestId('journey-step-4');

expect(journeyStepOneElement).toBeInTheDocument();
expect(journeyStepTwoElement).toBeInTheDocument();
expect(journeyStepThreeElement).toBeInTheDocument();
expect(journeyStepFourElement).toBeInTheDocument();

Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing whitespace on line 28.

Suggested change

Copilot uses AI. Check for mistakes.
});

it('Verify journey steps 1 and 4 render given serialized ISO date string values', () => {
render(<JourneyCard drawingDate='2025-10-31T05:00:00+00:00' exchangeDate='2025-11-27T06:00:00+00:00'/>);

// Verifying step 1 contains the drawing date
const drawingDateElement = screen.getByTestId('journey-step-1');
const drawingDateValue = formatDate('2025-10-31T05:00:00+00:00');
expect(drawingDateElement).toHaveTextContent(drawingDateValue);

// Verifying step 4 contains the exchange date
const exchangeDateElement = screen.getByTestId('journey-step-4');
const exchangeDateValue = formatDate('2025-11-27T06:00:00+00:00');
expect(exchangeDateElement).toHaveTextContent(exchangeDateValue);
});

});
4 changes: 2 additions & 2 deletions components/JourneyCard/JourneyCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const JourneyCard = ({
];

return (
<Card className="w-full bg-groupCardGreen border-none">
<Card className="w-full bg-groupCardGreen border-none" data-testid="journey-card">
<CardHeader className="bg-groupCardGreen rounded-xl p-2">
<CardTitle className="p-4 flex gap-2 items-center text-white font-bold">
Your Gift Giving Journey
Expand All @@ -70,7 +70,7 @@ export const JourneyCard = ({
<CardContent className="pt-4">
<div className="flex flex-col gap-6">
{journeySteps.map((step) => (
<div key={step.id} className="flex gap-4 items-center">
<div key={step.id} className="flex gap-4 items-center" data-testid={`journey-step-${step.id}`}>
<div className="bg-white rounded-full w-10 h-10 flex items-center justify-center">
{step.icon}
</div>
Expand Down