@eureca/eureca-ui
Version:
UI component library of Eureca's user and admin apps
30 lines (23 loc) • 737 B
JavaScript
import React from 'react';
import { render } from '@testing-library/react';
import { JourneyCard } from '../journey';
const mockData = {
type: 'in-person',
date: new Date(),
text: 'Mock text',
};
function renderJourneyCard({ type, date, text }) {
return render(<JourneyCard type={type} date={date} text={text} />);
}
describe('Journey Card component', () => {
it('renders', () => {
const { getByTestId } = renderJourneyCard(mockData);
const card = getByTestId('card-testid');
expect(card).not.toBeNull();
});
it('has a text rendered', () => {
const { getByTestId } = renderJourneyCard(mockData);
const text = getByTestId('text-testid');
expect(text.textContent).toBe(mockData.text);
});
});