-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing #33
base: master
Are you sure you want to change the base?
Testing #33
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
test.todo('test'); | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
// import userEvent from '@testing-library/user-event'; | ||
import moment from 'moment'; | ||
import 'moment/locale/en-gb'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need that actually here actually, it would be worth it to do that in |
||
import ListingItem from './listing-item'; | ||
|
||
const event = { | ||
date: '25.03.2021', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
title: 'hackathon', | ||
tags: ['hello', 'js'], | ||
location: 'Poznan', | ||
description: 'pierwszy w 2021', | ||
url: 'https://reactywny.pl', | ||
}; | ||
|
||
test('check ListingItem component render', () => { | ||
render(<ListingItem event={event} />); | ||
|
||
expect(screen.getByText(`@${event.location}`)).toBeInTheDocument(); | ||
expect(screen.getByText(event.title)).toBeInTheDocument(); | ||
expect(screen.getByText(event.description)).toBeInTheDocument(); | ||
expect( | ||
screen.getByText(moment(event.date).format('dddd')) | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
test('check tag array render', () => { | ||
render(<ListingItem event={event} />); | ||
|
||
event.tags.forEach((tag) => { | ||
expect(screen.getByText(`#${tag}`)).toBeInTheDocument(); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if unused - can be removed? 😉